Merge pull request #696 from Ryex/import-all-the-things
Fixes https://github.com/PrismLauncher/PrismLauncher/issues/581 Fixes https://github.com/PrismLauncher/PrismLauncher/issues/700
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#include "ImportResourcePackDialog.h"
|
||||
#include "ui_ImportResourcePackDialog.h"
|
||||
#include "ImportResourceDialog.h"
|
||||
#include "ui_ImportResourceDialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPushButton>
|
||||
@ -8,10 +8,11 @@
|
||||
#include "InstanceList.h"
|
||||
|
||||
#include <InstanceList.h>
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
#include "ui/instanceview/InstanceDelegate.h"
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
|
||||
ImportResourcePackDialog::ImportResourcePackDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ImportResourcePackDialog)
|
||||
ImportResourceDialog::ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent)
|
||||
: QDialog(parent), ui(new Ui::ImportResourceDialog), m_resource_type(type), m_file_path(file_path)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowModality(Qt::WindowModal);
|
||||
@ -40,15 +41,19 @@ ImportResourcePackDialog::ImportResourcePackDialog(QWidget* parent) : QDialog(pa
|
||||
connect(contentsWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex)));
|
||||
connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
||||
SLOT(selectionChanged(QItemSelection, QItemSelection)));
|
||||
|
||||
ui->label->setText(
|
||||
tr("Choose the instance you would like to import this %1 to.").arg(ResourceUtils::getPackedTypeName(m_resource_type)));
|
||||
ui->label_file_path->setText(tr("File: %1").arg(m_file_path));
|
||||
}
|
||||
|
||||
void ImportResourcePackDialog::activated(QModelIndex index)
|
||||
void ImportResourceDialog::activated(QModelIndex index)
|
||||
{
|
||||
selectedInstanceKey = index.data(InstanceList::InstanceIDRole).toString();
|
||||
accept();
|
||||
}
|
||||
|
||||
void ImportResourcePackDialog::selectionChanged(QItemSelection selected, QItemSelection deselected)
|
||||
void ImportResourceDialog::selectionChanged(QItemSelection selected, QItemSelection deselected)
|
||||
{
|
||||
if (selected.empty())
|
||||
return;
|
||||
@ -59,7 +64,7 @@ void ImportResourcePackDialog::selectionChanged(QItemSelection selected, QItemSe
|
||||
}
|
||||
}
|
||||
|
||||
ImportResourcePackDialog::~ImportResourcePackDialog()
|
||||
ImportResourceDialog::~ImportResourceDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
30
launcher/ui/dialogs/ImportResourceDialog.h
Normal file
30
launcher/ui/dialogs/ImportResourceDialog.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QItemSelection>
|
||||
|
||||
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
|
||||
namespace Ui {
|
||||
class ImportResourceDialog;
|
||||
}
|
||||
|
||||
class ImportResourceDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent = nullptr);
|
||||
~ImportResourceDialog() override;
|
||||
QString selectedInstanceKey;
|
||||
|
||||
private:
|
||||
Ui::ImportResourceDialog* ui;
|
||||
PackedResourceType m_resource_type;
|
||||
QString m_file_path;
|
||||
InstanceProxyModel* proxyModel;
|
||||
|
||||
private slots:
|
||||
void selectionChanged(QItemSelection, QItemSelection);
|
||||
void activated(QModelIndex);
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ImportResourcePackDialog</class>
|
||||
<widget class="QDialog" name="ImportResourcePackDialog">
|
||||
<class>ImportResourceDialog</class>
|
||||
<widget class="QDialog" name="ImportResourceDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Choose instance to import</string>
|
||||
<string>Choose instance to import to</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -21,6 +21,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_file_path">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="instanceView"/>
|
||||
</item>
|
||||
@ -41,7 +48,7 @@
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ImportResourcePackDialog</receiver>
|
||||
<receiver>ImportResourceDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
@ -57,7 +64,7 @@
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ImportResourcePackDialog</receiver>
|
||||
<receiver>ImportResourceDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QItemSelection>
|
||||
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
|
||||
namespace Ui {
|
||||
class ImportResourcePackDialog;
|
||||
}
|
||||
|
||||
class ImportResourcePackDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImportResourcePackDialog(QWidget* parent = 0);
|
||||
~ImportResourcePackDialog();
|
||||
InstanceProxyModel* proxyModel;
|
||||
QString selectedInstanceKey;
|
||||
|
||||
private:
|
||||
Ui::ImportResourcePackDialog* ui;
|
||||
|
||||
private slots:
|
||||
void selectionChanged(QItemSelection, QItemSelection);
|
||||
void activated(QModelIndex);
|
||||
};
|
Reference in New Issue
Block a user