From a99cd16422bb577028a1caaa6e5bde300ac78372 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Sun, 20 Nov 2022 00:14:16 +0800 Subject: [PATCH] fix: resource pack import dialog icons and add message Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com> --- launcher/ui/dialogs/ImportResourcePackDialog.cpp | 6 +++++- launcher/ui/dialogs/ImportResourcePackDialog.h | 3 +++ launcher/ui/dialogs/ImportResourcePackDialog.ui | 9 ++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/launcher/ui/dialogs/ImportResourcePackDialog.cpp b/launcher/ui/dialogs/ImportResourcePackDialog.cpp index 4fe28540..2b746605 100644 --- a/launcher/ui/dialogs/ImportResourcePackDialog.cpp +++ b/launcher/ui/dialogs/ImportResourcePackDialog.cpp @@ -8,6 +8,7 @@ #include "InstanceList.h" #include +#include "ui/instanceview/InstanceProxyModel.h" #include "ui/instanceview/InstanceDelegate.h" ImportResourcePackDialog::ImportResourcePackDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ImportResourcePackDialog) @@ -32,7 +33,10 @@ ImportResourcePackDialog::ImportResourcePackDialog(QWidget* parent) : QDialog(pa contentsWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); contentsWidget->setItemDelegate(new ListViewDelegate()); - contentsWidget->setModel(APPLICATION->instances().get()); + proxyModel = new InstanceProxyModel(this); + proxyModel->setSourceModel(APPLICATION->instances().get()); + proxyModel->sort(0); + contentsWidget->setModel(proxyModel); connect(contentsWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex))); connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), diff --git a/launcher/ui/dialogs/ImportResourcePackDialog.h b/launcher/ui/dialogs/ImportResourcePackDialog.h index b077a811..8356f204 100644 --- a/launcher/ui/dialogs/ImportResourcePackDialog.h +++ b/launcher/ui/dialogs/ImportResourcePackDialog.h @@ -3,6 +3,8 @@ #include #include +#include "ui/instanceview/InstanceProxyModel.h" + namespace Ui { class ImportResourcePackDialog; } @@ -13,6 +15,7 @@ class ImportResourcePackDialog : public QDialog { public: explicit ImportResourcePackDialog(QWidget* parent = 0); ~ImportResourcePackDialog(); + InstanceProxyModel* proxyModel; QString selectedInstanceKey; private: diff --git a/launcher/ui/dialogs/ImportResourcePackDialog.ui b/launcher/ui/dialogs/ImportResourcePackDialog.ui index 2a1de0f9..20cb9177 100644 --- a/launcher/ui/dialogs/ImportResourcePackDialog.ui +++ b/launcher/ui/dialogs/ImportResourcePackDialog.ui @@ -11,9 +11,16 @@ - Pick icon + Choose instance to import + + + + Choose the instance you would like to import this resource pack to. + + +