From 03b75bf2a98edd4114be4799f974bb10fe9b82c4 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 30 Dec 2022 18:06:17 -0700
Subject: feat: Import all the things!
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.../minecraft/mod/tasks/LocalDataPackParseTask.cpp | 4 ++--
launcher/minecraft/mod/tasks/LocalResourceParse.cpp | 21 +++++++++++++++++++++
launcher/minecraft/mod/tasks/LocalResourceParse.h | 6 ++++++
3 files changed, 29 insertions(+), 2 deletions(-)
(limited to 'launcher/minecraft')
diff --git a/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp
index 3fcb2110..5bb44877 100644
--- a/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp
+++ b/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp
@@ -50,7 +50,7 @@ bool processFolder(DataPack& pack, ProcessingLevel level)
Q_ASSERT(pack.type() == ResourceType::FOLDER);
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
};
@@ -95,7 +95,7 @@ bool processZIP(DataPack& pack, ProcessingLevel level)
QuaZipFile file(&zip);
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
};
diff --git a/launcher/minecraft/mod/tasks/LocalResourceParse.cpp b/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
index 19ddc899..63833832 100644
--- a/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
+++ b/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
@@ -19,6 +19,8 @@
* along with this program. If not, see .
*/
+#include
+
#include "LocalResourceParse.h"
#include "LocalDataPackParseTask.h"
@@ -28,6 +30,17 @@
#include "LocalTexturePackParseTask.h"
#include "LocalWorldSaveParseTask.h"
+
+static const QMap 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 {
PackedResourceType identify(QFileInfo file){
if (file.exists() && file.isFile()) {
@@ -57,4 +70,12 @@ PackedResourceType identify(QFileInfo file){
}
return PackedResourceType::UNKNOWN;
}
+
+QString getPackedTypeName(PackedResourceType type) {
+ return s_packed_type_names.constFind(type).value();
}
+
+}
+
+
+
diff --git a/launcher/minecraft/mod/tasks/LocalResourceParse.h b/launcher/minecraft/mod/tasks/LocalResourceParse.h
index b07a874c..7385d24b 100644
--- a/launcher/minecraft/mod/tasks/LocalResourceParse.h
+++ b/launcher/minecraft/mod/tasks/LocalResourceParse.h
@@ -21,11 +21,17 @@
#pragma once
+#include
+
#include
#include
#include
enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN };
namespace ResourceUtils {
+static const std::set ValidResourceTypes = { PackedResourceType::DataPack, PackedResourceType::ResourcePack,
+ PackedResourceType::TexturePack, PackedResourceType::ShaderPack,
+ PackedResourceType::WorldSave, PackedResourceType::Mod };
PackedResourceType identify(QFileInfo file);
+QString getPackedTypeName(PackedResourceType type);
} // namespace ResourceUtils
--
cgit
From 574af2c795a19246c18e5f07a49d6d41f5670a6e Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Mon, 9 Jan 2023 17:12:28 -0700
Subject: chore: cleanup review suggestions
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
launcher/minecraft/mod/tasks/LocalResourceParse.cpp | 3 ---
launcher/ui/dialogs/ImportResourceDialog.h | 10 +++++-----
2 files changed, 5 insertions(+), 8 deletions(-)
(limited to 'launcher/minecraft')
diff --git a/launcher/minecraft/mod/tasks/LocalResourceParse.cpp b/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
index 63833832..4d760df2 100644
--- a/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
+++ b/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
@@ -76,6 +76,3 @@ QString getPackedTypeName(PackedResourceType type) {
}
}
-
-
-
diff --git a/launcher/ui/dialogs/ImportResourceDialog.h b/launcher/ui/dialogs/ImportResourceDialog.h
index c9e3f956..5f2f7a92 100644
--- a/launcher/ui/dialogs/ImportResourceDialog.h
+++ b/launcher/ui/dialogs/ImportResourceDialog.h
@@ -3,8 +3,8 @@
#include
#include
-#include "ui/instanceview/InstanceProxyModel.h"
#include "minecraft/mod/tasks/LocalResourceParse.h"
+#include "ui/instanceview/InstanceProxyModel.h"
namespace Ui {
class ImportResourceDialog;
@@ -14,15 +14,15 @@ class ImportResourceDialog : public QDialog {
Q_OBJECT
public:
- explicit ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent = 0);
- ~ImportResourceDialog();
- InstanceProxyModel* proxyModel;
+ 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);
--
cgit