aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp6
-rw-r--r--launcher/Application.h3
-rw-r--r--launcher/BaseInstance.cpp49
-rw-r--r--launcher/BaseInstance.h9
-rw-r--r--launcher/CMakeLists.txt38
-rw-r--r--launcher/ModDownloadTask.cpp9
-rw-r--r--launcher/ModDownloadTask.h3
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp6
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp41
-rw-r--r--launcher/minecraft/mod/Mod.cpp47
-rw-r--r--launcher/minecraft/mod/Mod.h8
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp53
-rw-r--r--launcher/minecraft/mod/ModFolderModel.h52
-rw-r--r--launcher/minecraft/mod/ModFolderModel_test.cpp44
-rw-r--r--launcher/minecraft/mod/ResourcePackFolderModel.cpp35
-rw-r--r--launcher/minecraft/mod/TexturePackFolderModel.cpp35
-rw-r--r--launcher/minecraft/mod/tasks/LocalModUpdateTask.cpp14
-rw-r--r--launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp38
-rw-r--r--launcher/minecraft/mod/tasks/ModFolderLoadTask.h4
-rw-r--r--launcher/modplatform/ModAPI.h2
-rw-r--r--launcher/modplatform/ModIndex.h19
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.cpp18
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.h5
-rw-r--r--launcher/modplatform/flame/FlameAPI.h5
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp21
-rw-r--r--launcher/modplatform/flame/FlameModIndex.h1
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.cpp27
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.h12
-rw-r--r--launcher/modplatform/helpers/NetworkModAPI.cpp25
-rw-r--r--launcher/modplatform/helpers/NetworkModAPI.h2
-rw-r--r--launcher/modplatform/modpacksch/FTBPackInstallTask.cpp44
-rw-r--r--launcher/modplatform/modrinth/ModrinthAPI.h5
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp37
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.h1
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.cpp27
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.h12
-rw-r--r--launcher/modplatform/packwiz/Packwiz_test.cpp33
-rw-r--r--launcher/net/PasteUpload.cpp3
-rw-r--r--launcher/ui/GuiUtil.cpp2
-rw-r--r--launcher/ui/MainWindow.cpp57
-rw-r--r--launcher/ui/MainWindow.h52
-rw-r--r--launcher/ui/pages/global/LanguagePage.cpp1
-rw-r--r--launcher/ui/pages/global/LanguagePage.h1
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp11
-rw-r--r--launcher/ui/pages/global/LauncherPage.h5
-rw-r--r--launcher/ui/pages/global/LauncherPage.ui3
-rw-r--r--launcher/ui/pages/instance/LogPage.cpp2
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.cpp1
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.h1
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp1
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.h1
-rw-r--r--launcher/ui/pages/instance/ServersPage.cpp2
-rw-r--r--launcher/ui/pages/instance/WorldListPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp20
-rw-r--r--launcher/ui/pages/modplatform/ModModel.h4
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp126
-rw-r--r--launcher/ui/pages/modplatform/ModPage.h4
-rw-r--r--launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp68
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.h2
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbListModel.cpp12
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp37
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModModel.cpp5
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModModel.h1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.h1
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp32
67 files changed, 1029 insertions, 221 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 4e0393c0..ab3110a3 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -154,6 +154,7 @@ void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
fflush(stderr);
}
+#ifdef LAUNCHER_WITH_UPDATER
QString getIdealPlatform(QString currentPlatform) {
auto info = Sys::getKernelInfo();
switch(info.kernelType) {
@@ -192,6 +193,7 @@ QString getIdealPlatform(QString currentPlatform) {
}
return currentPlatform;
}
+#endif
}
@@ -754,6 +756,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
qDebug() << "<> Translations loaded.";
}
+#ifdef LAUNCHER_WITH_UPDATER
// initialize the updater
if(BuildConfig.UPDATER_ENABLED)
{
@@ -763,6 +766,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_updateChecker.reset(new UpdateChecker(m_network, channelUrl, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
qDebug() << "<> Updater started.";
}
+#endif
// Instance icons
{
@@ -1408,7 +1412,9 @@ MainWindow* Application::showMainWindow(bool minimized)
}
m_mainWindow->checkInstancePathForProblems();
+#ifdef LAUNCHER_WITH_UPDATER
connect(this, &Application::updateAllowedChanged, m_mainWindow, &MainWindow::updatesAllowedChanged);
+#endif
connect(m_mainWindow, &MainWindow::isClosing, this, &Application::on_windowClose);
m_openWindows++;
}
diff --git a/launcher/Application.h b/launcher/Application.h
index e08e354a..09007160 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -42,7 +42,10 @@
#include <QIcon>
#include <QDateTime>
#include <QUrl>
+
+#ifdef LAUNCHER_WITH_UPDATER
#include <updater/GoUpdate.h>
+#endif
#include <BaseInstance.h>
diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp
index f02205e9..0efbdddc 100644
--- a/launcher/BaseInstance.cpp
+++ b/launcher/BaseInstance.cpp
@@ -2,6 +2,7 @@
/*
* PolyMC - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* 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
@@ -80,6 +81,14 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
m_settings->registerPassthrough(globalSettings->getSetting("ConsoleMaxLines"), nullptr);
m_settings->registerPassthrough(globalSettings->getSetting("ConsoleOverflowStop"), nullptr);
+
+ // Managed Packs
+ m_settings->registerSetting("ManagedPack", false);
+ m_settings->registerSetting("ManagedPackType", "");
+ m_settings->registerSetting("ManagedPackID", "");
+ m_settings->registerSetting("ManagedPackName", "");
+ m_settings->registerSetting("ManagedPackVersionID", "");
+ m_settings->registerSetting("ManagedPackVersionName", "");
}
QString BaseInstance::getPreLaunchCommand()
@@ -97,6 +106,46 @@ QString BaseInstance::getPostExitCommand()
return settings()->get("PostExitCommand").toString();
}
+bool BaseInstance::isManagedPack()
+{
+ return settings()->get("ManagedPack").toBool();
+}
+
+QString BaseInstance::getManagedPackType()
+{
+ return settings()->get("ManagedPackType").toString();
+}
+
+QString BaseInstance::getManagedPackID()
+{
+ return settings()->get("ManagedPackID").toString();
+}
+
+QString BaseInstance::getManagedPackName()
+{
+ return settings()->get("ManagedPackName").toString();
+}
+
+QString BaseInstance::getManagedPackVersionID()
+{
+ return settings()->get("ManagedPackVersionID").toString();
+}
+
+QString BaseInstance::getManagedPackVersionName()
+{
+ return settings()->get("ManagedPackVersionName").toString();
+}
+
+void BaseInstance::setManagedPack(const QString& type, const QString& id, const QString& name, const QString& versionId, const QString& version)
+{
+ settings()->set("ManagedPack", true);
+ settings()->set("ManagedPackType", type);
+ settings()->set("ManagedPackID", id);
+ settings()->set("ManagedPackName", name);
+ settings()->set("ManagedPackVersionID", versionId);
+ settings()->set("ManagedPackVersionName", version);
+}
+
int BaseInstance::getConsoleMaxLines() const
{
auto lineSetting = settings()->getSetting("ConsoleMaxLines");
diff --git a/launcher/BaseInstance.h b/launcher/BaseInstance.h
index c973fcd4..66177614 100644
--- a/launcher/BaseInstance.h
+++ b/launcher/BaseInstance.h
@@ -2,6 +2,7 @@
/*
* PolyMC - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
*
* 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
@@ -139,6 +140,14 @@ public:
QString getPostExitCommand();
QString getWrapperCommand();
+ bool isManagedPack();
+ QString getManagedPackType();
+ QString getManagedPackID();
+ QString getManagedPackName();
+ QString getManagedPackVersionID();
+ QString getManagedPackVersionName();
+ void setManagedPack(const QString& type, const QString& id, const QString& name, const QString& versionId, const QString& version);
+
/// guess log level from a line of game log
virtual MessageLevel::Enum guessLevel(const QString &line, MessageLevel::Enum level)
{
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 5397a988..b8db803b 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -156,27 +156,29 @@ set(LAUNCH_SOURCES
launch/LogModel.h
)
-# Old update system
-set(UPDATE_SOURCES
- updater/GoUpdate.h
- updater/GoUpdate.cpp
- updater/UpdateChecker.h
- updater/UpdateChecker.cpp
- updater/DownloadTask.h
- updater/DownloadTask.cpp
-)
-
-add_unit_test(UpdateChecker
- SOURCES updater/UpdateChecker_test.cpp
- LIBS Launcher_logic
- DATA updater/testdata
+if (Launcher_UPDATER_BASE)
+ set(Launcher_APP_BINARY_DEFS "-DLAUNCHER_WITH_UPDATER ${Launcher_APP_BINARY_DEFS}")
+ # Old update system
+ set(UPDATE_SOURCES
+ updater/GoUpdate.h
+ updater/GoUpdate.cpp
+ updater/UpdateChecker.h
+ updater/UpdateChecker.cpp
+ updater/DownloadTask.h
+ updater/DownloadTask.cpp
)
-add_unit_test(DownloadTask
- SOURCES updater/DownloadTask_test.cpp
- LIBS Launcher_logic
- DATA updater/testdata
+ add_unit_test(UpdateChecker
+ SOURCES updater/UpdateChecker_test.cpp
+ LIBS Launcher_logic
+ DATA updater/testdata
+ )
+ add_unit_test(DownloadTask
+ SOURCES updater/DownloadTask_test.cpp
+ LIBS Launcher_logic
+ DATA updater/testdata
)
+endif()
# Backend for the news bar... there's usually no news.
set(NEWS_SOURCES
diff --git a/launcher/ModDownloadTask.cpp b/launcher/ModDownloadTask.cpp
index 301b6637..41856fb5 100644
--- a/launcher/ModDownloadTask.cpp
+++ b/launcher/ModDownloadTask.cpp
@@ -2,6 +2,7 @@
/*
* PolyMC - 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
@@ -21,12 +22,14 @@
#include "Application.h"
#include "minecraft/mod/ModFolderModel.h"
-ModDownloadTask::ModDownloadTask(ModPlatform::IndexedPack mod, ModPlatform::IndexedVersion version, const std::shared_ptr<ModFolderModel> mods)
+ModDownloadTask::ModDownloadTask(ModPlatform::IndexedPack mod, ModPlatform::IndexedVersion version, const std::shared_ptr<ModFolderModel> mods, bool is_indexed)
: m_mod(mod), m_mod_version(version), mods(mods)
{
- m_update_task.reset(new LocalModUpdateTask(mods->indexDir(), m_mod, m_mod_version));
+ if (is_indexed) {
+ m_update_task.reset(new LocalModUpdateTask(mods->indexDir(), m_mod, m_mod_version));
- addTask(m_update_task);
+ addTask(m_update_task);
+ }
m_filesNetJob.reset(new NetJob(tr("Mod download"), APPLICATION->network()));
m_filesNetJob->setStatus(tr("Downloading mod:\n%1").arg(m_mod_version.downloadUrl));
diff --git a/launcher/ModDownloadTask.h b/launcher/ModDownloadTask.h
index f4438a8d..b3c25909 100644
--- a/launcher/ModDownloadTask.h
+++ b/launcher/ModDownloadTask.h
@@ -2,6 +2,7 @@
/*
* PolyMC - 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
@@ -29,7 +30,7 @@ class ModFolderModel;
class ModDownloadTask : public SequentialTask {
Q_OBJECT
public:
- explicit ModDownloadTask(ModPlatform::IndexedPack mod, ModPlatform::IndexedVersion version, const std::shared_ptr<ModFolderModel> mods);
+ explicit ModDownloadTask(ModPlatform::IndexedPack mod, ModPlatform::IndexedVersion version, const std::shared_ptr<ModFolderModel> mods, bool is_indexed);
const QString& getFilename() const { return m_mod_version.fileName; }
private:
diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp
index e99d30fe..7e72601f 100644
--- a/launcher/minecraft/MinecraftInstance.cpp
+++ b/launcher/minecraft/MinecraftInstance.cpp
@@ -1015,7 +1015,8 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::loaderModList() const
{
if (!m_loader_mod_list)
{
- m_loader_mod_list.reset(new ModFolderModel(modsRoot()));
+ bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
+ m_loader_mod_list.reset(new ModFolderModel(modsRoot(), is_indexed));
m_loader_mod_list->disableInteraction(isRunning());
connect(this, &BaseInstance::runningStatusChanged, m_loader_mod_list.get(), &ModFolderModel::disableInteraction);
}
@@ -1026,7 +1027,8 @@ std::shared_ptr<ModFolderModel> MinecraftInstance::coreModList() const
{
if (!m_core_mod_list)
{
- m_core_mod_list.reset(new ModFolderModel(coreModsDir()));
+ bool is_indexed = !APPLICATION->settings()->get("ModMetadataDisabled").toBool();
+ m_core_mod_list.reset(new ModFolderModel(coreModsDir(), is_indexed));
m_core_mod_list->disableInteraction(isRunning());
connect(this, &BaseInstance::runningStatusChanged, m_core_mod_list.get(), &ModFolderModel::disableInteraction);
}
diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp
index d7010355..427bc32b 100644
--- a/launcher/minecraft/launch/LauncherPartLaunch.cpp
+++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp
@@ -1,21 +1,42 @@
-/* Copyright 2013-2021 MultiMC Contributors
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PolyMC - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
- * 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 "LauncherPartLaunch.h"
#include <QStandardPaths>
+#include <QRegularExpression>
#include "launch/LaunchTask.h"
#include "minecraft/MinecraftInstance.h"
diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp
index 71a32d32..742709e3 100644
--- a/launcher/minecraft/mod/Mod.cpp
+++ b/launcher/minecraft/mod/Mod.cpp
@@ -2,6 +2,7 @@
/*
* PolyMC - 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
@@ -58,8 +59,6 @@ Mod::Mod(const QFileInfo& file)
Mod::Mod(const QDir& mods_dir, const Metadata::ModStruct& metadata)
: m_file(mods_dir.absoluteFilePath(metadata.filename))
- // It is weird, but name is not reliable for comparing with the JAR files name
- // FIXME: Maybe use hash when implemented?
, m_internal_id(metadata.filename)
, m_name(metadata.name)
{
@@ -131,7 +130,7 @@ auto Mod::enable(bool value) -> bool
return false;
} else {
path += ".disabled";
-
+
if (!file.rename(path))
return false;
}
@@ -145,23 +144,29 @@ auto Mod::enable(bool value) -> bool
void Mod::setStatus(ModStatus status)
{
- if(m_localDetails.get())
+ if (m_localDetails) {
m_localDetails->status = status;
+ } else {
+ m_temp_status = status;
+ }
}
void Mod::setMetadata(Metadata::ModStruct* metadata)
{
- if(status() == ModStatus::NoMetadata)
+ if (status() == ModStatus::NoMetadata)
setStatus(ModStatus::Installed);
- if(m_localDetails.get())
+ if (m_localDetails) {
m_localDetails->metadata.reset(metadata);
+ } else {
+ m_temp_metadata.reset(metadata);
+ }
}
auto Mod::destroy(QDir& index_dir) -> bool
{
auto n = name();
// FIXME: This can fail to remove the metadata if the
- // "DontUseModMetadata" setting is on, since there