fix: resource pack import dialog icons and add message

Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
This commit is contained in:
Ryan Cao 2022-11-20 00:14:16 +08:00
parent 1f6b8f9d2b
commit a99cd16422
No known key found for this signature in database
3 changed files with 16 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include "InstanceList.h" #include "InstanceList.h"
#include <InstanceList.h> #include <InstanceList.h>
#include "ui/instanceview/InstanceProxyModel.h"
#include "ui/instanceview/InstanceDelegate.h" #include "ui/instanceview/InstanceDelegate.h"
ImportResourcePackDialog::ImportResourcePackDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ImportResourcePackDialog) 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->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
contentsWidget->setItemDelegate(new ListViewDelegate()); 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, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex)));
connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),

View File

@ -3,6 +3,8 @@
#include <QDialog> #include <QDialog>
#include <QItemSelection> #include <QItemSelection>
#include "ui/instanceview/InstanceProxyModel.h"
namespace Ui { namespace Ui {
class ImportResourcePackDialog; class ImportResourcePackDialog;
} }
@ -13,6 +15,7 @@ class ImportResourcePackDialog : public QDialog {
public: public:
explicit ImportResourcePackDialog(QWidget* parent = 0); explicit ImportResourcePackDialog(QWidget* parent = 0);
~ImportResourcePackDialog(); ~ImportResourcePackDialog();
InstanceProxyModel* proxyModel;
QString selectedInstanceKey; QString selectedInstanceKey;
private: private:

View File

@ -11,9 +11,16 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Pick icon</string> <string>Choose instance to import</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Choose the instance you would like to import this resource pack to.</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QListView" name="instanceView"/> <widget class="QListView" name="instanceView"/>
</item> </item>