aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/minecraft/mod/tasks/LocalModParseTask.cpp9
-rw-r--r--launcher/settings/INIFile.cpp21
-rw-r--r--launcher/settings/INIFile.h1
-rw-r--r--launcher/ui/MainWindow.cpp14
-rw-r--r--launcher/ui/dialogs/AboutDialog.cpp2
5 files changed, 28 insertions, 19 deletions
diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
index 264019f8..60389753 100644
--- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
+++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
@@ -1,9 +1,9 @@
#include "LocalModParseTask.h"
+#include <qdcss.h>
#include <quazip/quazip.h>
#include <quazip/quazipfile.h>
#include <toml++/toml.h>
-#include <qdcss.h>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
@@ -369,12 +369,11 @@ ModDetails ReadQuiltModInfo(QByteArray contents)
details.icon_file = icon.toString();
}
}
-
}
return details;
}
-ModDetails ReadForgeInfo(QString fileName)
+ModDetails ReadForgeInfo(QByteArray contents)
{
ModDetails details;
// Read the data
@@ -382,7 +381,7 @@ ModDetails ReadForgeInfo(QString fileName)
details.mod_id = "Forge";
details.homeurl = "http://www.minecraftforge.net/forum/";
INIFile ini;
- if (!ini.loadFile(fileName))
+ if (!ini.loadFile(contents))
return details;
QString major = ini.get("forge.major.number", "0").toString();
@@ -554,7 +553,7 @@ bool processZIP(Mod& mod, ProcessingLevel level)
return false;
}
- details = ReadForgeInfo(file.getFileName());
+ details = ReadForgeInfo(file.readAll());
file.close();
zip.close();
diff --git a/launcher/settings/INIFile.cpp b/launcher/settings/INIFile.cpp
index d16256b9..4fb11ed3 100644
--- a/launcher/settings/INIFile.cpp
+++ b/launcher/settings/INIFile.cpp
@@ -37,11 +37,12 @@
#include "settings/INIFile.h"
#include <FileSystem.h>
+#include <QDebug>
#include <QFile>
-#include <QTextStream>
-#include <QStringList>
#include <QSaveFile>
-#include <QDebug>
+#include <QStringList>
+#include <QTemporaryFile>
+#include <QTextStream>
#include <QSettings>
@@ -71,6 +72,7 @@ bool INIFile::saveFile(QString fileName)
return true;
}
+
QString unescape(QString orig)
{
QString out;
@@ -185,6 +187,19 @@ bool INIFile::loadFile(QString fileName)
return true;
}
+bool INIFile::loadFile(QByteArray data)
+{
+ QTemporaryFile file;
+ if (!file.open())
+ return false;
+ file.write(data);
+ file.flush();
+ file.close();
+ auto loaded = loadFile(file.fileName());
+ file.remove();
+ return loaded;
+}
+
QVariant INIFile::get(QString key, QVariant def) const
{
if (!this->contains(key))
diff --git a/launcher/settings/INIFile.h b/launcher/settings/INIFile.h
index 0d5c05eb..4ee543cf 100644
--- a/launcher/settings/INIFile.h
+++ b/launcher/settings/INIFile.h
@@ -50,6 +50,7 @@ public:
explicit INIFile();
bool loadFile(QString fileName);
+ bool loadFile(QByteArray data);
bool saveFile(QString fileName);
QVariant get(QString key, QVariant def) const;
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index da572fc3..e342e833 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -1342,16 +1342,10 @@ void MainWindow::on_actionExportInstanceFlamePack_triggered()
if (m_selectedInstance) {
auto instance = dynamic_cast<MinecraftInstance*>(m_selectedInstance.get());
if (instance) {
- QString errorMsg;
- if (instance->getPackProfile()->getComponent("org.quiltmc.quilt-loader")) {
- errorMsg = tr("Quilt is currently not supported by CurseForge modpacks.");
- } else if (auto cmp = instance->getPackProfile()->getComponent("net.minecraft");
- cmp && cmp->getVersionFile() && cmp->getVersionFile()->type == "snapshot") {
- errorMsg = tr("Snapshots are currently not supported by CurseForge modpacks.");
- }
- if (!errorMsg.isEmpty()) {
- QMessageBox msgBox;
- msgBox.setText(errorMsg);
+ if (auto cmp = instance->getPackProfile()->getComponent("net.minecraft");
+ cmp && cmp->getVersionFile() && cmp->getVersionFile()->type == "snapshot") {
+ QMessageBox msgBox(this);
+ msgBox.setText("Snapshots are currently not supported by CurseForge modpacks.");
msgBox.exec();
return;
}
diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp
index 88739463..b1734eff 100644
--- a/launcher/ui/dialogs/AboutDialog.cpp
+++ b/launcher/ui/dialogs/AboutDialog.cpp
@@ -170,7 +170,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia
QString urlText("<html><head/><body><p><a href=\"%1\">%1</a></p></body></html>");
ui->urlLabel->setText(urlText.arg(BuildConfig.LAUNCHER_GIT));
- QString copyText("© 2022 %1");
+ QString copyText("© 2022-2023 %1");
ui->copyLabel->setText(copyText.arg(BuildConfig.LAUNCHER_COPYRIGHT));
connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));