aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml14
-rw-r--r--.gitignore8
-rw-r--r--launcher/Application.cpp9
-rw-r--r--launcher/Application.h2
-rw-r--r--launcher/CMakeLists.txt16
-rw-r--r--launcher/LoggedProcess.cpp16
-rw-r--r--launcher/LoggedProcess.h7
-rw-r--r--launcher/MangoHud.cpp23
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp5
-rw-r--r--launcher/modplatform/modpacksch/FTBPackInstallTask.cpp387
-rw-r--r--launcher/modplatform/modpacksch/FTBPackInstallTask.h101
-rw-r--r--launcher/modplatform/modpacksch/FTBPackManifest.cpp195
-rw-r--r--launcher/modplatform/modpacksch/FTBPackManifest.h168
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.cpp37
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.h1
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.cpp2
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp2
-rw-r--r--launcher/ui/pages/global/LauncherPage.ui62
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbFilterModel.cpp93
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbFilterModel.h51
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbListModel.cpp304
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbListModel.h83
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbPage.cpp199
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbPage.h105
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbPage.ui86
-rw-r--r--launcher/ui/themes/ITheme.cpp2
-rw-r--r--launcher/ui/themes/ITheme.h2
-rw-r--r--launcher/ui/themes/SystemTheme.cpp8
-rw-r--r--launcher/ui/themes/SystemTheme.h2
-rw-r--r--launcher/ui/themes/ThemeManager.cpp8
-rw-r--r--launcher/ui/themes/ThemeManager.h4
-rw-r--r--nix/default.nix47
32 files changed, 168 insertions, 1881 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index df1a38fc..02cc8b1f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -68,7 +68,7 @@ jobs:
qt_ver: 6
qt_host: windows
qt_arch: ''
- qt_version: '6.4.3'
+ qt_version: '6.5.0'
qt_modules: 'qt5compat qtimageformats'
qt_tools: ''
@@ -80,7 +80,7 @@ jobs:
qt_ver: 6
qt_host: windows
qt_arch: 'win64_msvc2019_arm64'
- qt_version: '6.4.3'
+ qt_version: '6.5.0'
qt_modules: 'qt5compat qtimageformats'
qt_tools: ''
@@ -90,7 +90,7 @@ jobs:
qt_ver: 6
qt_host: mac
qt_arch: ''
- qt_version: '6.4.3'
+ qt_version: '6.5.0'
qt_modules: 'qt5compat qtimageformats'
qt_tools: ''
@@ -152,7 +152,7 @@ jobs:
- name: Setup ccache
if: (runner.os != 'Windows' || matrix.msystem == '') && inputs.build_type == 'Debug'
- uses: hendrikmuhs/ccache-action@v1.2.8
+ uses: hendrikmuhs/ccache-action@v1.2.9
with:
key: ${{ matrix.os }}-qt${{ matrix.qt_ver }}-${{ matrix.architecture }}
@@ -208,6 +208,8 @@ jobs:
if: runner.os == 'Windows' && matrix.architecture == 'arm64'
uses: jurplel/install-qt-action@v3
with:
+ aqtversion: '==3.1.*'
+ py7zrversion: '>=0.20.2'
version: ${{ matrix.qt_version }}
host: 'windows'
target: 'desktop'
@@ -223,6 +225,8 @@ jobs:
if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' || (runner.os == 'Windows' && matrix.msystem == '')
uses: jurplel/install-qt-action@v3
with:
+ aqtversion: '==3.1.*'
+ py7zrversion: '>=0.20.2'
version: ${{ matrix.qt_version }}
host: ${{ matrix.qt_host }}
target: 'desktop'
@@ -563,7 +567,7 @@ jobs:
submodules: 'true'
- name: Build Flatpak (Linux)
if: inputs.build_type == 'Debug'
- uses: flatpak/flatpak-github-actions/flatpak-builder@v5
+ uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: "Prism Launcher.flatpak"
manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml
diff --git a/.gitignore b/.gitignore
index b3e2ee7d..b5523f68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,10 +26,6 @@ Debug
build
/build-*
-# direnv / Nix
-.direnv/
-.pre-commit-config.yaml
-
# Install dirs
install
/install-*
@@ -50,7 +46,9 @@ run/
.cache/
# Nix/NixOS
-result/
+.direnv/
+.pre-commit-config.yaml
+result
# Flatpak
.flatpak-builder
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 879af535..a7c97aa7 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -517,6 +517,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting({"CentralModsDir", "ModsDir"}, "mods");
m_settings->registerSetting("IconsDir", "icons");
m_settings->registerSetting("DownloadsDir", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
+ m_settings->registerSetting("DownloadsDirWatchRecursive", false);
// Editors
m_settings->registerSetting("JsonEditor", QString());
@@ -830,9 +831,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
}
});
- {
- applyCurrentlySelectedTheme();
- }
+ applyCurrentlySelectedTheme(true);
updateCapabilities();
@@ -1107,9 +1106,9 @@ QList<ITheme*> Application::getValidApplicationThemes()
return m_themeManager->getValidApplicationThemes();
}
-void Application::applyCurrentlySelectedTheme()
+void Application::applyCurrentlySelectedTheme(bool initial)
{
- m_themeManager->applyCurrentlySelectedTheme();
+ m_themeManager->applyCurrentlySelectedTheme(initial);
}
void Application::setApplicationTheme(const QString& name)
diff --git a/launcher/Application.h b/launcher/Application.h
index 91c5fc63..0d24a4e9 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -120,7 +120,7 @@ public:
void setIconTheme(const QString& name);
- void applyCurrentlySelectedTheme();
+ void applyCurrentlySelectedTheme(bool initial = false);
QList<ITheme*> getValidApplicationThemes();
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index def73b85..6eec9b3a 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -525,13 +525,6 @@ set(MODRINTH_SOURCES
modplatform/modrinth/ModrinthInstanceCreationTask.h
)
-set(MODPACKSCH_SOURCES
- modplatform/modpacksch/FTBPackInstallTask.h
- modplatform/modpacksch/FTBPackInstallTask.cpp
- modplatform/modpacksch/FTBPackManifest.h
- modplatform/modpacksch/FTBPackManifest.cpp
-)
-
set(PACKWIZ_SOURCES
modplatform/packwiz/Packwiz.h
modplatform/packwiz/Packwiz.cpp
@@ -612,7 +605,6 @@ set(LOGIC_SOURCES
${FTB_SOURCES}
${FLAME_SOURCES}
${MODRINTH_SOURCES}
- ${MODPACKSCH_SOURCES}
${PACKWIZ_SOURCES}
${TECHNIC_SOURCES}
${ATLAUNCHER_SOURCES}
@@ -810,13 +802,6 @@ SET(LAUNCHER_SOURCES
ui/pages/modplatform/atlauncher/AtlUserInteractionSupportImpl.cpp
ui/pages/modplatform/atlauncher/AtlUserInteractionSupportImpl.h
- ui/pages/modplatform/ftb/FtbFilterModel.cpp
- ui/pages/modplatform/ftb/FtbFilterModel.h
- ui/pages/modplatform/ftb/FtbListModel.cpp
- ui/pages/modplatform/ftb/FtbListModel.h
- ui/pages/modplatform/ftb/FtbPage.cpp
- ui/pages/modplatform/ftb/FtbPage.h
-
ui/pages/modplatform/legacy_ftb/Page.cpp
ui/pages/modplatform/legacy_ftb/Page.h
ui/pages/modplatform/legacy_ftb/ListModel.h
@@ -991,7 +976,6 @@ qt_wrap_ui(LAUNCHER_UI
ui/pages/modplatform/flame/FlamePage.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
diff --git a/launcher/LoggedProcess.cpp b/launcher/LoggedProcess.cpp
index 6447f5c6..c8d5c34e 100644
--- a/launcher/LoggedProcess.cpp
+++ b/launcher/LoggedProcess.cpp
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
- * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022,2023 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (c) 2023 flowln <flowlnlnln@gmail.com>
*
* 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
@@ -60,14 +61,23 @@ LoggedProcess::~LoggedProcess()
}
}
-QStringList reprocess(const QByteArray& data, QTextDecoder& decoder)
+QStringList LoggedProcess::reprocess(const QByteArray& data, QTextDecoder& decoder)
{
auto str = decoder.toUnicode(data);
+
+ if (!m_leftover_line.isEmpty()) {
+ str.prepend(m_leftover_line);
+ m_leftover_line = "";
+ }
+
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto lines = str.remove(QChar::CarriageReturn).split(QChar::LineFeed, QString::SkipEmptyParts);
#else
auto lines = str.remove(QChar::CarriageReturn).split(QChar::LineFeed, Qt::SkipEmptyParts);
#endif
+
+ if (!str.endsWith(QChar::LineFeed))
+ m_leftover_line = lines.takeLast();
return lines;
}
diff --git a/launcher/LoggedProcess.h b/launcher/LoggedProcess.h
index 2360d1ea..af3ed79f 100644
--- a/launcher/LoggedProcess.h
+++ b/launcher/LoggedProcess.h
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
- * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022,2023 Sefa Eyeoglu <contact@scrumplex.net>
*
* 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
@@ -88,9 +88,12 @@ private slots:
private:
void changeState(LoggedProcess::State state);
+ QStringList reprocess(const QByteArray& data, QTextDecoder& decoder);
+
private:
QTextDecoder m_err_decoder = QTextDecoder(QTextCodec::codecForLocale());
QTextDecoder m_out_decoder = QTextDecoder(QTextCodec::codecForLocale());
+ QString m_leftover_line;
bool m_killed = false;
State m_state = NotRunning;
int m_exit_code = 0;
diff --git a/launcher/MangoHud.cpp b/launcher/MangoHud.cpp
index d635518e..90e48e29 100644
--- a/launcher/MangoHud.cpp
+++ b/launcher/MangoHud.cpp
@@ -19,6 +19,7 @@
#include <QStringList>
#include <QDir>
#include <QString>
+#include <QSysInfo>
#include <QtGlobal>
#include "MangoHud.h"
@@ -75,9 +76,27 @@ QString getLibraryString()
}
for (QString vkLayer : vkLayerList) {
- QString filePath = FS::PathCombine(vkLayer, "MangoHud.json");
- if (!QFile::exists(filePath))
+ // prefer to use architecture specific vulkan layers
+ QString currentArch = QSysInfo::currentCpuArchitecture();
+
+ if (currentArch == "arm64") {
+ currentArch = "aarch64";
+ }
+
+ QStringList manifestNames = { QString("MangoHud.%1.json").arg(currentArch), "MangoHud.json" };
+
+ QString filePath = "";
+ for (QString manifestName : manifestNames) {
+ QString tryPath = FS::PathCombine(vkLayer, manifestName);
+ if (QFile::exists(tryPath)) {
+ filePath = tryPath;
+ break;
+ }
+ }
+
+ if (filePath.isEmpty()) {
continue;
+ }
auto conf = Json::requireDocument(filePath, vkLayer);
auto confObject = Json::requireObject(conf, vkLayer);
diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp
index 6b7ca84f..35bef05e 100644
--- a/launcher/minecraft/MinecraftInstance.cpp
+++ b/launcher/minecraft/MinecraftInstance.cpp
@@ -925,7 +925,10 @@ QString MinecraftInstance::getStatusbarDescription()
if(m_settings->get("ShowGameTime").toBool())
{
if (lastTimePlayed() > 0) {
- description.append(tr(", last played for %1").arg(Time::prettifyDuration(lastTimePlayed())));
+ QDateTime lastLaunchTime = QDateTime::fromMSecsSinceEpoch(lastLaunch());
+ description.append(tr(", last played on %1 for %2")
+ .arg(QLocale().toString(lastLaunchTime, QLocale::ShortFormat))
+ .arg(Time::prettifyDuration(lastTimePlayed())));
}
if (totalTimePlayed() > 0) {
diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp b/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp
deleted file mode 100644
index 68d4751c..00000000
--- a/launcher/modplatform/modpacksch/FTBPackInstallTask.cpp
+++ /dev/null
@@ -1,387 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-only
-/*
- * Prism Launcher - Minecraft Launcher
- * Copyright (C) 2022 flowln <flowlnlnln@gmail.com>
- * Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
- * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
- *
- * 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.
- *
- * 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.
- *
- * 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 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
- * Copyright 2020-2021 Petr Mrazek <peterix@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
- *
- * 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 "FTBPackInstallTask.h"
-
-#include "FileSystem.h"
-#include "Json.h"
-#include "minecraft/MinecraftInstance.h"
-#include "minecraft/PackProfile.h"
-#include "modplatform/flame/PackManifest.h"
-#include "net/ChecksumValidator.h"
-#include "settings/INISettingsObject.h"
-
-#include "Application.h"
-#include "BuildConfig.h"
-#include "ui/dialogs/BlockedModsDialog.h"
-
-namespace ModpacksCH {
-
-PackInstallTask::PackInstallTask(Modpack pack, QString version, QWidget* parent)
- : m_pack(std::move(pack)), m_version_name(std::move(version)), m_parent(parent)
-{}
-
-bool PackInstallTask::abort()
-{
- if (!canAbort())
- return false;
-
- bool aborted = true;
-
- if (m_net_job)
- aborted &= m_net_job->abort();
- if (m_mod_id_resolver_task)
- aborted &= m_mod_id_resolver_task->abort();
-
- return aborted ? InstanceTask::abort() : false;
-}
-
-void PackInstallTask::executeTask()
-{
- setStatus(tr("Getting the manifest..."));
- setAbortable(false);
-
- // Find pack version
- auto version_it = std::find_if(m_pack.versions.constBegin(), m_pack.versions.constEnd(),
- [this](ModpacksCH::VersionInfo const& a) { return a.name == m_version_name; });
-
- if (version_it == m_pack.versions.constEnd()) {
- emitFailed(tr("Failed to find pack version %1").arg(m_version_name));
- return;
- }
-
- auto version = *version_it;
-
- auto netJob = makeShared<NetJob>("ModpacksCH::VersionFetch", APPLICATION->network());
-
- auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1/%2").arg(m_pack.id).arg(version.id);
- netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &m_response));
-
- QObject::connect(netJob.get(), &NetJob::succeeded, this, &PackInstallTask::onManifestDownloadSucceeded);
- QObject::connect(netJob.get(), &NetJob::failed, this, &PackInstallTask::onManifestDownloadFailed);
- QObject::connect(netJob.get(), &NetJob::aborted, this, &PackInstallTask::abort);
- QObject::connect(netJob.get(), &NetJob::progress, this, &PackInstallTask::setProgress);
-
- m_net_job = netJob;
-
- setAbortable(true);
- netJob->start();
-}
-
-void PackInstallTask::onManifestDownloadSucceeded()
-{
- m_net_job.reset();
-
- QJsonParseError parse_error{};
- QJsonDocument doc = QJsonDocument::fromJson(m_response, &parse_error);
- if (parse_error.error != QJsonParseError::NoError) {
- qWarning() << "Error while parsing JSON response from ModpacksCH at " << parse_error.offset
- << " reason: " << parse_error.errorString();
- qWarning() << m_response;
- return;
- }
-
- ModpacksCH::Version version;
- try {
- auto obj = Json::requireObject(doc);
- ModpacksCH::loadVersion(version, obj);
- } catch (const JSONValidationError& e) {
- emitFailed(tr("Could not understand pack manifest:\n") + e.cause());
- return;
- }
-
- m_version = version;
-
- resolveMods();
-}
-
-void PackInstallTask::resolveMods()
-{
- setStatus(tr("Resolving mods..."));
- setAbortable(false);
- setProgress(0, 100);
-
- m_file_id_map.clear();
-
- Flame::Manifest manifest;
- int index = 0;
-
- for (auto const& file : m_version.files) {
- if (!file.serverOnly && file.url.isEmpty()) {
- if (file.curseforge.file_id <= 0) {
- emitFailed(tr("Invalid manifest: There's no information available to download the file '%1'!").arg(file.name));
- return;
- }
-
- Flame::File flame_file;
- flame_file.projectId = file.curseforge.project_id;
- flame_file.fileId = file.curseforge.file_id;
- flame_file.hash = file.sha1;
-
- manifest.files.insert(flame_file.fileId, flame_file);
- m_file_id_map.append(flame_file.fileId);
- } else {
- m_file_id_map.append(-1);
- }
-
- index++;
- }
-
- m_mod_id_resolver_task.reset(new Flame::FileResolvingTask(APPLICATION->network(), manifest));
-
- connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::succeeded, this, &PackInstallTask::onResolveModsSucceeded);
- connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::failed, this, &PackInstallTask::onResolveModsFailed);
- connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::aborted, this, &PackInstallTask::abort);
- connect(m_mod_id_resolver_task.get(), &Flame::FileResolvingTask::progress, this, &PackInstallTask::setProgress);
-
- setAbortable(true);
-
- m_mod_id_resolver_task->start();
-}
-
-void PackInstallTask::onResolveModsSucceeded()
-{
- auto anyBlocked = false;
-
- Flame::Manifest results = m_mod_id_resolver_task->getResults();
- for (int index = 0; index < m_file_id_map.size(); index++) {
- auto const file_id = m_file_id_map.at(index);
- if (file_id < 0)
- continue;
-
- Flame::File results_file = results.files[file_id];
- VersionFile& local_file = m_version.files[index];
-
- // First check for blocked mods
- if (!results_file.resolved || results_file.url.isEmpty()) {
- BlockedMod blocked_mod;
- blocked_mod.name = local_file.name;
- blocked_mod.websiteUrl = results_file.websiteUrl;
- blocked_mod.hash = results_file.hash;
- blocked_mod.matched = false;
- blocked_mod.localPath = "";
- blocked_mod.targetFolder = results_file.targetFolder;
-
- m_blocked_mods.append(blocked_mod);
-
- anyBlocked = true;
- } else {
- local_file.url = results_file.url.toString();
- }
- }
-
- m_mod_id_resolver_task.reset();
-
- if (anyBlocked) {
- qDebug() << "Blocked files found, displaying file list";
-
- BlockedModsDialog message_dialog(m_parent, tr("Blocked files found"),
- tr("The following files are not available for download in third party launchers.<br/>"
- "You will need to manually download them and add them to the instance."),
- m_blocked_mods);
-
- message_dialog.setModal(true);
-
- if (message_dialog.exec() == QDialog::Accepted) {
- qDebug() << "Post dialog blocked mods list: " << m_blocked_mods;
- createInstance();
- } else {
- abort();
- }
-
- } else {
- createInstance();
- }
-}
-
-void PackInstallTask::createInstance()
-{
- setAbortable(false);
-
- setStatus(tr("Creating the instance..."));
- QCoreApplication::processEvents();
-
- auto instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg");
- auto instanceSettings = std::make_shared<INISettingsObject>(instanceConfigPath);
-
- MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
- auto components = instance.getPackProfile();
- components->buildingFromScratch();
-
- for (auto target : m_version.targets) {
- if (target.type == "game" && target.name == "minecraft") {
- components->setComponentVersion("net.minecraft", target.version, true);
- break;
- }
- }
-
- for (auto target : m_version.targets) {
- if (target.type != "modloader")
- continue;
-
- if (target.name == "forge") {
- components->setComponentVersion("net.minecraftforge", target.version);
- } else if (target.name == "fabric") {
- components->setComponentVersion("net.fabricmc.fabric-loader", target.version);
- }
- }
-
- // install any jar mods
- QDir jarModsDir(FS::PathCombine(m_stagingPath, "minecraft", "jarmods"));
- if (jarModsDir.exists()) {
- QStringList jarMods;
-
- for (const auto& info : jarModsDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files)) {
- jarMods.push_back(info.absoluteFilePath());
- }
-
- components->installJarMods(jarMods);
- }
-
- components->saveNow();
-
- instance.setName(name());
- instance.setIconKey(m_instIcon);
- instance.setManagedPack("modpacksch", QString::number(m_pack.id), m_pack.name, QString::number(m_version.id), m_version.name);
-
- instance.saveNow();
-
- onCreateInstanceSucceeded();
-}
-
-void PackInstallTask::onCreateInstanceSucceeded()
-{
- downloadPack();
-}
-
-void PackInstallTask::downloadPack()
-{
- setStatus(tr("Downloading mods..."));
- setAbortable(false);
-
- auto jobPtr = makeShared<NetJob>(tr("Mod download"), APPLICATION->network());
- for (auto const& file : m_version.files) {
- if (file.serverOnly || file.url.isEmpty())
- continue;
-
- auto path = FS::PathCombine(m_stagingPath, ".minecraft", file.path, file.name);
- qDebug() << "Will try to download" << file.url << "to" << path;
-
- QFileInfo file_info(file.name);
-
- auto dl = Net::Download::makeFile(file.url, path);
- if (!file.sha1.isEmpty()) {
- auto rawSha1 = QByteArray::fromHex(file.sha1.toLatin1());
- dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1));
- }
-
- jobPtr->addNetAction(dl);
- }
-
- connect(jobPtr.get(), &NetJob::succeeded, this, &PackInstallTask::onModDownloadSucceeded);
- connect(jobPtr.get(), &NetJob::failed, this, &PackInstallTask::onModDownloadFailed);
- connect(jobPtr.get(), &NetJob::aborted, this, &PackInstallTask::abort);
- connect(jobPtr.get(), &NetJob::progress, this, &PackInstallTask::setProgress);
-
- m_net_job = jobPtr;
-
- setAbortable(true);
- jobPtr->start();
-}
-
-void PackInstallTask::onModDownloadSucceeded()
-{
- m_net_job.reset();
- if (!m_blocked_mods.isEmpty()) {
- copyBlockedMods();
- }
- emitSucceeded();
-}
-
-void PackInstallTask::onManifestDownloadFailed(QString reason)
-{
- m_net_job.reset();
- emitFailed(reason);
-}
-void PackInstallTask::onResolveModsFailed(QString reason)
-{
- m_net_job.reset();
- emitFailed(reason);
-}
-void PackInstallTask::onCreateInstanceFailed(QString reason)
-{
- emitFailed(reason);
-}
-void PackInstallTask::onModDownloadFailed(QString reason)
-{
- m_net_job.reset();
- emitFailed(reason);
-}
-
-/// @brief copy the matched blocked mods to the instance staging area
-void PackInstallTask::copyBlockedMods()
-{
- setStatus(tr("Copying Blocked Mods..."));
- setAbortable(false);
- int i = 0;
- int total = m_blocked_mods.length();
- setProgress(i, total);
- for (auto const& mod : m_blocked_mods) {
- if (!mod.matched) {
- qDebug() << mod.name << "was not matched to a local file, skipping copy";
- continue;
- }
-
- auto dest_path = FS::PathCombine(m_stagingPath, ".minecraft", mod.targetFolder, mod.name);
-
- setStatus(tr("Copying Blocked Mods (%1 out of %2 are done)").arg(QString::number(i), QString::number(total)));
-
- qDebug() << "Will try to copy" << mod.localPath << "to" << dest_path;
-
- if (!FS::copy(mod.localPath, dest_path)()) {
- qDebug() << "Copy of" << mod.localPath << "to" << dest_path << "Failed";
- }
-
- i++;
- setProgress(i, total);
- }
-
- setAbortable(true);
-}
-
-} // namespace ModpacksCH
diff --git a/launcher/modplatform/modpacksch/FTBPackInstallTask.h b/launcher/modplatform/modpacksch/FTBPackInstallTask.h
deleted file mode 100644
index 97b1eb0b..00000000
--- a/launcher/modplatform/modpacksch/FTBPackInstallTask.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// SPDX-License-Identifier: GPL-3.0-only
-/*
- * Prism Launcher - Minecraft Launcher
- * Copyright (C) 2022 flowln <flowlnlnln@gmail.com>
- * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
- *
- * 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.
- *
- * 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.
- *
- * 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 2020-2021 Jamie Mansfield <jmansfield@cadixdev.org>
- * Copyright 2020-2021 Petr Mrazek <peterix@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
- *
- * 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
- *