aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp16
-rw-r--r--launcher/Application.h1
-rw-r--r--launcher/CMakeLists.txt16
-rw-r--r--launcher/InstanceImportTask.cpp250
-rw-r--r--launcher/InstanceImportTask.h51
-rw-r--r--launcher/InstanceList.cpp11
-rw-r--r--launcher/LaunchController.cpp2
-rw-r--r--launcher/MMCZip.cpp28
-rw-r--r--launcher/UpdateController.cpp14
-rw-r--r--launcher/icons/IconList.cpp24
-rw-r--r--launcher/main.cpp2
-rw-r--r--launcher/minecraft/AssetsUtils.cpp42
-rw-r--r--launcher/minecraft/GradleSpecifier.h2
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp13
-rw-r--r--launcher/minecraft/VersionFile.cpp3
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp6
-rw-r--r--launcher/minecraft/mod/LocalModParseTask.cpp54
-rw-r--r--launcher/modplatform/flame/FileResolvingTask.cpp50
-rw-r--r--launcher/modplatform/flame/FlameAPI.h32
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp59
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.cpp52
-rw-r--r--launcher/modplatform/flame/PackManifest.cpp96
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h40
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp17
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.h17
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.cpp156
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.h107
-rw-r--r--launcher/modplatform/technic/SolderPackManifest.cpp2
-rw-r--r--launcher/net/ByteArraySink.h95
-rw-r--r--launcher/net/ChecksumValidator.h83
-rw-r--r--launcher/net/Download.cpp234
-rw-r--r--launcher/net/Download.h101
-rw-r--r--launcher/net/FileSink.cpp122
-rw-r--r--launcher/net/FileSink.h77
-rw-r--r--launcher/net/HttpMetaCache.cpp224
-rw-r--r--launcher/net/HttpMetaCache.h148
-rw-r--r--launcher/net/MetaCacheSink.cpp57
-rw-r--r--launcher/net/MetaCacheSink.h62
-rw-r--r--launcher/net/Mode.h9
-rw-r--r--launcher/net/NetAction.h134
-rw-r--r--launcher/net/NetJob.cpp274
-rw-r--r--launcher/net/NetJob.h110
-rw-r--r--launcher/net/PasteUpload.cpp34
-rw-r--r--launcher/net/PasteUpload.h35
-rw-r--r--launcher/net/Sink.h102
-rw-r--r--launcher/net/Validator.h34
-rw-r--r--launcher/resources/multimc/128x128/instances/modrinth.pngbin10575 -> 0 bytes
-rw-r--r--launcher/resources/multimc/32x32/instances/modrinth.pngbin1913 -> 0 bytes
-rw-r--r--launcher/resources/multimc/multimc.qrc6
-rw-r--r--launcher/resources/multimc/scalable/instances/modrinth.svg4
-rw-r--r--launcher/screenshots/ImgurAlbumCreation.cpp60
-rw-r--r--launcher/screenshots/ImgurAlbumCreation.h49
-rw-r--r--launcher/screenshots/ImgurUpload.cpp60
-rw-r--r--launcher/screenshots/ImgurUpload.h39
-rw-r--r--launcher/tasks/Task.cpp42
-rw-r--r--launcher/tasks/Task.h55
-rw-r--r--launcher/translations/TranslationsModel.cpp37
-rw-r--r--launcher/ui/MainWindow.cpp51
-rw-r--r--launcher/ui/dialogs/ExportInstanceDialog.cpp8
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.cpp4
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.h4
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.cpp2
-rw-r--r--launcher/ui/dialogs/SkinUploadDialog.cpp3
-rw-r--r--launcher/ui/pages/global/APIPage.cpp4
-rw-r--r--launcher/ui/pages/global/APIPage.ui64
-rw-r--r--launcher/ui/pages/global/ExternalToolsPage.cpp2
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp19
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.ui29
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp27
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.h1
-rw-r--r--launcher/ui/pages/modplatform/ImportPage.cpp11
-rw-r--r--launcher/ui/pages/modplatform/ImportPage.ui78
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp49
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModModel.cpp4
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModel.cpp129
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp71
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.ui192
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModModel.cpp43
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModModel.h43
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModPage.cpp82
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModPage.h61
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp291
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.h123
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp241
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.h60
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.ui115
86 files changed, 3755 insertions, 1506 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 11109857..ce62c41a 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -223,9 +223,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
setApplicationName(BuildConfig.LAUNCHER_NAME);
setApplicationDisplayName(BuildConfig.LAUNCHER_DISPLAYNAME);
setApplicationVersion(BuildConfig.printableVersionString());
- #if (QT_VERSION >= QT_VERSION_CHECK(5,7,0))
- setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME);
- #endif
+ setDesktopFileName(BuildConfig.LAUNCHER_DESKTOPFILENAME);
startTime = QDateTime::currentDateTime();
// Don't quit on hiding the last window
@@ -681,6 +679,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Custom MSA credentials
m_settings->registerSetting("MSAClientIDOverride", "");
+ m_settings->registerSetting("CFKeyOverride", "");
// Init page provider
{
@@ -819,6 +818,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_metacache->addBase("ModpacksCHPacks", QDir("cache/ModpacksCHPacks").absolutePath());
m_metacache->addBase("TechnicPacks", QDir("cache/TechnicPacks").absolutePath());
m_metacache->addBase("FlamePacks", QDir("cache/FlamePacks").absolutePath());
+ m_metacache->addBase("ModrinthPacks", QDir("cache/ModrinthPacks").absolutePath());
m_metacache->addBase("root", QDir::currentPath());
m_metacache->addBase("translations", QDir("translations").absolutePath());
m_metacache->addBase("icons", QDir("cache/icons").absolutePath());
@@ -1509,3 +1509,13 @@ QString Application::getMSAClientID()
return BuildConfig.MSA_CLIENT_ID;
}
+
+QString Application::getCurseKey()
+{
+ QString keyOverride = m_settings->get("CFKeyOverride").toString();
+ if (!keyOverride.isEmpty()) {
+ return keyOverride;
+ }
+
+ return BuildConfig.CURSEFORGE_API_KEY;
+}
diff --git a/launcher/Application.h b/launcher/Application.h
index 172321c0..3129b4fb 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -155,6 +155,7 @@ public:
QString getJarsPath();
QString getMSAClientID();
+ QString getCurseKey();
/// this is the root of the 'installation'. Used for automatic updates
const QString &root() {
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index b79f03c8..8e75be20 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -532,6 +532,8 @@ set(FLAME_SOURCES
set(MODRINTH_SOURCES
modplatform/modrinth/ModrinthPackIndex.cpp
modplatform/modrinth/ModrinthPackIndex.h
+ modplatform/modrinth/ModrinthPackManifest.cpp
+ modplatform/modrinth/ModrinthPackManifest.h
)
set(MODPACKSCH_SOURCES
@@ -774,6 +776,11 @@ SET(LAUNCHER_SOURCES
ui/pages/modplatform/flame/FlameModPage.cpp
ui/pages/modplatform/flame/FlameModPage.h
+ ui/pages/modplatform/modrinth/ModrinthPage.cpp
+ ui/pages/modplatform/modrinth/ModrinthPage.h
+ ui/pages/modplatform/modrinth/ModrinthModel.cpp
+ ui/pages/modplatform/modrinth/ModrinthModel.h
+
ui/pages/modplatform/technic/TechnicModel.cpp
ui/pages/modplatform/technic/TechnicModel.h
ui/pages/modplatform/technic/TechnicPage.cpp
@@ -782,10 +789,10 @@ SET(LAUNCHER_SOURCES
ui/pages/modplatform/ImportPage.cpp
ui/pages/modplatform/ImportPage.h
- ui/pages/modplatform/modrinth/ModrinthModel.cpp
- ui/pages/modplatform/modrinth/ModrinthModel.h
- ui/pages/modplatform/modrinth/ModrinthPage.cpp
- ui/pages/modplatform/modrinth/ModrinthPage.h
+ ui/pages/modplatform/modrinth/ModrinthModModel.cpp
+ ui/pages/modplatform/modrinth/ModrinthModModel.h
+ ui/pages/modplatform/modrinth/ModrinthModPage.cpp
+ ui/pages/modplatform/modrinth/ModrinthModPage.h
# GUI - dialogs
ui/dialogs/AboutDialog.cpp
@@ -908,6 +915,7 @@ qt5_wrap_ui(LAUNCHER_UI
ui/pages/modplatform/legacy_ftb/Page.ui
ui/pages/modplatform/ImportPage.ui
ui/pages/modplatform/ftb/FtbPage.ui
+ ui/pages/modplatform/modrinth/ModrinthPage.ui
ui/pages/modplatform/technic/TechnicPage.ui
ui/widgets/InstanceCardWidget.ui
ui/widgets/CustomCommands.ui
diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp
index 1a13c997..4bad7251 100644
--- a/launcher/InstanceImportTask.cpp
+++ b/launcher/InstanceImportTask.cpp
@@ -1,43 +1,73 @@
-/* Copyright 2013-2021 MultiMC Contributors
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PolyMC - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include "InstanceImportTask.h"
+#include <QtConcurrentRun>
+#include "Application.h"
#include "BaseInstance.h"
#include "FileSystem.h"
-#include "Application.h"
#include "MMCZip.h"
#include "NullInstance.h"
-#include "settings/INISettingsObject.h"
+#include "icons/IconList.h"
#include "icons/IconUtils.h"
-#include <QtConcurrentRun>
+#include "settings/INISettingsObject.h"
// FIXME: this does not belong here, it's Minecraft/Flame specific
+#include <quazip/quazipdir.h>
+#include "Json.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "modplatform/flame/FileResolvingTask.h"
#include "modplatform/flame/PackManifest.h"
-#include "Json.h"
-#include <quazip/quazipdir.h>
+#include "modplatform/modrinth/ModrinthPackManifest.h"
#include "modplatform/technic/TechnicPackProcessor.h"
-#include "icons/IconList.h"
#include "Application.h"
+#include "icons/IconList.h"
+#include "net/ChecksumValidator.h"
+
+#include "ui/dialogs/CustomMessageBox.h"
+
+#include <algorithm>
+#include <iterator>
-InstanceImportTask::InstanceImportTask(const QUrl sourceUrl)
+InstanceImportTask::InstanceImportTask(const QUrl sourceUrl, QWidget* parent)
{
m_sourceUrl = sourceUrl;
+ m_parent = parent;
}
bool InstanceImportTask::abort()
@@ -109,6 +139,7 @@ void InstanceImportTask::processZipPack()
QString mmcFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "instance.cfg");
bool technicFound = QuaZipDir(m_packZip.get()).exists("/bin/modpack.jar") || QuaZipDir(m_packZip.get()).exists("/bin/version.json");
QString flameFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "manifest.json");
+ QString modrinthFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "modrinth.index.json");
QString root;
if(!mmcFound.isNull())
{
@@ -132,6 +163,13 @@ void InstanceImportTask::processZipPack()
root = flameFound;
m_modpackType = ModpackType::Flame;
}
+ else if(!modrinthFound.isNull())
+ {
+ // process as Modrinth pack
+ qDebug() << "Modrinth:" << modrinthFound;
+ root = modrinthFound;
+ m_modpackType = ModpackType::Modrinth;
+ }
if(m_modpackType == ModpackType::Unknown)
{
emitFailed(tr("Archive does not contain a recognized modpack type."));
@@ -188,15 +226,18 @@ void InstanceImportTask::extractFinished()
switch(m_modpackType)
{
- case ModpackType::Flame:
- processFlame();
- return;
case ModpackType::MultiMC:
processMultiMC();
return;
case ModpackType::Technic:
processTechnic();
return;
+ case ModpackType::Flame:
+ processFlame();
+ return;
+ case ModpackType::Modrinth:
+ processModrinth();
+ return;
case ModpackType::Unknown:
emitFailed(tr("Archive does not contain a recognized modpack type."));
return;
@@ -439,25 +480,174 @@ void InstanceImportTask::processMultiMC()
instance.setName(m_instName);
// if the icon was specified by user, use that. otherwise pull icon from the pack
- if (m_instIcon != "default")
- {
+ if (m_instIcon != "default") {
instance.setIconKey(m_instIcon);
- }
- else
- {
+ } else {
m_instIcon = instance.iconKey();
auto importIconPath = IconUtils::findBestIconIn(instance.instanceRoot(), m_instIcon);
- if (!importIconPath.isNull() && QFile::exists(importIconPath))
- {
+ if (!importIconPath.isNull() && QFile::exists(importIconPath)) {
// import icon
auto iconList = APPLICATION->icons();
- if (iconList->iconFileExists(m_instIcon))
- {
+ if (iconList->iconFileExists(m_instIcon)) {
iconList->deleteIcon(m_instIcon);
}
- iconList->installIcons({importIconPath});
+ iconList->installIcons({ importIc