aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp6
-rw-r--r--launcher/ApplicationMessage.cpp44
-rw-r--r--launcher/BaseInstance.cpp3
-rw-r--r--launcher/BaseVersionList.cpp42
-rw-r--r--launcher/CMakeLists.txt62
-rw-r--r--launcher/Commandline.cpp46
-rw-r--r--launcher/FileSystem.cpp39
-rw-r--r--launcher/FileSystem.h39
-rw-r--r--launcher/GZip.cpp39
-rw-r--r--launcher/InstanceImportTask.cpp2
-rw-r--r--launcher/InstanceList.cpp48
-rw-r--r--launcher/JavaCommon.cpp40
-rw-r--r--launcher/Json.cpp51
-rw-r--r--launcher/Json.h37
-rw-r--r--launcher/LoggedProcess.cpp52
-rw-r--r--launcher/LoggedProcess.h41
-rw-r--r--launcher/MMCZip.cpp2
-rw-r--r--launcher/Version.h44
-rw-r--r--launcher/VersionProxyModel.cpp40
-rw-r--r--launcher/icons/IconList.cpp48
-rw-r--r--launcher/icons/MMCIcon.cpp44
-rw-r--r--launcher/java/JavaChecker.cpp48
-rw-r--r--launcher/java/JavaInstallList.cpp43
-rw-r--r--launcher/java/JavaUtils.cpp69
-rw-r--r--launcher/launch/LaunchTask.cpp17
-rw-r--r--launcher/launch/LaunchTask.h43
-rw-r--r--launcher/launch/steps/PostLaunchCommand.cpp50
-rw-r--r--launcher/launch/steps/PreLaunchCommand.cpp49
-rw-r--r--launcher/main.cpp37
-rw-r--r--launcher/minecraft/GradleSpecifier.h55
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp24
-rw-r--r--launcher/minecraft/OneSixVersionFormat.cpp37
-rw-r--r--launcher/minecraft/PackProfile.cpp44
-rw-r--r--launcher/minecraft/ProfileUtils.cpp53
-rw-r--r--launcher/minecraft/ProfileUtils.h38
-rw-r--r--launcher/minecraft/VersionFile.cpp11
-rw-r--r--launcher/minecraft/World.cpp43
-rw-r--r--launcher/minecraft/WorldList.cpp50
-rw-r--r--launcher/minecraft/auth/AccountData.cpp3
-rw-r--r--launcher/minecraft/auth/AuthRequest.cpp43
-rw-r--r--launcher/minecraft/auth/MinecraftAccount.cpp10
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp14
-rw-r--r--launcher/minecraft/services/CapeChange.cpp39
-rw-r--r--launcher/minecraft/services/SkinDelete.cpp39
-rw-r--r--launcher/minecraft/services/SkinUpload.cpp39
-rw-r--r--launcher/modplatform/ModAPI.h36
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.cpp12
-rw-r--r--launcher/modplatform/flame/PackManifest.h37
-rw-r--r--launcher/modplatform/legacy_ftb/PackFetchTask.cpp37
-rw-r--r--launcher/modplatform/legacy_ftb/PackInstallTask.cpp39
-rw-r--r--launcher/modplatform/legacy_ftb/PrivatePackManager.cpp43
-rw-r--r--launcher/net/Download.cpp5
-rw-r--r--launcher/net/NetJob.cpp8
-rw-r--r--launcher/net/PasteUpload.cpp11
-rw-r--r--launcher/news/NewsChecker.cpp42
-rw-r--r--launcher/screenshots/ImgurAlbumCreation.cpp5
-rw-r--r--launcher/screenshots/ImgurUpload.cpp8
-rw-r--r--launcher/settings/INIFile.cpp48
-rw-r--r--launcher/translations/TranslationsModel.cpp7
-rw-r--r--launcher/ui/InstanceWindow.cpp50
-rw-r--r--launcher/ui/InstanceWindow.h44
-rw-r--r--launcher/ui/MainWindow.cpp85
-rw-r--r--launcher/ui/MainWindow.h4
-rw-r--r--launcher/ui/dialogs/AboutDialog.cpp2
-rw-r--r--launcher/ui/dialogs/CopyInstanceDialog.cpp46
-rw-r--r--launcher/ui/dialogs/ExportInstanceDialog.cpp4
-rw-r--r--launcher/ui/dialogs/NewComponentDialog.cpp41
-rw-r--r--launcher/ui/dialogs/NewInstanceDialog.cpp46
-rw-r--r--launcher/ui/dialogs/NewsDialog.cpp2
-rw-r--r--launcher/ui/dialogs/ProfileSetupDialog.cpp46
-rw-r--r--launcher/ui/dialogs/SkinUploadDialog.cpp39
-rw-r--r--launcher/ui/dialogs/UpdateDialog.cpp37
-rw-r--r--launcher/ui/instanceview/InstanceDelegate.cpp46
-rw-r--r--launcher/ui/instanceview/InstanceView.cpp90
-rw-r--r--launcher/ui/instanceview/InstanceView.h44
-rw-r--r--launcher/ui/instanceview/VisualGroup.cpp49
-rw-r--r--launcher/ui/pages/global/CustomCommandsPage.cpp2
-rw-r--r--launcher/ui/pages/global/ProxyPage.cpp16
-rw-r--r--launcher/ui/pages/global/ProxyPage.h9
-rw-r--r--launcher/ui/pages/instance/ExternalResourcesPage.cpp6
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp2
-rw-r--r--launcher/ui/pages/instance/LogPage.cpp2
-rw-r--r--launcher/ui/pages/instance/ModFolderPage.h1
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp5
-rw-r--r--launcher/ui/pages/instance/ServersPage.cpp12
-rw-r--r--launcher/ui/pages/instance/ServersPage.h3
-rw-r--r--launcher/ui/pages/instance/VersionPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/ImportPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModPage.h2
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp2
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.cpp3
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModPage.cpp2
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModPage.h2
-rw-r--r--launcher/ui/widgets/CustomCommands.cpp2
-rw-r--r--launcher/ui/widgets/CustomCommands.h2
-rw-r--r--launcher/ui/widgets/LabeledToolButton.cpp44
-rw-r--r--launcher/ui/widgets/LogView.cpp37
-rw-r--r--launcher/ui/widgets/PageContainer.cpp4
-rw-r--r--launcher/ui/widgets/VersionListView.cpp42
100 files changed, 2290 insertions, 596 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index c6e04a85..07658c5d 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -84,6 +84,7 @@
#include <QDebug>
#include <QStyleFactory>
#include <QWindow>
+#include <QIcon>
#include "InstanceList.h"
@@ -99,7 +100,6 @@
#include "tools/JVisualVM.h"
#include "tools/MCEditTool.h"
-#include <xdgicon.h>
#include "settings/INISettingsObject.h"
#include "settings/Setting.h"
@@ -1182,7 +1182,7 @@ void Application::setApplicationTheme(const QString& name, bool initial)
void Application::setIconTheme(const QString& name)
{
- XdgIcon::setThemeName(name);
+ QIcon::setThemeName(name);
}
QIcon Application::getThemedIcon(const QString& name)
@@ -1190,7 +1190,7 @@ QIcon Application::getThemedIcon(const QString& name)
if(name == "logo") {
return QIcon(":/org.polymc.PolyMC.svg");
}
- return XdgIcon::fromTheme(name);
+ return QIcon::fromTheme(name);
}
bool Application::openJsonEditor(const QString &filename)
diff --git a/launcher/ApplicationMessage.cpp b/launcher/ApplicationMessage.cpp
index e22bf13c..ca276b89 100644
--- a/launcher/ApplicationMessage.cpp
+++ b/launcher/ApplicationMessage.cpp
@@ -1,11 +1,47 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * PolyMC - Minecraft Launcher
+ * 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 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 "ApplicationMessage.h"
#include <QJsonDocument>
#include <QJsonObject>
+#include "Json.h"
void ApplicationMessage::parse(const QByteArray & input) {
- auto doc = QJsonDocument::fromBinaryData(input);
- auto root = doc.object();
+ auto doc = Json::requireDocument(input, "ApplicationMessage");
+ auto root = Json::requireObject(doc, "ApplicationMessage");
command = root.value("command").toString();
args.clear();
@@ -25,7 +61,5 @@ QByteArray ApplicationMessage::serialize() {
}
root.insert("args", outArgs);
- QJsonDocument out;
- out.setObject(root);
- return out.toBinaryData();
+ return Json::toText(root);
}
diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp
index 0efbdddc..5a84a931 100644
--- a/launcher/BaseInstance.cpp
+++ b/launcher/BaseInstance.cpp
@@ -39,6 +39,7 @@
#include <QFileInfo>
#include <QDir>
#include <QDebug>
+#include <QRegularExpression>
#include "settings/INISettingsObject.h"
#include "settings/Setting.h"
@@ -335,7 +336,7 @@ QString BaseInstance::name() const
QString BaseInstance::windowTitle() const
{
- return BuildConfig.LAUNCHER_NAME + ": " + name().replace(QRegExp("[ \n\r\t]+"), " ");
+ return BuildConfig.LAUNCHER_NAME + ": " + name().replace(QRegularExpression("\\s+"), " ");
}
// FIXME: why is this here? move it to MinecraftInstance!!!
diff --git a/launcher/BaseVersionList.cpp b/launcher/BaseVersionList.cpp
index aa9cb6cf..b4a7d6dd 100644
--- a/launcher/BaseVersionList.cpp
+++ b/launcher/BaseVersionList.cpp
@@ -1,16 +1,36 @@
-/* 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 "BaseVersionList.h"
@@ -51,7 +71,7 @@ QVariant BaseVersionList::data(const QModelIndex &index, int role) const
switch (role)
{
case VersionPointerRole:
- return qVariantFromValue(version);
+ return QVariant::fromValue(version);
case VersionRole:
return version->name();
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index ec8e84c9..9708f65c 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -88,10 +88,10 @@ set(CORE_SOURCES
MMCTime.cpp
)
-ecm_add_test(FileSystem_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(FileSystem_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME FileSystem) # TODO: needs testdata
-ecm_add_test(GZip_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(GZip_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME GZip)
set(PATHMATCHER_SOURCES
@@ -338,7 +338,7 @@ set(MINECRAFT_SOURCES
mojang/PackageManifest.cpp
minecraft/Agent.h)
-ecm_add_test(minecraft/GradleSpecifier_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(minecraft/GradleSpecifier_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME GradleSpecifier)
if(BUILD_TESTING)
@@ -347,7 +347,7 @@ if(BUILD_TESTING)
)
target_link_libraries(PackageManifest
Launcher_logic
- Qt5::Test
+ Qt${QT_VERSION_MAJOR}::Test
)
target_include_directories(PackageManifest
PRIVATE ../cmake/UnitTest/
@@ -360,18 +360,18 @@ if(BUILD_TESTING)
endif()
# TODO: needs minecraft/testdata
-ecm_add_test(minecraft/MojangVersionFormat_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(minecraft/MojangVersionFormat_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME MojangVersionFormat)
-ecm_add_test(minecraft/Library_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(minecraft/Library_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME Library)
# FIXME: shares data with FileSystem test
# TODO: needs testdata
-ecm_add_test(minecraft/mod/ModFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(minecraft/mod/ModFolderModel_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME ModFolderModel)
-ecm_add_test(minecraft/ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(minecraft/ParseUtils_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME ParseUtils)
# the screenshots feature
@@ -393,7 +393,7 @@ set(TASKS_SOURCES
tasks/SequentialTask.cpp
)
-ecm_add_test(tasks/Task_test.cpp LINK_LIBRARIES Launcher_logic Qt5::Test
+ecm_add_test(tasks/Task_test.cpp LINK_LIBRARIES Launcher_logic Qt${QT_VERSION_MAJOR}::Test
TEST_NAME Task)
set(SETTINGS_SOURCES
@@ -412,7 +412,7 @@ set(SETTINGS_SOURCES
settings/SettingsObject.h
)
-ecm_add_test(settings/INIFile_test.cpp LINK_LIBRARIES