feat: Import all the things!
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
f3f628410d
commit
03b75bf2a9
@ -259,9 +259,18 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
m_serverToJoin = parser.value("server");
|
m_serverToJoin = parser.value("server");
|
||||||
m_profileToUse = parser.value("profile");
|
m_profileToUse = parser.value("profile");
|
||||||
m_liveCheck = parser.isSet("alive");
|
m_liveCheck = parser.isSet("alive");
|
||||||
m_zipToImport = parser.value("import");
|
|
||||||
m_instanceIdToShowWindowOf = parser.value("show");
|
m_instanceIdToShowWindowOf = parser.value("show");
|
||||||
|
|
||||||
|
for (auto zip_path : parser.values("import")){
|
||||||
|
m_zipsToImport.append(QUrl(zip_path));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto zip_path : parser.positionalArguments()){ // treat unspesified positional arguments as import urls
|
||||||
|
m_zipsToImport.append(QUrl(zip_path));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// error if --launch is missing with --server or --profile
|
// error if --launch is missing with --server or --profile
|
||||||
if((!m_serverToJoin.isEmpty() || !m_profileToUse.isEmpty()) && m_instanceIdToLaunch.isEmpty())
|
if((!m_serverToJoin.isEmpty() || !m_profileToUse.isEmpty()) && m_instanceIdToLaunch.isEmpty())
|
||||||
{
|
{
|
||||||
@ -345,7 +354,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Establish the mechanism for communication with an already running PolyMC that uses the same data path.
|
* Establish the mechanism for communication with an already running PrismLauncher that uses the same data path.
|
||||||
* If there is one, tell it what the user actually wanted to do and exit.
|
* If there is one, tell it what the user actually wanted to do and exit.
|
||||||
* We want to initialize this before logging to avoid messing with the log of a potential already running copy.
|
* We want to initialize this before logging to avoid messing with the log of a potential already running copy.
|
||||||
*/
|
*/
|
||||||
@ -363,12 +372,14 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
activate.command = "activate";
|
activate.command = "activate";
|
||||||
m_peerInstance->sendMessage(activate.serialize(), timeout);
|
m_peerInstance->sendMessage(activate.serialize(), timeout);
|
||||||
|
|
||||||
if(!m_zipToImport.isEmpty())
|
if(!m_zipsToImport.isEmpty())
|
||||||
{
|
{
|
||||||
ApplicationMessage import;
|
for (auto zip_url : m_zipsToImport) {
|
||||||
import.command = "import";
|
ApplicationMessage import;
|
||||||
import.args.insert("path", m_zipToImport.toString());
|
import.command = "import";
|
||||||
m_peerInstance->sendMessage(import.serialize(), timeout);
|
import.args.insert("path", zip_url.toString());
|
||||||
|
m_peerInstance->sendMessage(import.serialize(), timeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -938,7 +949,7 @@ bool Application::event(QEvent* event)
|
|||||||
|
|
||||||
if (event->type() == QEvent::FileOpen) {
|
if (event->type() == QEvent::FileOpen) {
|
||||||
auto ev = static_cast<QFileOpenEvent*>(event);
|
auto ev = static_cast<QFileOpenEvent*>(event);
|
||||||
m_mainWindow->droppedURLs({ ev->url() });
|
m_mainWindow->processURLs({ ev->url() });
|
||||||
}
|
}
|
||||||
|
|
||||||
return QApplication::event(event);
|
return QApplication::event(event);
|
||||||
@ -998,10 +1009,10 @@ void Application::performMainStartupAction()
|
|||||||
showMainWindow(false);
|
showMainWindow(false);
|
||||||
qDebug() << "<> Main window shown.";
|
qDebug() << "<> Main window shown.";
|
||||||
}
|
}
|
||||||
if(!m_zipToImport.isEmpty())
|
if(!m_zipsToImport.isEmpty())
|
||||||
{
|
{
|
||||||
qDebug() << "<> Importing instance from zip:" << m_zipToImport;
|
qDebug() << "<> Importing from zip:" << m_zipsToImport;
|
||||||
m_mainWindow->droppedURLs({ m_zipToImport });
|
m_mainWindow->processURLs( m_zipsToImport );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,7 +1065,7 @@ void Application::messageReceived(const QByteArray& message)
|
|||||||
qWarning() << "Received" << command << "message without a zip path/URL.";
|
qWarning() << "Received" << command << "message without a zip path/URL.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_mainWindow->droppedURLs({ QUrl(path) });
|
m_mainWindow->processURLs({ QUrl(path) });
|
||||||
}
|
}
|
||||||
else if(command == "launch")
|
else if(command == "launch")
|
||||||
{
|
{
|
||||||
|
@ -303,7 +303,7 @@ public:
|
|||||||
QString m_serverToJoin;
|
QString m_serverToJoin;
|
||||||
QString m_profileToUse;
|
QString m_profileToUse;
|
||||||
bool m_liveCheck = false;
|
bool m_liveCheck = false;
|
||||||
QUrl m_zipToImport;
|
QList<QUrl> m_zipsToImport;
|
||||||
QString m_instanceIdToShowWindowOf;
|
QString m_instanceIdToShowWindowOf;
|
||||||
std::unique_ptr<QFile> logFile;
|
std::unique_ptr<QFile> logFile;
|
||||||
};
|
};
|
||||||
|
@ -841,8 +841,8 @@ SET(LAUNCHER_SOURCES
|
|||||||
ui/dialogs/ExportInstanceDialog.h
|
ui/dialogs/ExportInstanceDialog.h
|
||||||
ui/dialogs/IconPickerDialog.cpp
|
ui/dialogs/IconPickerDialog.cpp
|
||||||
ui/dialogs/IconPickerDialog.h
|
ui/dialogs/IconPickerDialog.h
|
||||||
ui/dialogs/ImportResourcePackDialog.cpp
|
ui/dialogs/ImportResourceDialog.cpp
|
||||||
ui/dialogs/ImportResourcePackDialog.h
|
ui/dialogs/ImportResourceDialog.h
|
||||||
ui/dialogs/LoginDialog.cpp
|
ui/dialogs/LoginDialog.cpp
|
||||||
ui/dialogs/LoginDialog.h
|
ui/dialogs/LoginDialog.h
|
||||||
ui/dialogs/MSALoginDialog.cpp
|
ui/dialogs/MSALoginDialog.cpp
|
||||||
@ -992,7 +992,7 @@ qt_wrap_ui(LAUNCHER_UI
|
|||||||
ui/dialogs/SkinUploadDialog.ui
|
ui/dialogs/SkinUploadDialog.ui
|
||||||
ui/dialogs/ExportInstanceDialog.ui
|
ui/dialogs/ExportInstanceDialog.ui
|
||||||
ui/dialogs/IconPickerDialog.ui
|
ui/dialogs/IconPickerDialog.ui
|
||||||
ui/dialogs/ImportResourcePackDialog.ui
|
ui/dialogs/ImportResourceDialog.ui
|
||||||
ui/dialogs/MSALoginDialog.ui
|
ui/dialogs/MSALoginDialog.ui
|
||||||
ui/dialogs/OfflineLoginDialog.ui
|
ui/dialogs/OfflineLoginDialog.ui
|
||||||
ui/dialogs/AboutDialog.ui
|
ui/dialogs/AboutDialog.ui
|
||||||
|
@ -50,7 +50,7 @@ bool processFolder(DataPack& pack, ProcessingLevel level)
|
|||||||
Q_ASSERT(pack.type() == ResourceType::FOLDER);
|
Q_ASSERT(pack.type() == ResourceType::FOLDER);
|
||||||
|
|
||||||
auto mcmeta_invalid = [&pack]() {
|
auto mcmeta_invalid = [&pack]() {
|
||||||
qWarning() << "Resource pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
qWarning() << "Data pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
||||||
return false; // the mcmeta is not optional
|
return false; // the mcmeta is not optional
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ bool processZIP(DataPack& pack, ProcessingLevel level)
|
|||||||
QuaZipFile file(&zip);
|
QuaZipFile file(&zip);
|
||||||
|
|
||||||
auto mcmeta_invalid = [&pack]() {
|
auto mcmeta_invalid = [&pack]() {
|
||||||
qWarning() << "Resource pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
qWarning() << "Data pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
|
||||||
return false; // the mcmeta is not optional
|
return false; // the mcmeta is not optional
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
#include "LocalResourceParse.h"
|
#include "LocalResourceParse.h"
|
||||||
|
|
||||||
#include "LocalDataPackParseTask.h"
|
#include "LocalDataPackParseTask.h"
|
||||||
@ -28,6 +30,17 @@
|
|||||||
#include "LocalTexturePackParseTask.h"
|
#include "LocalTexturePackParseTask.h"
|
||||||
#include "LocalWorldSaveParseTask.h"
|
#include "LocalWorldSaveParseTask.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const QMap<PackedResourceType, QString> s_packed_type_names = {
|
||||||
|
{PackedResourceType::ResourcePack, QObject::tr("resource pack")},
|
||||||
|
{PackedResourceType::TexturePack, QObject::tr("texture pack")},
|
||||||
|
{PackedResourceType::DataPack, QObject::tr("data pack")},
|
||||||
|
{PackedResourceType::ShaderPack, QObject::tr("shader pack")},
|
||||||
|
{PackedResourceType::WorldSave, QObject::tr("world save")},
|
||||||
|
{PackedResourceType::Mod , QObject::tr("mod")},
|
||||||
|
{PackedResourceType::UNKNOWN, QObject::tr("unknown")}
|
||||||
|
};
|
||||||
|
|
||||||
namespace ResourceUtils {
|
namespace ResourceUtils {
|
||||||
PackedResourceType identify(QFileInfo file){
|
PackedResourceType identify(QFileInfo file){
|
||||||
if (file.exists() && file.isFile()) {
|
if (file.exists() && file.isFile()) {
|
||||||
@ -57,4 +70,12 @@ PackedResourceType identify(QFileInfo file){
|
|||||||
}
|
}
|
||||||
return PackedResourceType::UNKNOWN;
|
return PackedResourceType::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getPackedTypeName(PackedResourceType type) {
|
||||||
|
return s_packed_type_names.constFind(type).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,11 +21,17 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN };
|
enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN };
|
||||||
namespace ResourceUtils {
|
namespace ResourceUtils {
|
||||||
|
static const std::set<PackedResourceType> ValidResourceTypes = { PackedResourceType::DataPack, PackedResourceType::ResourcePack,
|
||||||
|
PackedResourceType::TexturePack, PackedResourceType::ShaderPack,
|
||||||
|
PackedResourceType::WorldSave, PackedResourceType::Mod };
|
||||||
PackedResourceType identify(QFileInfo file);
|
PackedResourceType identify(QFileInfo file);
|
||||||
|
QString getPackedTypeName(PackedResourceType type);
|
||||||
} // namespace ResourceUtils
|
} // namespace ResourceUtils
|
||||||
|
@ -109,13 +109,12 @@
|
|||||||
#include "ui/dialogs/UpdateDialog.h"
|
#include "ui/dialogs/UpdateDialog.h"
|
||||||
#include "ui/dialogs/EditAccountDialog.h"
|
#include "ui/dialogs/EditAccountDialog.h"
|
||||||
#include "ui/dialogs/ExportInstanceDialog.h"
|
#include "ui/dialogs/ExportInstanceDialog.h"
|
||||||
#include "ui/dialogs/ImportResourcePackDialog.h"
|
#include "ui/dialogs/ImportResourceDialog.h"
|
||||||
#include "ui/themes/ITheme.h"
|
#include "ui/themes/ITheme.h"
|
||||||
|
|
||||||
#include <minecraft/mod/ResourcePackFolderModel.h>
|
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||||
#include <minecraft/mod/tasks/LocalResourcePackParseTask.h>
|
#include "minecraft/mod/ModFolderModel.h"
|
||||||
#include <minecraft/mod/TexturePackFolderModel.h>
|
#include "minecraft/WorldList.h"
|
||||||
#include <minecraft/mod/tasks/LocalTexturePackParseTask.h>
|
|
||||||
|
|
||||||
#include "UpdateController.h"
|
#include "UpdateController.h"
|
||||||
#include "KonamiCode.h"
|
#include "KonamiCode.h"
|
||||||
@ -954,7 +953,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
|||||||
view->installEventFilter(this);
|
view->installEventFilter(this);
|
||||||
view->setContextMenuPolicy(Qt::CustomContextMenu);
|
view->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(view, &QWidget::customContextMenuRequested, this, &MainWindow::showInstanceContextMenu);
|
connect(view, &QWidget::customContextMenuRequested, this, &MainWindow::showInstanceContextMenu);
|
||||||
connect(view, &InstanceView::droppedURLs, this, &MainWindow::droppedURLs, Qt::QueuedConnection);
|
connect(view, &InstanceView::droppedURLs, this, &MainWindow::processURLs, Qt::QueuedConnection);
|
||||||
|
|
||||||
proxymodel = new InstanceProxyModel(this);
|
proxymodel = new InstanceProxyModel(this);
|
||||||
proxymodel->setSourceModel(APPLICATION->instances().get());
|
proxymodel->setSourceModel(APPLICATION->instances().get());
|
||||||
@ -1813,10 +1812,12 @@ void MainWindow::on_actionAddInstance_triggered()
|
|||||||
addInstance();
|
addInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::droppedURLs(QList<QUrl> urls)
|
void MainWindow::processURLs(QList<QUrl> urls)
|
||||||
{
|
{
|
||||||
// NOTE: This loop only processes one dropped file!
|
// NOTE: This loop only processes one dropped file!
|
||||||
for (auto& url : urls) {
|
for (auto& url : urls) {
|
||||||
|
qDebug() << "Processing :" << url;
|
||||||
|
|
||||||
// The isLocalFile() check below doesn't work as intended without an explicit scheme.
|
// The isLocalFile() check below doesn't work as intended without an explicit scheme.
|
||||||
if (url.scheme().isEmpty())
|
if (url.scheme().isEmpty())
|
||||||
url.setScheme("file");
|
url.setScheme("file");
|
||||||
@ -1829,28 +1830,49 @@ void MainWindow::droppedURLs(QList<QUrl> urls)
|
|||||||
auto localFileName = url.toLocalFile();
|
auto localFileName = url.toLocalFile();
|
||||||
QFileInfo localFileInfo(localFileName);
|
QFileInfo localFileInfo(localFileName);
|
||||||
|
|
||||||
bool isResourcePack = ResourcePackUtils::validate(localFileInfo);
|
auto type = ResourceUtils::identify(localFileInfo);
|
||||||
bool isTexturePack = TexturePackUtils::validate(localFileInfo);
|
|
||||||
|
|
||||||
if (!isResourcePack && !isTexturePack) { // probably instance/modpack
|
// bool is_resource = type;
|
||||||
|
|
||||||
|
if (!(ResourceUtils::ValidResourceTypes.count(type) > 0)) { // probably instance/modpack
|
||||||
addInstance(localFileName);
|
addInstance(localFileName);
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportResourcePackDialog dlg(this);
|
ImportResourceDialog dlg(localFileName, type, this);
|
||||||
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
qDebug() << "Adding resource/texture pack" << localFileName << "to" << dlg.selectedInstanceKey;
|
qDebug() << "Adding resource" << localFileName << "to" << dlg.selectedInstanceKey;
|
||||||
|
|
||||||
auto inst = APPLICATION->instances()->getInstanceById(dlg.selectedInstanceKey);
|
auto inst = APPLICATION->instances()->getInstanceById(dlg.selectedInstanceKey);
|
||||||
auto minecraftInst = std::dynamic_pointer_cast<MinecraftInstance>(inst);
|
auto minecraftInst = std::dynamic_pointer_cast<MinecraftInstance>(inst);
|
||||||
if (isResourcePack)
|
|
||||||
|
switch (type) {
|
||||||
|
case PackedResourceType::ResourcePack:
|
||||||
minecraftInst->resourcePackList()->installResource(localFileName);
|
minecraftInst->resourcePackList()->installResource(localFileName);
|
||||||
else if (isTexturePack)
|
break;
|
||||||
|
case PackedResourceType::TexturePack:
|
||||||
minecraftInst->texturePackList()->installResource(localFileName);
|
minecraftInst->texturePackList()->installResource(localFileName);
|
||||||
break;
|
break;
|
||||||
|
case PackedResourceType::DataPack:
|
||||||
|
qWarning() << "Importing of Data Packs not supported at this time. Ignoring" << localFileName;
|
||||||
|
break;
|
||||||
|
case PackedResourceType::Mod:
|
||||||
|
minecraftInst->loaderModList()->installMod(localFileName);
|
||||||
|
break;
|
||||||
|
case PackedResourceType::ShaderPack:
|
||||||
|
minecraftInst->shaderPackList()->installResource(localFileName);
|
||||||
|
break;
|
||||||
|
case PackedResourceType::WorldSave:
|
||||||
|
minecraftInst->worldList()->installWorld(localFileName);
|
||||||
|
break;
|
||||||
|
case PackedResourceType::UNKNOWN:
|
||||||
|
default:
|
||||||
|
qDebug() << "Can't Identify" << localFileName << "Ignoring it.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
void updatesAllowedChanged(bool allowed);
|
void updatesAllowedChanged(bool allowed);
|
||||||
|
|
||||||
void droppedURLs(QList<QUrl> urls);
|
void processURLs(QList<QUrl> urls);
|
||||||
signals:
|
signals:
|
||||||
void isClosing();
|
void isClosing();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "ImportResourcePackDialog.h"
|
#include "ImportResourceDialog.h"
|
||||||
#include "ui_ImportResourcePackDialog.h"
|
#include "ui_ImportResourceDialog.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -8,10 +8,11 @@
|
|||||||
#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"
|
||||||
|
#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);
|
ui->setupUi(this);
|
||||||
setWindowModality(Qt::WindowModal);
|
setWindowModality(Qt::WindowModal);
|
||||||
@ -40,15 +41,19 @@ ImportResourcePackDialog::ImportResourcePackDialog(QWidget* parent) : QDialog(pa
|
|||||||
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)),
|
||||||
SLOT(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();
|
selectedInstanceKey = index.data(InstanceList::InstanceIDRole).toString();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportResourcePackDialog::selectionChanged(QItemSelection selected, QItemSelection deselected)
|
void ImportResourceDialog::selectionChanged(QItemSelection selected, QItemSelection deselected)
|
||||||
{
|
{
|
||||||
if (selected.empty())
|
if (selected.empty())
|
||||||
return;
|
return;
|
||||||
@ -59,7 +64,7 @@ void ImportResourcePackDialog::selectionChanged(QItemSelection selected, QItemSe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportResourcePackDialog::~ImportResourcePackDialog()
|
ImportResourceDialog::~ImportResourceDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
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 "ui/instanceview/InstanceProxyModel.h"
|
||||||
|
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ImportResourceDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ImportResourceDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent = 0);
|
||||||
|
~ImportResourceDialog();
|
||||||
|
InstanceProxyModel* proxyModel;
|
||||||
|
QString selectedInstanceKey;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ImportResourceDialog* ui;
|
||||||
|
PackedResourceType m_resource_type;
|
||||||
|
QString m_file_path;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void selectionChanged(QItemSelection, QItemSelection);
|
||||||
|
void activated(QModelIndex);
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ImportResourcePackDialog</class>
|
<class>ImportResourceDialog</class>
|
||||||
<widget class="QDialog" name="ImportResourcePackDialog">
|
<widget class="QDialog" name="ImportResourceDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Choose instance to import</string>
|
<string>Choose instance to import to</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -21,6 +21,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_file_path">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListView" name="instanceView"/>
|
<widget class="QListView" name="instanceView"/>
|
||||||
</item>
|
</item>
|
||||||
@ -41,7 +48,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>ImportResourcePackDialog</receiver>
|
<receiver>ImportResourceDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@ -57,7 +64,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>ImportResourcePackDialog</receiver>
|
<receiver>ImportResourceDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<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);
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user