From 014fc142915ec4a0f96b3082f76d4d32ce7596aa Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:53:05 +0300 Subject: [PATCH 001/102] truncate logs for mclo.gs upload to fit 25k line limit Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/net/PasteUpload.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index c67d3b23c..5e8c5a8cd 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -49,6 +49,27 @@ #include "net/Logging.h" +constexpr int MaxMclogsLines = 25000; +constexpr int InitialMclogsLines = 10000; +constexpr int FinalMclogsLines = 14900; + +QString truncateLogForMclogs(const QString &logContent) { + QStringList lines = logContent.split("\n"); + if (lines.size() > MaxMclogsLines) { + QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); + truncatedLog += "\n\n\n\n\n\n\n\n\n\n" + "------------------------------------------------------------\n" + "--------------------- Log truncated by ---------------------\n" + "---------------------- Prism Launcher ----------------------\n" + "----- Middle portion omitted to fit mclo.gs size limits ----\n" + "------------------------------------------------------------\n" + "\n\n\n\n\n\n\n\n\n\n"; + truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); + return truncatedLog; + } + return logContent; +} + std::array PasteUpload::PasteTypes = { { { "0x0.st", "https://0x0.st", "" }, { "hastebin", "https://hst.sh", "/documents" }, { "paste.gg", "https://paste.gg", "/api/v1/pastes" }, @@ -98,6 +119,7 @@ void PasteUpload::executeTask() } case Mclogs: { QUrlQuery postData; + m_text = truncateLogForMclogs(m_text).toUtf8(); postData.addQueryItem("content", m_text); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); rep = APPLICATION->network()->post(request, postData.toString().toUtf8()); From e6f30c0ebe0ddd43b493f27156d6c0765105ded5 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:14:40 +0300 Subject: [PATCH 002/102] fix formatting Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/net/PasteUpload.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index 5e8c5a8cd..92a44d5ed 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -53,17 +53,19 @@ constexpr int MaxMclogsLines = 25000; constexpr int InitialMclogsLines = 10000; constexpr int FinalMclogsLines = 14900; -QString truncateLogForMclogs(const QString &logContent) { +QString truncateLogForMclogs(const QString &logContent) +{ QStringList lines = logContent.split("\n"); if (lines.size() > MaxMclogsLines) { QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); - truncatedLog += "\n\n\n\n\n\n\n\n\n\n" - "------------------------------------------------------------\n" - "--------------------- Log truncated by ---------------------\n" - "---------------------- Prism Launcher ----------------------\n" - "----- Middle portion omitted to fit mclo.gs size limits ----\n" - "------------------------------------------------------------\n" - "\n\n\n\n\n\n\n\n\n\n"; + truncatedLog += + "\n\n\n\n\n\n\n\n\n\n" + "------------------------------------------------------------\n" + "--------------------- Log truncated by ---------------------\n" + "---------------------- Prism Launcher ----------------------\n" + "----- Middle portion omitted to fit mclo.gs size limits ----\n" + "------------------------------------------------------------\n" + "\n\n\n\n\n\n\n\n\n\n"; truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); return truncatedLog; } From 858f6aa9b8adcb5d2ac9eadd2702a21a88f9e4c4 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:16:40 +0300 Subject: [PATCH 003/102] fix formatting Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/net/PasteUpload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index 92a44d5ed..953a0d722 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -53,7 +53,7 @@ constexpr int MaxMclogsLines = 25000; constexpr int InitialMclogsLines = 10000; constexpr int FinalMclogsLines = 14900; -QString truncateLogForMclogs(const QString &logContent) +QString truncateLogForMclogs(const QString& logContent) { QStringList lines = logContent.split("\n"); if (lines.size() > MaxMclogsLines) { From cf914526bf5330600f3cadb9f4baddb5144af21f Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:59:51 +0300 Subject: [PATCH 004/102] add a warning about the log being too large Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/net/PasteUpload.cpp | 24 ----------------- launcher/ui/GuiUtil.cpp | 51 +++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/launcher/net/PasteUpload.cpp b/launcher/net/PasteUpload.cpp index 953a0d722..c67d3b23c 100644 --- a/launcher/net/PasteUpload.cpp +++ b/launcher/net/PasteUpload.cpp @@ -49,29 +49,6 @@ #include "net/Logging.h" -constexpr int MaxMclogsLines = 25000; -constexpr int InitialMclogsLines = 10000; -constexpr int FinalMclogsLines = 14900; - -QString truncateLogForMclogs(const QString& logContent) -{ - QStringList lines = logContent.split("\n"); - if (lines.size() > MaxMclogsLines) { - QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); - truncatedLog += - "\n\n\n\n\n\n\n\n\n\n" - "------------------------------------------------------------\n" - "--------------------- Log truncated by ---------------------\n" - "---------------------- Prism Launcher ----------------------\n" - "----- Middle portion omitted to fit mclo.gs size limits ----\n" - "------------------------------------------------------------\n" - "\n\n\n\n\n\n\n\n\n\n"; - truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); - return truncatedLog; - } - return logContent; -} - std::array PasteUpload::PasteTypes = { { { "0x0.st", "https://0x0.st", "" }, { "hastebin", "https://hst.sh", "/documents" }, { "paste.gg", "https://paste.gg", "/api/v1/pastes" }, @@ -121,7 +98,6 @@ void PasteUpload::executeTask() } case Mclogs: { QUrlQuery postData; - m_text = truncateLogForMclogs(m_text).toUtf8(); postData.addQueryItem("content", m_text); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); rep = APPLICATION->network()->post(request, postData.toString().toUtf8()); diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 584a34710..3b0eccd02 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -51,11 +51,35 @@ #include #include "Application.h" +constexpr int MaxMclogsLines = 25000; +constexpr int InitialMclogsLines = 10000; +constexpr int FinalMclogsLines = 14900; + +QString truncateLogForMclogs(const QString& logContent) +{ + QStringList lines = logContent.split("\n"); + if (lines.size() > MaxMclogsLines) { + QString truncatedLog = lines.mid(0, InitialMclogsLines).join("\n"); + truncatedLog += + "\n\n\n\n\n\n\n\n\n\n" + "------------------------------------------------------------\n" + "--------------------- Log truncated by ---------------------\n" + "---------------------- Prism Launcher ----------------------\n" + "----- Middle portion omitted to fit mclo.gs size limits ----\n" + "------------------------------------------------------------\n" + "\n\n\n\n\n\n\n\n\n\n"; + truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); + return truncatedLog; + } + return logContent; +} + std::optional GuiUtil::uploadPaste(const QString& name, const QString& text, QWidget* parentWidget) { ProgressDialog dialog(parentWidget); auto pasteTypeSetting = static_cast(APPLICATION->settings()->get("PastebinType").toInt()); auto pasteCustomAPIBaseSetting = APPLICATION->settings()->get("PastebinCustomAPIBase").toString(); + bool shouldTruncate = false; { QUrl baseUrl; @@ -75,10 +99,35 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& if (response != QMessageBox::Yes) return {}; + + if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { + auto truncateResponse = + CustomMessageBox::selectable(parentWidget, QObject::tr("Confirm Truncate"), + QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" + "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" + "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " + "potentially useful info like crashes at the end.\n\n" + "Proceed with Prism's truncation?") + .arg(text.count("\n")) + .arg(MaxMclogsLines) + .arg(InitialMclogsLines) + .arg(FinalMclogsLines), + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + + if (truncateResponse == QMessageBox::Yes) + shouldTruncate = true; + } } } - std::unique_ptr paste(new PasteUpload(parentWidget, text, pasteCustomAPIBaseSetting, pasteTypeSetting)); + QString textToUpload; + if (shouldTruncate) + textToUpload = truncateLogForMclogs(text); + else + textToUpload = text; + + std::unique_ptr paste(new PasteUpload(parentWidget, textToUpload, pasteCustomAPIBaseSetting, pasteTypeSetting)); dialog.execWithTask(paste.get()); if (!paste->wasSuccessful()) { From 99bd4a89373416cea641f1421d1082ff823eba2e Mon Sep 17 00:00:00 2001 From: maskers <97827489+maskersss@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:42:35 +0300 Subject: [PATCH 005/102] Apply suggestions from code review Co-authored-by: Alexandru Ionut Tripon Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com> --- launcher/ui/GuiUtil.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 3b0eccd02..de72a7d5d 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -115,17 +115,15 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ->exec(); - if (truncateResponse == QMessageBox::Yes) - shouldTruncate = true; + shouldTruncate = truncateResponse == QMessageBox::Yes; } } } - QString textToUpload; - if (shouldTruncate) + QString textToUpload = text; + if (shouldTruncate) { textToUpload = truncateLogForMclogs(text); - else - textToUpload = text; + } std::unique_ptr paste(new PasteUpload(parentWidget, textToUpload, pasteCustomAPIBaseSetting, pasteTypeSetting)); From 65f852615247f6c1ba3cd81cf9e51ebc0220341b Mon Sep 17 00:00:00 2001 From: maskers <97827489+maskersss@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:14:11 +0300 Subject: [PATCH 006/102] add a `Cancel` option Co-authored-by: Rachel Powers <508861+Ryex@users.noreply.github.com> Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com> --- launcher/ui/GuiUtil.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index de72a7d5d..cfc1715fc 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -112,9 +112,10 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& .arg(MaxMclogsLines) .arg(InitialMclogsLines) .arg(FinalMclogsLines), - QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No) ->exec(); + if (truncateResponse == QMessageBox::Cancel) { return {} ; } shouldTruncate = truncateResponse == QMessageBox::Yes; } } From 6d017b5f0b9fd878d387bf33585221ea079e305b Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:39:27 +0300 Subject: [PATCH 007/102] fix formatting Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/ui/GuiUtil.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index cfc1715fc..5cdd30e17 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -101,21 +101,23 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& return {}; if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { - auto truncateResponse = - CustomMessageBox::selectable(parentWidget, QObject::tr("Confirm Truncate"), - QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" - "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" - "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " - "potentially useful info like crashes at the end.\n\n" - "Proceed with Prism's truncation?") - .arg(text.count("\n")) - .arg(MaxMclogsLines) - .arg(InitialMclogsLines) - .arg(FinalMclogsLines), - QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No) - ->exec(); + auto truncateResponse = CustomMessageBox::selectable( + parentWidget, QObject::tr("Confirm Truncate"), + QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" + "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" + "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " + "potentially useful info like crashes at the end.\n\n" + "Proceed with Prism's truncation?") + .arg(text.count("\n")) + .arg(MaxMclogsLines) + .arg(InitialMclogsLines) + .arg(FinalMclogsLines), + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No) + ->exec(); - if (truncateResponse == QMessageBox::Cancel) { return {} ; } + if (truncateResponse == QMessageBox::Cancel) { + return {}; + } shouldTruncate = truncateResponse == QMessageBox::Yes; } } From a910337e9d148937fc6a7339a7bcdd9a2db1ec03 Mon Sep 17 00:00:00 2001 From: maskers <97827489+maskersss@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:42:05 +0300 Subject: [PATCH 008/102] apply suggestion from code review Co-authored-by: TheKodeToad Signed-off-by: maskers <97827489+maskersss@users.noreply.github.com> --- launcher/ui/GuiUtil.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 5cdd30e17..4d2e64af4 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -103,11 +103,11 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { auto truncateResponse = CustomMessageBox::selectable( parentWidget, QObject::tr("Confirm Truncate"), - QObject::tr("The log exceeds mclo.gs' limit: %1 lines (max %2).\n" - "Prism can keep the first %3 and last %4 lines, trimming the middle.\n\n" + QObject::tr("The log has %1 lines, exceeding mclo.gs' limit of %2.\n" + "The launcher can keep the first %3 and last %4 lines, trimming the middle.\n\n" "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " "potentially useful info like crashes at the end.\n\n" - "Proceed with Prism's truncation?") + "Proceed with truncation?") .arg(text.count("\n")) .arg(MaxMclogsLines) .arg(InitialMclogsLines) From 762d24bd02ae6a0c0f241626c9c06deeaae86574 Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:44:53 +0300 Subject: [PATCH 009/102] don't mention prism in the middle of the log Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/ui/GuiUtil.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 4d2e64af4..77d4a98e2 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -63,8 +63,8 @@ QString truncateLogForMclogs(const QString& logContent) truncatedLog += "\n\n\n\n\n\n\n\n\n\n" "------------------------------------------------------------\n" - "--------------------- Log truncated by ---------------------\n" - "---------------------- Prism Launcher ----------------------\n" + "----------------------- Log truncated ----------------------\n" + "------------------------------------------------------------\n" "----- Middle portion omitted to fit mclo.gs size limits ----\n" "------------------------------------------------------------\n" "\n\n\n\n\n\n\n\n\n\n"; From 43fc9ba932ec65d274b60bafb4d3c3f1d5bf55f0 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 25 Aug 2024 13:05:08 +0100 Subject: [PATCH 010/102] Confirm Truncate -> Truncation Signed-off-by: TheKodeToad --- launcher/ui/GuiUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index 77d4a98e2..ccb4e48b5 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -102,7 +102,7 @@ std::optional GuiUtil::uploadPaste(const QString& name, const QString& if (baseUrl.toString() == "https://api.mclo.gs" && text.count("\n") > MaxMclogsLines) { auto truncateResponse = CustomMessageBox::selectable( - parentWidget, QObject::tr("Confirm Truncate"), + parentWidget, QObject::tr("Confirm Truncation"), QObject::tr("The log has %1 lines, exceeding mclo.gs' limit of %2.\n" "The launcher can keep the first %3 and last %4 lines, trimming the middle.\n\n" "If you choose 'No', mclo.gs will only keep the first %2 lines, cutting off " From 6a12c43c787db4a64748d6c3d03b34981948d7ce Mon Sep 17 00:00:00 2001 From: maskers <97827489+mskrss@users.noreply.github.com> Date: Sun, 25 Aug 2024 16:02:32 +0300 Subject: [PATCH 011/102] fix off by one error Signed-off-by: maskers <97827489+mskrss@users.noreply.github.com> --- launcher/ui/GuiUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/GuiUtil.cpp b/launcher/ui/GuiUtil.cpp index ccb4e48b5..94dd01169 100644 --- a/launcher/ui/GuiUtil.cpp +++ b/launcher/ui/GuiUtil.cpp @@ -68,7 +68,7 @@ QString truncateLogForMclogs(const QString& logContent) "----- Middle portion omitted to fit mclo.gs size limits ----\n" "------------------------------------------------------------\n" "\n\n\n\n\n\n\n\n\n\n"; - truncatedLog += lines.mid(lines.size() - FinalMclogsLines, FinalMclogsLines).join("\n"); + truncatedLog += lines.mid(lines.size() - FinalMclogsLines - 1).join("\n"); return truncatedLog; } return logContent; From 5b6d551650e4590567321647ce68ae2043a8180c Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Thu, 10 Oct 2024 03:45:35 +0300 Subject: [PATCH 012/102] chore: update Qt to 6.8.0 Signed-off-by: Edgars Cirulis --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dc02edf3..39dc2305e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: qt_ver: 6 qt_host: windows qt_arch: "" - qt_version: "6.7.3" + qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -95,7 +95,7 @@ jobs: qt_ver: 6 qt_host: windows qt_arch: "win64_msvc2019_arm64" - qt_version: "6.7.3" + qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -106,7 +106,7 @@ jobs: qt_ver: 6 qt_host: mac qt_arch: "" - qt_version: "6.7.3" + qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: macos-14 From b39098dbc5b371e31ce585f7534ffdb00096c2b5 Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Thu, 10 Oct 2024 03:47:11 +0300 Subject: [PATCH 013/102] ci: fix qt-6.8 workflow Signed-off-by: Edgars Cirulis --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 39dc2305e..017bc68e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,8 +80,8 @@ jobs: architecture: "x64" vcvars_arch: "amd64" qt_ver: 6 - qt_host: windows - qt_arch: "" + qt_host: "windows" + qt_arch: "win64_msvc2022_64" qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" @@ -93,8 +93,8 @@ jobs: architecture: "arm64" vcvars_arch: "amd64_arm64" qt_ver: 6 - qt_host: windows - qt_arch: "win64_msvc2019_arm64" + qt_host: "windows" + qt_arch: "win64_msvc2022_arm64_cross_compiled" qt_version: "6.8.0" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" @@ -223,7 +223,7 @@ jobs: version: ${{ matrix.qt_version }} host: "windows" target: "desktop" - arch: "" + arch: ${{ matrix.qt_arch }} modules: ${{ matrix.qt_modules }} cache: ${{ inputs.is_qt_cached }} cache-key-prefix: host-qt-arm64-windows @@ -264,7 +264,7 @@ jobs: - name: Add QT_HOST_PATH var (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' run: | - echo "QT_HOST_PATH=${{ github.workspace }}\HostQt\Qt\${{ matrix.qt_version }}\msvc2019_64" >> $env:GITHUB_ENV + echo "QT_HOST_PATH=${{ github.workspace }}\HostQt\Qt\${{ matrix.qt_version }}\msvc2022_64" >> $env:GITHUB_ENV - name: Setup java (macOS) if: runner.os == 'macOS' From 0beaa94311a00cdc02ef5ff7d182849fce419aa9 Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Thu, 10 Oct 2024 15:23:48 +0300 Subject: [PATCH 014/102] ci: uprev qt install action to v4 Signed-off-by: Edgars Cirulis --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 017bc68e9..a96278ba3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -216,7 +216,7 @@ jobs: - name: Install host Qt (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: aqtversion: "==3.1.*" py7zrversion: ">=0.20.2" @@ -232,7 +232,7 @@ jobs: - name: Install Qt (macOS, Linux & Windows MSVC) if: matrix.msystem == '' - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: aqtversion: "==3.1.*" py7zrversion: ">=0.20.2" From 08f5148a9a4e574dd3ef4e7dc1e46a05ffd9dd5e Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 6 Oct 2023 09:17:03 +0300 Subject: [PATCH 015/102] Added mouse interactions for labels in ProgressDialog Signed-off-by: Trial97 --- launcher/ui/dialogs/ProfileSetupDialog.ui | 3 +++ launcher/ui/widgets/SubTaskProgressBar.ui | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/launcher/ui/dialogs/ProfileSetupDialog.ui b/launcher/ui/dialogs/ProfileSetupDialog.ui index 9dbabb4b3..947110da7 100644 --- a/launcher/ui/dialogs/ProfileSetupDialog.ui +++ b/launcher/ui/dialogs/ProfileSetupDialog.ui @@ -30,6 +30,9 @@ Choose your name carefully: true + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + nameEdit diff --git a/launcher/ui/widgets/SubTaskProgressBar.ui b/launcher/ui/widgets/SubTaskProgressBar.ui index 5431eab60..aabb68329 100644 --- a/launcher/ui/widgets/SubTaskProgressBar.ui +++ b/launcher/ui/widgets/SubTaskProgressBar.ui @@ -47,6 +47,9 @@ true + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + @@ -68,6 +71,9 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + From c12beb43a0f3dad6e66fd42192dbbf1f78fb6c53 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 21 Aug 2023 19:47:47 +0300 Subject: [PATCH 016/102] correctly expand env vars Signed-off-by: Trial97 --- launcher/launch/LaunchTask.cpp | 62 +++++++++++++++++---- launcher/launch/LaunchTask.h | 3 +- launcher/launch/steps/PostLaunchCommand.cpp | 12 ++-- launcher/launch/steps/PreLaunchCommand.cpp | 13 ++--- 4 files changed, 60 insertions(+), 30 deletions(-) diff --git a/launcher/launch/LaunchTask.cpp b/launcher/launch/LaunchTask.cpp index 0251b302d..976221471 100644 --- a/launcher/launch/LaunchTask.cpp +++ b/launcher/launch/LaunchTask.cpp @@ -254,20 +254,60 @@ void LaunchTask::emitFailed(QString reason) Task::emitFailed(reason); } -void LaunchTask::substituteVariables(QStringList& args) const +QString expandVariables(const QString& input, QProcessEnvironment dict) { - auto env = m_instance->createEnvironment(); + QString result = input; - for (auto key : env.keys()) { - args.replaceInStrings("$" + key, env.value(key)); + enum { base, maybeBrace, variable, brace } state = base; + int startIdx = -1; + for (int i = 0; i < result.length();) { + QChar c = result.at(i++); + switch (state) { + case base: + if (c == '$') + state = maybeBrace; + break; + case maybeBrace: + if (c == '{') { + state = brace; + startIdx = i; + } else if (c.isLetterOrNumber() || c == '_') { + state = variable; + startIdx = i - 1; + } else { + state = base; + } + break; + case brace: + if (c == '}') { + const auto res = dict.value(result.mid(startIdx, i - 1 - startIdx), ""); + if (!res.isEmpty()) { + result.replace(startIdx - 2, i - startIdx + 2, res); + i = startIdx - 2 + res.length(); + } + state = base; + } + break; + case variable: + if (!c.isLetterOrNumber() && c != '_') { + const auto res = dict.value(result.mid(startIdx, i - startIdx - 1), ""); + if (!res.isEmpty()) { + result.replace(startIdx - 1, i - startIdx, res); + i = startIdx - 1 + res.length(); + } + state = base; + } + break; + } } + if (state == variable) { + if (const auto res = dict.value(result.mid(startIdx), ""); !res.isEmpty()) + result.replace(startIdx - 1, result.length() - startIdx + 1, res); + } + return result; } -void LaunchTask::substituteVariables(QString& cmd) const +QString LaunchTask::substituteVariables(QString& cmd) const { - auto env = m_instance->createEnvironment(); - - for (auto key : env.keys()) { - cmd.replace("$" + key, env.value(key)); - } -} + return expandVariables(cmd, m_instance->createEnvironment()); +} \ No newline at end of file diff --git a/launcher/launch/LaunchTask.h b/launcher/launch/LaunchTask.h index 56065af5b..1f1b5222b 100644 --- a/launcher/launch/LaunchTask.h +++ b/launcher/launch/LaunchTask.h @@ -87,8 +87,7 @@ class LaunchTask : public Task { shared_qobject_ptr getLogModel(); public: - void substituteVariables(QStringList& args) const; - void substituteVariables(QString& cmd) const; + QString substituteVariables(QString& cmd) const; QString censorPrivateInfo(QString in); protected: /* methods */ diff --git a/launcher/launch/steps/PostLaunchCommand.cpp b/launcher/launch/steps/PostLaunchCommand.cpp index 725101224..946560c10 100644 --- a/launcher/launch/steps/PostLaunchCommand.cpp +++ b/launcher/launch/steps/PostLaunchCommand.cpp @@ -47,19 +47,15 @@ PostLaunchCommand::PostLaunchCommand(LaunchTask* parent) : LaunchStep(parent) void PostLaunchCommand::executeTask() { - // FIXME: where to put this? + auto cmd = m_parent->substituteVariables(m_command); + emit logLine(tr("Running Post-Launch command: %1").arg(cmd), MessageLevel::Launcher); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - auto args = QProcess::splitCommand(m_command); - m_parent->substituteVariables(args); + auto args = QProcess::splitCommand(cmd); - emit logLine(tr("Running Post-Launch command: %1").arg(args.join(' ')), MessageLevel::Launcher); const QString program = args.takeFirst(); m_process.start(program, args); #else - m_parent->substituteVariables(m_command); - - emit logLine(tr("Running Post-Launch command: %1").arg(m_command), MessageLevel::Launcher); - m_process.start(m_command); + m_process.start(cmd); #endif } diff --git a/launcher/launch/steps/PreLaunchCommand.cpp b/launcher/launch/steps/PreLaunchCommand.cpp index 6d071a66e..3505febf7 100644 --- a/launcher/launch/steps/PreLaunchCommand.cpp +++ b/launcher/launch/steps/PreLaunchCommand.cpp @@ -47,19 +47,14 @@ PreLaunchCommand::PreLaunchCommand(LaunchTask* parent) : LaunchStep(parent) void PreLaunchCommand::executeTask() { - // FIXME: where to put this? + auto cmd = m_parent->substituteVariables(m_command); + emit logLine(tr("Running Pre-Launch command: %1").arg(cmd), MessageLevel::Launcher); #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - auto args = QProcess::splitCommand(m_command); - m_parent->substituteVariables(args); - - emit logLine(tr("Running Pre-Launch command: %1").arg(args.join(' ')), MessageLevel::Launcher); + auto args = QProcess::splitCommand(cmd); const QString program = args.takeFirst(); m_process.start(program, args); #else - m_parent->substituteVariables(m_command); - - emit logLine(tr("Running Pre-Launch command: %1").arg(m_command), MessageLevel::Launcher); - m_process.start(m_command); + m_process.start(cmd); #endif } From 09a118e85e3646ded9d7b2704d2f95a589ca19b9 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 18 Nov 2023 11:18:50 +0200 Subject: [PATCH 017/102] expand env from wrapped cmd Signed-off-by: Trial97 --- launcher/launch/LaunchTask.cpp | 6 +++--- launcher/launch/LaunchTask.h | 2 +- launcher/minecraft/launch/LauncherPartLaunch.cpp | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/launcher/launch/LaunchTask.cpp b/launcher/launch/LaunchTask.cpp index 976221471..4b93d2077 100644 --- a/launcher/launch/LaunchTask.cpp +++ b/launcher/launch/LaunchTask.cpp @@ -307,7 +307,7 @@ QString expandVariables(const QString& input, QProcessEnvironment dict) return result; } -QString LaunchTask::substituteVariables(QString& cmd) const +QString LaunchTask::substituteVariables(QString& cmd, bool isLaunch) const { - return expandVariables(cmd, m_instance->createEnvironment()); -} \ No newline at end of file + return expandVariables(cmd, isLaunch ? m_instance->createLaunchEnvironment() : m_instance->createEnvironment()); +} diff --git a/launcher/launch/LaunchTask.h b/launcher/launch/LaunchTask.h index 1f1b5222b..2e87ece95 100644 --- a/launcher/launch/LaunchTask.h +++ b/launcher/launch/LaunchTask.h @@ -87,7 +87,7 @@ class LaunchTask : public Task { shared_qobject_ptr getLogModel(); public: - QString substituteVariables(QString& cmd) const; + QString substituteVariables(QString& cmd, bool isLaunch = false) const; QString censorPrivateInfo(QString in); protected: /* methods */ diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp index d9a2b9b6b..2e842632a 100644 --- a/launcher/minecraft/launch/LauncherPartLaunch.cpp +++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp @@ -131,6 +131,7 @@ void LauncherPartLaunch::executeTask() QString wrapperCommandStr = instance->getWrapperCommand().trimmed(); if (!wrapperCommandStr.isEmpty()) { + wrapperCommandStr = m_parent->substituteVariables(wrapperCommandStr); auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr); auto wrapperCommand = wrapperArgs.takeFirst(); auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand); From e6d4e5d78dfacc4836a3a2240d6531cdc2dcee76 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 6 Nov 2024 23:46:30 +0000 Subject: [PATCH 018/102] Unify instance and global settings pt.1 Signed-off-by: TheKodeToad --- launcher/Application.cpp | 4 - launcher/CMakeLists.txt | 12 +- launcher/InstancePageProvider.h | 2 +- .../ui/pages/global/CustomCommandsPage.cpp | 84 -- .../pages/global/EnvironmentVariablesPage.cpp | 71 -- .../pages/global/EnvironmentVariablesPage.h | 42 - launcher/ui/pages/global/MinecraftPage.cpp | 185 ---- launcher/ui/pages/global/MinecraftPage.h | 28 +- .../pages/instance/InstanceSettingsPage.cpp | 611 ------------ .../ui/pages/instance/InstanceSettingsPage.h | 74 +- .../ui/widgets/MinecraftSettingsWidget.cpp | 320 +++++++ .../MinecraftSettingsWidget.h} | 34 +- .../ui/widgets/MinecraftSettingsWidget.ui | 876 ++++++++++++++++++ 13 files changed, 1244 insertions(+), 1099 deletions(-) delete mode 100644 launcher/ui/pages/global/CustomCommandsPage.cpp delete mode 100644 launcher/ui/pages/global/EnvironmentVariablesPage.cpp delete mode 100644 launcher/ui/pages/global/EnvironmentVariablesPage.h delete mode 100644 launcher/ui/pages/global/MinecraftPage.cpp delete mode 100644 launcher/ui/pages/instance/InstanceSettingsPage.cpp create mode 100644 launcher/ui/widgets/MinecraftSettingsWidget.cpp rename launcher/ui/{pages/global/CustomCommandsPage.h => widgets/MinecraftSettingsWidget.h} (69%) create mode 100644 launcher/ui/widgets/MinecraftSettingsWidget.ui diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 11b80a006..c45bb1c8c 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -59,8 +59,6 @@ #include "ui/pages/BasePageProvider.h" #include "ui/pages/global/APIPage.h" #include "ui/pages/global/AccountListPage.h" -#include "ui/pages/global/CustomCommandsPage.h" -#include "ui/pages/global/EnvironmentVariablesPage.h" #include "ui/pages/global/ExternalToolsPage.h" #include "ui/pages/global/JavaPage.h" #include "ui/pages/global/LanguagePage.h" @@ -801,8 +799,6 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); m_globalSettingsProvider->addPage(); diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 486aaff3e..7a23b2300 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -908,7 +908,6 @@ SET(LAUNCHER_SOURCES ui/pages/instance/NotesPage.h ui/pages/instance/LogPage.cpp ui/pages/instance/LogPage.h - ui/pages/instance/InstanceSettingsPage.cpp ui/pages/instance/InstanceSettingsPage.h ui/pages/instance/ScreenshotsPage.cpp ui/pages/instance/ScreenshotsPage.h @@ -922,17 +921,12 @@ SET(LAUNCHER_SOURCES # GUI - global settings pages ui/pages/global/AccountListPage.cpp ui/pages/global/AccountListPage.h - ui/pages/global/CustomCommandsPage.cpp - ui/pages/global/CustomCommandsPage.h - ui/pages/global/EnvironmentVariablesPage.cpp - ui/pages/global/EnvironmentVariablesPage.h ui/pages/global/ExternalToolsPage.cpp ui/pages/global/ExternalToolsPage.h ui/pages/global/JavaPage.cpp ui/pages/global/JavaPage.h ui/pages/global/LanguagePage.cpp ui/pages/global/LanguagePage.h - ui/pages/global/MinecraftPage.cpp ui/pages/global/MinecraftPage.h ui/pages/global/LauncherPage.cpp ui/pages/global/LauncherPage.h @@ -1128,6 +1122,8 @@ SET(LAUNCHER_SOURCES ui/widgets/WideBar.cpp ui/widgets/ThemeCustomizationWidget.h ui/widgets/ThemeCustomizationWidget.cpp + ui/widgets/MinecraftSettingsWidget.h + ui/widgets/MinecraftSettingsWidget.cpp # GUI - instance group view ui/instanceview/InstanceProxyModel.cpp @@ -1171,7 +1167,6 @@ qt_wrap_ui(LAUNCHER_UI ui/pages/global/LauncherPage.ui ui/pages/global/APIPage.ui ui/pages/global/ProxyPage.ui - ui/pages/global/MinecraftPage.ui ui/pages/global/ExternalToolsPage.ui ui/pages/instance/ExternalResourcesPage.ui ui/pages/instance/NotesPage.ui @@ -1179,7 +1174,6 @@ qt_wrap_ui(LAUNCHER_UI ui/pages/instance/ServersPage.ui ui/pages/instance/GameOptionsPage.ui ui/pages/instance/OtherLogsPage.ui - ui/pages/instance/InstanceSettingsPage.ui ui/pages/instance/VersionPage.ui ui/pages/instance/ManagedPackPage.ui ui/pages/instance/WorldListPage.ui @@ -1202,6 +1196,7 @@ qt_wrap_ui(LAUNCHER_UI ui/widgets/ModFilterWidget.ui ui/widgets/SubTaskProgressBar.ui ui/widgets/ThemeCustomizationWidget.ui + ui/widgets/MinecraftSettingsWidget.ui ui/dialogs/CopyInstanceDialog.ui ui/dialogs/ProfileSetupDialog.ui ui/dialogs/ProgressDialog.ui @@ -1222,7 +1217,6 @@ qt_wrap_ui(LAUNCHER_UI ui/dialogs/ScrollMessageBox.ui ui/dialogs/BlockedModsDialog.ui ui/dialogs/ChooseProviderDialog.ui - ui/dialogs/skins/SkinManageDialog.ui ) diff --git a/launcher/InstancePageProvider.h b/launcher/InstancePageProvider.h index 174041f89..1d7c193f8 100644 --- a/launcher/InstancePageProvider.h +++ b/launcher/InstancePageProvider.h @@ -43,7 +43,7 @@ class InstancePageProvider : protected QObject, public BasePageProvider { values.append(new ServersPage(onesix)); // values.append(new GameOptionsPage(onesix.get())); values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots"))); - values.append(new InstanceSettingsPage(onesix.get())); + values.append(new InstanceSettingsPage(onesix)); auto logMatcher = inst->getLogFileMatcher(); if (logMatcher) { values.append(new OtherLogsPage(inst->getLogFileRoot(), logMatcher)); diff --git a/launcher/ui/pages/global/CustomCommandsPage.cpp b/launcher/ui/pages/global/CustomCommandsPage.cpp deleted file mode 100644 index cc8518c2f..000000000 --- a/launcher/ui/pages/global/CustomCommandsPage.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -/* - * Prism Launcher - Minecraft Launcher - * Copyright (c) 2022 Jamie Mansfield - * Copyright (C) 2022 Sefa Eyeoglu - * - * 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 . - * - * 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 "CustomCommandsPage.h" -#include -#include -#include - -CustomCommandsPage::CustomCommandsPage(QWidget* parent) : QWidget(parent) -{ - auto verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - auto tabWidget = new QTabWidget(this); - tabWidget->setObjectName(QStringLiteral("tabWidget")); - commands = new CustomCommands(this); - commands->setContentsMargins(6, 6, 6, 6); - tabWidget->addTab(commands, "Foo"); - tabWidget->tabBar()->hide(); - verticalLayout->addWidget(tabWidget); - loadSettings(); -} - -CustomCommandsPage::~CustomCommandsPage() {} - -bool CustomCommandsPage::apply() -{ - applySettings(); - return true; -} - -void CustomCommandsPage::applySettings() -{ - auto s = APPLICATION->settings(); - s->set("PreLaunchCommand", commands->prelaunchCommand()); - s->set("WrapperCommand", commands->wrapperCommand()); - s->set("PostExitCommand", commands->postexitCommand()); -} - -void CustomCommandsPage::loadSettings() -{ - auto s = APPLICATION->settings(); - commands->initialize(false, true, s->get("PreLaunchCommand").toString(), s->get("WrapperCommand").toString(), - s->get("PostExitCommand").toString()); -} - -void CustomCommandsPage::retranslate() -{ - commands->retranslate(); -} diff --git a/launcher/ui/pages/global/EnvironmentVariablesPage.cpp b/launcher/ui/pages/global/EnvironmentVariablesPage.cpp deleted file mode 100644 index 2d44ed624..000000000 --- a/launcher/ui/pages/global/EnvironmentVariablesPage.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -/* - * Prism Launcher - Minecraft Launcher - * Copyright (C) 2023 TheKodeToad - * - * 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 . - */ - -#include -#include -#include - -#include "EnvironmentVariablesPage.h" - -EnvironmentVariablesPage::EnvironmentVariablesPage(QWidget* parent) : QWidget(parent) -{ - auto verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - auto tabWidget = new QTabWidget(this); - tabWidget->setObjectName(QStringLiteral("tabWidget")); - variables = new EnvironmentVariables(this); - variables->setContentsMargins(6, 6, 6, 6); - tabWidget->addTab(variables, "Foo"); - tabWidget->tabBar()->hide(); - verticalLayout->addWidget(tabWidget); - - variables->initialize(false, false, APPLICATION->settings()->get("Env").toMap()); -} - -QString EnvironmentVariablesPage::displayName() const -{ - return tr("Environment Variables"); -} - -QIcon EnvironmentVariablesPage::icon() const -{ - return APPLICATION->getThemedIcon("environment-variables"); -} - -QString EnvironmentVariablesPage::id() const -{ - return "environment-variables"; -} - -QString EnvironmentVariablesPage::helpPage() const -{ - return "Environment-variables"; -} - -bool EnvironmentVariablesPage::apply() -{ - APPLICATION->settings()->set("Env", variables->value()); - return true; -} - -void EnvironmentVariablesPage::retranslate() -{ - variables->retranslate(); -} diff --git a/launcher/ui/pages/global/EnvironmentVariablesPage.h b/launcher/ui/pages/global/EnvironmentVariablesPage.h deleted file mode 100644 index 6e80775ec..000000000 --- a/launcher/ui/pages/global/EnvironmentVariablesPage.h +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -/* - * Prism Launcher - Minecraft Launcher - * Copyright (C) 2023 TheKodeToad - * - * 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 . - */ - -#pragma once - -#include - -#include "ui/pages/BasePage.h" -#include "ui/widgets/EnvironmentVariables.h" - -class EnvironmentVariablesPage : public QWidget, public BasePage { - Q_OBJECT - - public: - explicit EnvironmentVariablesPage(QWidget* parent = nullptr); - - QString displayName() const override; - QIcon icon() const override; - QString id() const override; - QString helpPage() const override; - - bool apply() override; - void retranslate() override; - - private: - EnvironmentVariables* variables; -}; diff --git a/launcher/ui/pages/global/MinecraftPage.cpp b/launcher/ui/pages/global/MinecraftPage.cpp deleted file mode 100644 index 3431dcb9c..000000000 --- a/launcher/ui/pages/global/MinecraftPage.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -/* - * Prism Launcher - Minecraft Launcher - * Copyright (c) 2022 Jamie Mansfield - * - * 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 . - * - * 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 "MinecraftPage.h" -#include "BuildConfig.h" -#include "ui_MinecraftPage.h" - -#include -#include -#include - -#include "Application.h" -#include "settings/SettingsObject.h" - -#ifdef Q_OS_LINUX -#include "MangoHud.h" -#endif - -MinecraftPage::MinecraftPage(QWidget* parent) : QWidget(parent), ui(new Ui::MinecraftPage) -{ - ui->setupUi(this); - connect(ui->useNativeGLFWCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeGLFWChanged); - connect(ui->useNativeOpenALCheck, &QAbstractButton::toggled, this, &MinecraftPage::onUseNativeOpenALChanged); - loadSettings(); - updateCheckboxStuff(); -} - -MinecraftPage::~MinecraftPage() -{ - delete ui; -} - -bool MinecraftPage::apply() -{ - applySettings(); - return true; -} - -void MinecraftPage::updateCheckboxStuff() -{ - ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked()); - ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked()); -} - -void MinecraftPage::on_maximizedCheckBox_clicked(bool checked) -{ - Q_UNUSED(checked); - updateCheckboxStuff(); -} - -void MinecraftPage::onUseNativeGLFWChanged(bool checked) -{ - ui->lineEditGLFWPath->setEnabled(checked); -} - -void MinecraftPage::onUseNativeOpenALChanged(bool checked) -{ - ui->lineEditOpenALPath->setEnabled(checked); -} - -void MinecraftPage::applySettings() -{ - auto s = APPLICATION->settings(); - - // Window Size - s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked()); - s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value()); - s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value()); - - // Native library workarounds - s->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked()); - s->set("CustomGLFWPath", ui->lineEditGLFWPath->text()); - s->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); - s->set("CustomOpenALPath", ui->lineEditOpenALPath->text()); - - // Peformance related options - s->set("EnableFeralGamemode", ui->enableFeralGamemodeCheck->isChecked()); - s->set("EnableMangoHud", ui->enableMangoHud->isChecked()); - s->set("UseDiscreteGpu", ui->useDiscreteGpuCheck->isChecked()); - s->set("UseZink", ui->useZink->isChecked()); - - // Game time - s->set("ShowGameTime", ui->showGameTime->isChecked()); - s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked()); - s->set("RecordGameTime", ui->recordGameTime->isChecked()); - s->set("ShowGameTimeWithoutDays", ui->showGameTimeWithoutDays->isChecked()); - - // Miscellaneous - s->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked()); - s->set("QuitAfterGameStop", ui->quitAfterGameStopCheck->isChecked()); - - // Legacy settings - s->set("OnlineFixes", ui->onlineFixes->isChecked()); -} - -void MinecraftPage::loadSettings() -{ - auto s = APPLICATION->settings(); - - // Window Size - ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool()); - ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt()); - ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt()); - - ui->useNativeGLFWCheck->setChecked(s->get("UseNativeGLFW").toBool()); - ui->lineEditGLFWPath->setText(s->get("CustomGLFWPath").toString()); - ui->lineEditGLFWPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.GLFW_LIBRARY_NAME)); -#ifdef Q_OS_LINUX - if (!APPLICATION->m_detectedGLFWPath.isEmpty()) - ui->lineEditGLFWPath->setPlaceholderText(tr("Auto detected path: %1").arg(APPLICATION->m_detectedGLFWPath)); -#endif - ui->useNativeOpenALCheck->setChecked(s->get("UseNativeOpenAL").toBool()); - ui->lineEditOpenALPath->setText(s->get("CustomOpenALPath").toString()); - ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME)); -#ifdef Q_OS_LINUX - if (!APPLICATION->m_detectedOpenALPath.isEmpty()) - ui->lineEditOpenALPath->setPlaceholderText(tr("Auto detected path: %1").arg(APPLICATION->m_detectedOpenALPath)); -#endif - - ui->enableFeralGamemodeCheck->setChecked(s->get("EnableFeralGamemode").toBool()); - ui->enableMangoHud->setChecked(s->get("EnableMangoHud").toBool()); - ui->useDiscreteGpuCheck->setChecked(s->get("UseDiscreteGpu").toBool()); - ui->useZink->setChecked(s->get("UseZink").toBool()); - -#if !defined(Q_OS_LINUX) - ui->perfomanceGroupBox->setVisible(false); -#endif - - if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { - ui->enableFeralGamemodeCheck->setDisabled(true); - ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system.")); - } - - if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) { - ui->enableMangoHud->setDisabled(true); - ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system.")); - } - - ui->showGameTime->setChecked(s->get("ShowGameTime").toBool()); - ui->showGlobalGameTime->setChecked(s->get("ShowGlobalGameTime").toBool()); - ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool()); - ui->showGameTimeWithoutDays->setChecked(s->get("ShowGameTimeWithoutDays").toBool()); - - ui->closeAfterLaunchCheck->setChecked(s->get("CloseAfterLaunch").toBool()); - ui->quitAfterGameStopCheck->setChecked(s->get("QuitAfterGameStop").toBool()); - - ui->onlineFixes->setChecked(s->get("OnlineFixes").toBool()); -} - -void MinecraftPage::retranslate() -{ - ui->retranslateUi(this); -} diff --git a/launcher/ui/pages/global/MinecraftPage.h b/launcher/ui/pages/global/MinecraftPage.h index 5facfbb3f..9c01bdec6 100644 --- a/launcher/ui/pages/global/MinecraftPage.h +++ b/launcher/ui/pages/global/MinecraftPage.h @@ -39,6 +39,7 @@ #include #include +#include #include "java/JavaChecker.h" #include "ui/pages/BasePage.h" @@ -48,31 +49,20 @@ namespace Ui { class MinecraftPage; } -class MinecraftPage : public QWidget, public BasePage { +class MinecraftPage : public MinecraftSettingsWidget, public BasePage { Q_OBJECT public: - explicit MinecraftPage(QWidget* parent = 0); - ~MinecraftPage(); + explicit MinecraftPage(QWidget* parent = nullptr) : MinecraftSettingsWidget(nullptr, parent) {} + ~MinecraftPage() override {} QString displayName() const override { return tr("Minecraft"); } QIcon icon() const override { return APPLICATION->getThemedIcon("minecraft"); } QString id() const override { return "minecraft-settings"; } QString helpPage() const override { return "Minecraft-settings"; } - bool apply() override; - void retranslate() override; - - private: - void updateCheckboxStuff(); - void applySettings(); - void loadSettings(); - - private slots: - void on_maximizedCheckBox_clicked(bool checked); - - void onUseNativeGLFWChanged(bool checked); - void onUseNativeOpenALChanged(bool checked); - - private: - Ui::MinecraftPage* ui; + bool apply() override + { + saveSettings(); + return true; + } }; diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp deleted file mode 100644 index 1a5be050f..000000000 --- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp +++ /dev/null @@ -1,611 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -/* - * Prism Launcher - Minecraft Launcher - * Copyright (c) 2022 Jamie Mansfield - * Copyright (C) 2022 Sefa Eyeoglu - * Copyright (C) 2022 TheKodeToad - * - * 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 . - * - * 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 "InstanceSettingsPage.h" -#include "minecraft/MinecraftInstance.h" -#include "minecraft/WorldList.h" -#include "settings/Setting.h" -#include "ui/dialogs/CustomMessageBox.h" -#include "ui/java/InstallJavaDialog.h" -#include "ui_InstanceSettingsPage.h" - -#include -#include -#include - -#include - -#include "ui/dialogs/VersionSelectDialog.h" -#include "ui/widgets/CustomCommands.h" - -#include "Application.h" -#include "BuildConfig.h" -#include "JavaCommon.h" -#include "minecraft/auth/AccountList.h" - -#include "FileSystem.h" -#include "java/JavaInstallList.h" -#include "java/JavaUtils.h" - -InstanceSettingsPage::InstanceSettingsPage(BaseInstance* inst, QWidget* parent) - : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst) -{ - m_settings = inst->settings(); - ui->setupUi(this); - - ui->javaDownloadBtn->setHidden(!BuildConfig.JAVA_DOWNLOADER_ENABLED); - - connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked); - connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings); - connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); - connect(ui->instanceAccountSelector, QOverload::of(&QComboBox::currentIndexChanged), this, - &InstanceSettingsPage::changeInstanceAccount); - - connect(ui->useNativeGLFWCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeGLFWChanged); - connect(ui->useNativeOpenALCheck, &QAbstractButton::toggled, this, &InstanceSettingsPage::onUseNativeOpenALChanged); - - auto mInst = dynamic_cast(inst); - m_world_quickplay_supported = mInst && mInst->traits().contains("feature:is_quick_play_singleplayer"); - if (m_world_quickplay_supported) { - auto worlds = mInst->worldList(); - worlds->update(); - for (const auto& world : worlds->allWorlds()) { - ui->worldsCb->addItem(world.folderName()); - } - } else { - ui->worldsCb->hide(); - ui->worldJoinButton->hide(); - ui->serverJoinAddressButton->setChecked(true); - ui->serverJoinAddress->setEnabled(true); - ui->serverJoinAddressButton->setStyleSheet("QRadioButton::indicator { width: 0px; height: 0px; }"); - } - - loadSettings(); - - updateThresholds(); -} - -InstanceSettingsPage::~InstanceSettingsPage() -{ - delete ui; -} - -void InstanceSettingsPage::globalSettingsButtonClicked(bool) -{ - switch (ui->settingsTabs->currentIndex()) { - case 0: - APPLICATION->ShowGlobalSettings(this, "java-settings"); - return; - case 2: - APPLICATION->ShowGlobalSettings(this, "custom-commands"); - return; - case 3: - APPLICATION->ShowGlobalSettings(this, "environment-variables"); - return; - default: - APPLICATION->ShowGlobalSettings(this, "minecraft-settings"); - return; - } -} - -bool InstanceSettingsPage::apply() -{ - applySettings(); - return true; -} - -void InstanceSettingsPage::applySettings() -{ - SettingsObject::Lock lock(m_settings); - - // Miscellaneous - bool miscellaneous = ui->miscellaneousSettingsBox->isChecked(); - m_settings->set("OverrideMiscellaneous", miscellaneous); - if (miscellaneous) { - m_settings->set("CloseAfterLaunch", ui->closeAfterLaunchCheck->isChecked()); - m_settings->set("QuitAfterGameStop", ui->quitAfterGameStopCheck->isChecked()); - } else { - m_settings->reset("CloseAfterLaunch"); - m_settings->reset("QuitAfterGameStop"); - } - - // Console - bool console = ui->consoleSettingsBox->isChecked(); - m_settings->set("OverrideConsole", console); - if (console) { - m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked()); - m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); - m_settings->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked()); - } else { - m_settings->reset("ShowConsole"); - m_settings->reset("AutoCloseConsole"); - m_settings->reset("ShowConsoleOnError"); - } - - // Window Size - bool window = ui->windowSizeGroupBox->isChecked(); - m_settings->set("OverrideWindow", window); - if (window) { - m_settings->set("LaunchMaximized", ui->maximizedCheckBox->isChecked()); - m_settings->set("MinecraftWinWidth", ui->windowWidthSpinBox->value()); - m_settings->set("MinecraftWinHeight", ui->windowHeightSpinBox->value()); - } else { - m_settings->reset("LaunchMaximized"); - m_settings->reset("MinecraftWinWidth"); - m_settings->reset("MinecraftWinHeight"); - } - - // Memory - bool memory = ui->memoryGroupBox->isChecked(); - m_settings->set("OverrideMemory", memory); - if (memory) { - int min = ui->minMemSpinBox->value(); - int max = ui->maxMemSpinBox->value(); - if (min < max) { - m_settings->set("MinMemAlloc", min); - m_settings->set("MaxMemAlloc", max); - } else { - m_settings->set("MinMemAlloc", max); - m_settings->set("MaxMemAlloc", min); - } - m_settings->set("PermGen", ui->permGenSpinBox->value()); - } else { - m_settings->reset("MinMemAlloc"); - m_settings->reset("MaxMemAlloc"); - m_settings->reset("PermGen"); - } - - // Java Install Settings - bool javaInstall = ui->javaSettingsGroupBox->isChecked(); - m_settings->set("OverrideJavaLocation", javaInstall); - if (javaInstall) { - m_settings->set("JavaPath", ui->javaPathTextBox->text()); - m_settings->set("IgnoreJavaCompatibility", ui->skipCompatibilityCheckbox->isChecked()); - } else { - m_settings->reset("JavaPath"); - m_settings->reset("IgnoreJavaCompatibility"); - } - - // Java arguments - bool javaArgs = ui->javaArgumentsGroupBox->isChecked(); - m_settings->set("OverrideJavaArgs", javaArgs); - if (javaArgs) { - m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " ")); - } else { - m_settings->reset("JvmArgs"); - } - - // Custom Commands - bool custcmd = ui->customCommands->checked(); - m_settings->set("OverrideCommands", custcmd); - if (custcmd) { - m_settings->set("PreLaunchCommand", ui->customCommands->prelaunchCommand()); - m_settings->set("WrapperCommand", ui->customCommands->wrapperCommand()); - m_settings->set("PostExitCommand", ui->customCommands->postexitCommand()); - } else { - m_settings->reset("PreLaunchCommand"); - m_settings->reset("WrapperCommand"); - m_settings->reset("PostExitCommand"); - } - - // Environment Variables - auto env = ui->environmentVariables->override(); - m_settings->set("OverrideEnv", env); - if (env) - m_settings->set("Env", ui->environmentVariables->value()); - else - m_settings->reset("Env"); - - // Workarounds - bool workarounds = ui->nativeWorkaroundsGroupBox->isChecked(); - m_settings->set("OverrideNativeWorkarounds", workarounds); - if (workarounds) { - m_settings->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked()); - m_settings->set("CustomGLFWPath", ui->lineEditGLFWPath->text()); - m_settings->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); - m_settings->set("CustomOpenALPath", ui->lineEditOpenALPath->text()); - } else { - m_settings->reset("UseNativeGLFW"); - m_settings->reset("CustomGLFWPath"); - m_settings->reset("UseNativeOpenAL"); - m_settings->reset("CustomOpenALPath"); - } - - // Performance - bool performance = ui->perfomanceGroupBox->isChecked(); - m_settings->set("OverridePerformance", performance); - if (performance) { - m_settings->set("EnableFeralGamemode", ui->enableFeralGamemodeCheck->isChecked()); - m_settings->set("EnableMangoHud", ui->enableMangoHud->isChecked()); - m_settings->set("UseDiscreteGpu", ui->useDiscreteGpuCheck->isChecked()); - m_settings->set("UseZink", ui->useZink->isChecked()); - - } else { - m_settings->reset("EnableFeralGamemode"); - m_settings->reset("EnableMangoHud"); - m_settings->reset("UseDiscreteGpu"); - m_settings->reset("UseZink"); - } - - // Game time - bool gameTime = ui->gameTimeGroupBox->isChecked(); - m_settings->set("OverrideGameTime", gameTime); - if (gameTime) { - m_settings->set("ShowGameTime", ui->showGameTime->isChecked()); - m_settings->set("RecordGameTime", ui->recordGameTime->isChecked()); - } else { - m_settings->reset("ShowGameTime"); - m_settings->reset("RecordGameTime"); - } - - // Join server on launch - bool joinServerOnLaunch = ui->serverJoinGroupBox->isChecked(); - m_settings->set("JoinServerOnLaunch", joinServerOnLaunch); - if (joinServerOnLaunch) { - if (ui->serverJoinAddressButton->isChecked() || !m_world_quickplay_supported) { - m_settings->set("JoinServerOnLaunchAddress", ui->serverJoinAddress->text()); - m_settings->reset("JoinWorldOnLaunch"); - } else { - m_settings->set("JoinWorldOnLaunch", ui->worldsCb->currentText()); - m_settings->reset("JoinServerOnLaunchAddress"); - } - } else { - m_settings->reset("JoinServerOnLaunchAddress"); - m_settings->reset("JoinWorldOnLaunch"); - } - - // Use an account for this instance - bool useAccountForInstance = ui->instanceAccountGroupBox->isChecked(); - m_settings->set("UseAccountForInstance", useAccountForInstance); - if (!useAccountForInstance) { - m_settings->reset("InstanceAccountId"); - } - - bool overrideLegacySettings = ui->legacySettingsGroupBox->isChecked(); - m_settings->set("OverrideLegacySettings", overrideLegacySettings); - if (overrideLegacySettings) { - m_settings->set("OnlineFixes", ui->onlineFixes->isChecked()); - } else { - m_settings->reset("OnlineFixes"); - } - - // FIXME: This should probably be called by a signal instead - m_instance->updateRuntimeContext(); -} - -void InstanceSettingsPage::loadSettings() -{ - // Miscellaneous - ui->miscellaneousSettingsBox->setChecked(m_settings->get("OverrideMiscellaneous").toBool()); - ui->closeAfterLaunchCheck->setChecked(m_settings->get("CloseAfterLaunch").toBool()); - ui->quitAfterGameStopCheck->setChecked(m_settings->get("QuitAfterGameStop").toBool()); - - // Console - ui->consoleSettingsBox->setChecked(m_settings->get("OverrideConsole").toBool()); - ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool()); - ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool()); - ui->showConsoleErrorCheck->setChecked(m_settings->get("ShowConsoleOnError").toBool()); - - // Window Size - ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool()); - ui->maximizedCheckBox->setChecked(m_settings->get("LaunchMaximized").toBool()); - ui->maximizedWarning->setVisible(m_settings->get("LaunchMaximized").toBool() && !m_instance->isLegacy()); - ui->windowWidthSpinBox->setValue(m_settings->get("MinecraftWinWidth").toInt()); - ui->windowHeightSpinBox->setValue(m_settings->get("MinecraftWinHeight").toInt()); - - // Memory - ui->memoryGroupBox->setChecked(m_settings->get("OverrideMemory").toBool()); - int min = m_settings->get("MinMemAlloc").toInt(); - int max = m_settings->get("MaxMemAlloc").toInt(); - if (min < max) { - ui->minMemSpinBox->setValue(min); - ui->maxMemSpinBox->setValue(max); - } else { - ui->minMemSpinBox->setValue(max); - ui->maxMemSpinBox->setValue(min); - } - ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt()); - bool permGenVisible = m_settings->get("PermGenVisible").toBool(); - ui->permGenSpinBox->setVisible(permGenVisible); - ui->labelPermGen->setVisible(permGenVisible); - ui->labelPermgenNote->setVisible(permGenVisible); - - // Java Settings - bool overrideLocation = m_settings->get("OverrideJavaLocation").toBool(); - bool overrideArgs = m_settings->get("OverrideJavaArgs").toBool(); - - connect(m_settings->getSetting("OverrideJavaLocation").get(), &Setting::SettingChanged, ui->javaSettingsGroupBox, - [this] { ui->javaSettingsGroupBox->setChecked(m_settings->get("OverrideJavaLocation").toBool()); }); - ui->javaSettingsGroupBox->setChecked(overrideLocation); - ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString()); - connect(m_settings->getSetting("JavaPath").get(), &Setting::SettingChanged, ui->javaSettingsGroupBox, - [this] { ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString()); }); - - ui->skipCompatibilityCheckbox->setChecked(m_settings->get("IgnoreJavaCompatibility").toBool()); - - ui->javaArgumentsGroupBox->setChecked(overrideArgs); - ui->jvmArgsTextBox->setPlainText(m_settings->get("JvmArgs").toString()); - - // Custom commands - ui->customCommands->initialize(true, m_settings->get("OverrideCommands").toBool(), m_settings->get("PreLaunchCommand").toString(), - m_settings->get("WrapperCommand").toString(), m_settings->get("PostExitCommand").toString()); - - // Environment variables - ui->environmentVariables->initialize(true, m_settings->get("OverrideEnv").toBool(), m_settings->get("Env").toMap()); - - // Workarounds - ui->nativeWorkaroundsGroupBox->setChecked(m_settings->get("OverrideNativeWorkarounds").toBool()); - ui->useNativeGLFWCheck->setChecked(m_settings->get("UseNativeGLFW").toBool()); - ui->lineEditGLFWPath->setText(m_settings->get("CustomGLFWPath").toString()); -#ifdef Q_OS_LINUX - ui->lineEditGLFWPath->setPlaceholderText(APPLICATION->m_detectedGLFWPath); -#else - ui->lineEditGLFWPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.GLFW_LIBRARY_NAME)); -#endif - ui->useNativeOpenALCheck->setChecked(m_settings->get("UseNativeOpenAL").toBool()); - ui->lineEditOpenALPath->setText(m_settings->get("CustomOpenALPath").toString()); -#ifdef Q_OS_LINUX - ui->lineEditOpenALPath->setPlaceholderText(APPLICATION->m_detectedOpenALPath); -#else - ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME)); -#endif - - // Performance - ui->perfomanceGroupBox->setChecked(m_settings->get("OverridePerformance").toBool()); - ui->enableFeralGamemodeCheck->setChecked(m_settings->get("EnableFeralGamemode").toBool()); - ui->enableMangoHud->setChecked(m_settings->get("EnableMangoHud").toBool()); - ui->useDiscreteGpuCheck->setChecked(m_settings->get("UseDiscreteGpu").toBool()); - ui->useZink->setChecked(m_settings->get("UseZink").toBool()); - -#if !defined(Q_OS_LINUX) - ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false); -#endif - - if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { - ui->enableFeralGamemodeCheck->setDisabled(true); - ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system.")); - } - - if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) { - ui->enableMangoHud->setDisabled(true); - ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system.")); - } - - // Miscellanous - ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool()); - ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool()); - ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool()); - - ui->serverJoinGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool()); - - if (auto server = m_settings->get("JoinServerOnLaunchAddress").toString(); !server.isEmpty()) { - ui->serverJoinAddress->setText(server); - ui->serverJoinAddressButton->setChecked(true); - ui->worldJoinButton->setChecked(false); - ui->serverJoinAddress->setEnabled(true); - ui->worldsCb->setEnabled(false); - } else if (auto world = m_settings->get("JoinWorldOnLaunch").toString(); !world.isEmpty() && m_world_quickplay_supported) { - ui->worldsCb->setCurrentText(world); - ui->serverJoinAddressButton->setChecked(false); - ui->worldJoinButton->setChecked(true); - ui->serverJoinAddress->setEnabled(false); - ui->worldsCb->setEnabled(true); - } else { - ui->serverJoinAddressButton->setChecked(true); - ui->worldJoinButton->setChecked(false); - ui->serverJoinAddress->setEnabled(true); - ui->worldsCb->setEnabled(false); - } - - ui->instanceAccountGroupBox->setChecked(m_settings->get("UseAccountForInstance").toBool()); - updateAccountsMenu(); - - ui->legacySettingsGroupBox->setChecked(m_settings->get("OverrideLegacySettings").toBool()); - ui->onlineFixes->setChecked(m_settings->get("OnlineFixes").toBool()); -} - -void InstanceSettingsPage::on_javaDownloadBtn_clicked() -{ - auto jdialog = new Java::InstallDialog({}, m_instance, this); - jdialog->exec(); -} - -void InstanceSettingsPage::on_javaDetectBtn_clicked() -{ - if (JavaUtils::getJavaCheckPath().isEmpty()) { - JavaCommon::javaCheckNotFound(this); - return; - } - - JavaInstallPtr java; - - VersionSelectDialog vselect(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); - vselect.setResizeOn(2); - vselect.exec(); - - if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) { - java = std::dynamic_pointer_cast(vselect.selectedVersion()); - ui->javaPathTextBox->setText(java->path); - bool visible = java->id.requiresPermGen() && m_settings->get("OverrideMemory").toBool(); - ui->permGenSpinBox->setVisible(visible); - ui->labelPermGen->setVisible(visible); - ui->labelPermgenNote->setVisible(visible); - m_settings->set("PermGenVisible", visible); - - if (!java->is_64bit && m_settings->get("MaxMemAlloc").toInt() > 2048) { - CustomMessageBox::selectable(this, tr("Confirm Selection"), - tr("You selected a 32-bit version of Java.\n" - "This installation does not support more than 2048MiB of RAM.\n" - "Please make sure that the maximum memory value is lower."), - QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok) - ->exec(); - } - } -} - -void InstanceSettingsPage::on_javaBrowseBtn_clicked() -{ - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable")); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if (raw_path.isEmpty()) { - return; - } - QString cooked_path = FS::NormalizePath(raw_path); - - QFileInfo javaInfo(cooked_path); - if (!javaInfo.exists() || !javaInfo.isExecutable()) { - return; - } - ui->javaPathTextBox->setText(cooked_path); - - // custom Java could be anything... enable perm gen option - ui->permGenSpinBox->setVisible(true); - ui->labelPermGen->setVisible(true); - ui->labelPermgenNote->setVisible(true); - m_settings->set("PermGenVisible", true); -} - -void InstanceSettingsPage::on_javaTestBtn_clicked() -{ - if (checker) { - return; - } - checker.reset(new JavaCommon::TestCheck(this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->toPlainText().replace("\n", " "), - ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value())); - connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished())); - checker->run(); -} - -void InstanceSettingsPage::onUseNativeGLFWChanged(bool checked) -{ - ui->lineEditGLFWPath->setEnabled(checked); -} - -void InstanceSettingsPage::onUseNativeOpenALChanged(bool checked) -{ - ui->lineEditOpenALPath->setEnabled(checked); -} - -void InstanceSettingsPage::updateAccountsMenu() -{ - ui->instanceAccountSelector->clear(); - auto accounts = APPLICATION->accounts(); - int accountIndex = accounts->findAccountByProfileId(m_settings->get("InstanceAccountId").toString()); - - for (int i = 0; i < accounts->count(); i++) { - MinecraftAccountPtr account = accounts->at(i); - ui->instanceAccountSelector->addItem(getFaceForAccount(account), account->profileName(), i); - if (i == accountIndex) - ui->instanceAccountSelector->setCurrentIndex(i); - } -} - -QIcon InstanceSettingsPage::getFaceForAccount(MinecraftAccountPtr account) -{ - if (auto face = account->getFace(); !face.isNull()) { - return face; - } - - return APPLICATION->getThemedIcon("noaccount"); -} - -void InstanceSettingsPage::changeInstanceAccount(int index) -{ - auto accounts = APPLICATION->accounts(); - if (index != -1 && accounts->at(index) && ui->instanceAccountGroupBox->isChecked()) { - auto account = accounts->at(index); - m_settings->set("InstanceAccountId", account->profileId()); - } -} - -void InstanceSettingsPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i) -{ - updateThresholds(); -} - -void InstanceSettingsPage::checkerFinished() -{ - checker.reset(); -} - -void InstanceSettingsPage::retranslate() -{ - ui->retranslateUi(this); - ui->customCommands->retranslate(); // TODO: why is this seperate from the others? - ui->environmentVariables->retranslate(); -} - -void InstanceSettingsPage::updateThresholds() -{ - auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; - unsigned int maxMem = ui->maxMemSpinBox->value(); - unsigned int minMem = ui->minMemSpinBox->value(); - - QString iconName; - - if (maxMem >= sysMiB) { - iconName = "status-bad"; - ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity.")); - } else if (maxMem > (sysMiB * 0.9)) { - iconName = "status-yellow"; - ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity.")); - } else if (maxMem < minMem) { - iconName = "status-yellow"; - ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value")); - } else { - iconName = "status-good"; - ui->labelMaxMemIcon->setToolTip(""); - } - - { - auto height = ui->labelMaxMemIcon->fontInfo().pixelSize(); - QIcon icon = APPLICATION->getThemedIcon(iconName); - QPixmap pix = icon.pixmap(height, height); - ui->labelMaxMemIcon->setPixmap(pix); - } -} - -void InstanceSettingsPage::on_serverJoinAddressButton_toggled(bool checked) -{ - ui->serverJoinAddress->setEnabled(checked); -} - -void InstanceSettingsPage::on_worldJoinButton_toggled(bool checked) -{ - ui->worldsCb->setEnabled(checked); -} diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.h b/launcher/ui/pages/instance/InstanceSettingsPage.h index 6499f9e8f..b13dc572f 100644 --- a/launcher/ui/pages/instance/InstanceSettingsPage.h +++ b/launcher/ui/pages/instance/InstanceSettingsPage.h @@ -35,63 +35,29 @@ #pragma once +#include +#include +#include +#include #include -#include -#include -#include "Application.h" -#include "BaseInstance.h" -#include "JavaCommon.h" -#include "java/JavaChecker.h" -#include "ui/pages/BasePage.h" - -class JavaChecker; -namespace Ui { -class InstanceSettingsPage; -} - -class InstanceSettingsPage : public QWidget, public BasePage { +class InstanceSettingsPage : public MinecraftSettingsWidget, public BasePage { Q_OBJECT public: - explicit InstanceSettingsPage(BaseInstance* inst, QWidget* parent = 0); - virtual ~InstanceSettingsPage(); - virtual QString displayName() const override { return tr("Settings"); } - virtual QIcon icon() const override { return APPLICATION->getThemedIcon("instance-settings"); } - virtual QString id() const override { return "settings"; } - virtual bool apply() override; - virtual QString helpPage() const override { return "Instance-settings"; } - void retranslate() override; - - void updateThresholds(); - - private slots: - void on_javaDetectBtn_clicked(); - void on_javaTestBtn_clicked(); - void on_javaBrowseBtn_clicked(); - void on_javaDownloadBtn_clicked(); - void on_maxMemSpinBox_valueChanged(int i); - void on_serverJoinAddressButton_toggled(bool checked); - void on_worldJoinButton_toggled(bool checked); - - void onUseNativeGLFWChanged(bool checked); - void onUseNativeOpenALChanged(bool checked); - - void applySettings(); - void loadSettings(); - - void checkerFinished(); - - void globalSettingsButtonClicked(bool checked); - - void updateAccountsMenu(); - QIcon getFaceForAccount(MinecraftAccountPtr account); - void changeInstanceAccount(int index); - - private: - Ui::InstanceSettingsPage* ui; - BaseInstance* m_instance; - SettingsObjectPtr m_settings; - unique_qobject_ptr checker; - bool m_world_quickplay_supported; + explicit InstanceSettingsPage(InstancePtr instance, QWidget* parent = nullptr) : MinecraftSettingsWidget(std::move(instance), parent) + { + connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::saveSettings); + connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); + } + ~InstanceSettingsPage() override {} + QString displayName() const override { return tr("Settings"); } + QIcon icon() const override { return APPLICATION->getThemedIcon("instance-settings"); } + QString id() const override { return "settings"; } + bool apply() override + { + saveSettings(); + return true; + } + QString helpPage() const override { return "Instance-settings"; } }; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp new file mode 100644 index 000000000..32c99f03f --- /dev/null +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -0,0 +1,320 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (c) 2022 Jamie Mansfield + * Copyright (C) 2022 Sefa Eyeoglu + * Copyright (C) 2024 TheKodeToad + * + * 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 . + * + * 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 "MinecraftSettingsWidget.h" +#include + +#include "settings/Setting.h" +#include "ui_MinecraftSettingsWidget.h" + +MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* parent) + : QWidget(parent), m_instance(std::move(instance)), m_ui(new Ui::MinecraftSettingsWidget) +{ + m_ui->setupUi(this); + + if (m_instance == nullptr) { + // Java + m_ui->settingsTabs->removeTab(1); + // Launch + m_ui->settingsTabs->removeTab(2); + m_ui->openGlobalJavaSettingsButton->setVisible(false); + } else { + m_ui->showGameTime->setText(tr("Show time &playing this instance")); + m_ui->recordGameTime->setText(tr("&Record time playing this instance")); + m_ui->showGlobalGameTime->hide(); + m_ui->showGameTimeWithoutDays->hide(); + + m_ui->maximizedWarning->setText( + tr("Warning: The maximized option is " + "not fully supported on this Minecraft version.")); + } + + m_ui->maximizedWarning->hide(); + + connect(m_ui->maximizedCheckBox, &QCheckBox::toggled, this, + [this](const bool value) { m_ui->maximizedWarning->setVisible(value && (m_instance == nullptr || !m_instance->isLegacy())); }); + + loadSettings(); +} + +MinecraftSettingsWidget::~MinecraftSettingsWidget() +{ + delete m_ui; +} + +void MinecraftSettingsWidget::loadSettings() +{ + const SettingsObjectPtr settings = getSettings(); + + // Miscellaneous + m_ui->miscellaneousSettingsBox->setCheckable(m_instance != nullptr); + m_ui->miscellaneousSettingsBox->setChecked(settings->get("OverrideMiscellaneous").toBool()); + m_ui->closeAfterLaunchCheck->setChecked(settings->get("CloseAfterLaunch").toBool()); + m_ui->quitAfterGameStopCheck->setChecked(settings->get("QuitAfterGameStop").toBool()); + + // Console + m_ui->consoleSettingsBox->setCheckable(m_instance != nullptr); + m_ui->consoleSettingsBox->setChecked(m_instance == nullptr || settings->get("OverrideConsole").toBool()); + m_ui->showConsoleCheck->setChecked(settings->get("ShowConsole").toBool()); + m_ui->autoCloseConsoleCheck->setChecked(settings->get("AutoCloseConsole").toBool()); + m_ui->showConsoleErrorCheck->setChecked(settings->get("ShowConsoleOnError").toBool()); + + // Window Size + m_ui->windowSizeGroupBox->setCheckable(m_instance != nullptr); + m_ui->windowSizeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideWindow").toBool()); + m_ui->windowSizeGroupBox->setChecked(settings->get("OverrideWindow").toBool()); + m_ui->maximizedCheckBox->setChecked(settings->get("LaunchMaximized").toBool()); + m_ui->windowWidthSpinBox->setValue(settings->get("MinecraftWinWidth").toInt()); + m_ui->windowHeightSpinBox->setValue(settings->get("MinecraftWinHeight").toInt()); + + // Custom commands + m_ui->customCommands->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideCommands").toBool(), + settings->get("PreLaunchCommand").toString(), settings->get("WrapperCommand").toString(), + settings->get("PostExitCommand").toString()); + + // Environment variables + m_ui->environmentVariables->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideEnv").toBool(), + settings->get("Env").toMap()); + + // Workarounds + m_ui->nativeWorkaroundsGroupBox->setCheckable(m_instance != nullptr); + m_ui->nativeWorkaroundsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideNativeWorkarounds").toBool()); + m_ui->useNativeGLFWCheck->setChecked(settings->get("UseNativeGLFW").toBool()); + m_ui->lineEditGLFWPath->setText(settings->get("CustomGLFWPath").toString()); +#ifdef Q_OS_LINUX + m_ui->lineEditGLFWPath->setPlaceholderText(APPLICATION->m_detectedGLFWPath); +#else + m_ui->lineEditGLFWPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.GLFW_LIBRARY_NAME)); +#endif + m_ui->useNativeOpenALCheck->setChecked(settings->get("UseNativeOpenAL").toBool()); + m_ui->lineEditOpenALPath->setText(settings->get("CustomOpenALPath").toString()); +#ifdef Q_OS_LINUX + m_ui->lineEditOpenALPath->setPlaceholderText(APPLICATION->m_detectedOpenALPath); +#else + m_ui->lineEditOpenALPath->setPlaceholderText(tr("Path to %1 library file").arg(BuildConfig.OPENAL_LIBRARY_NAME)); +#endif + + // Performance + m_ui->perfomanceGroupBox->setCheckable(m_instance != nullptr); + m_ui->perfomanceGroupBox->setChecked(m_instance == nullptr || settings->get("OverridePerformance").toBool()); + m_ui->enableFeralGamemodeCheck->setChecked(settings->get("EnableFeralGamemode").toBool()); + m_ui->enableMangoHud->setChecked(settings->get("EnableMangoHud").toBool()); + m_ui->useDiscreteGpuCheck->setChecked(settings->get("UseDiscreteGpu").toBool()); + m_ui->useZink->setChecked(settings->get("UseZink").toBool()); + +#if !defined(Q_OS_LINUX) + m_ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false); +#endif + + if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { + m_ui->enableFeralGamemodeCheck->setDisabled(true); + m_ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system.")); + } + + if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) { + m_ui->enableMangoHud->setDisabled(true); + m_ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system.")); + } + + // Miscellanous + m_ui->gameTimeGroupBox->setCheckable(m_instance != nullptr); + m_ui->gameTimeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideGameTime").toBool()); + m_ui->showGameTime->setChecked(settings->get("ShowGameTime").toBool()); + m_ui->recordGameTime->setChecked(settings->get("RecordGameTime").toBool()); + m_ui->showGlobalGameTime->setChecked(m_instance != nullptr && settings->get("ShowGlobalGameTime").toBool()); + m_ui->showGameTimeWithoutDays->setChecked(m_instance != nullptr && settings->get("ShowGameTimeWithoutDays").toBool()); + + m_ui->legacySettingsGroupBox->setCheckable(m_instance != nullptr); + m_ui->legacySettingsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideLegacySettings").toBool()); + m_ui->onlineFixes->setChecked(settings->get("OnlineFixes").toBool()); +} + +void MinecraftSettingsWidget::saveSettings() +{ + SettingsObjectPtr settings = getSettings(); + SettingsObject::Lock lock(settings); + + // Miscellaneous + bool miscellaneous = m_instance == nullptr || m_ui->miscellaneousSettingsBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideMiscellaneous", miscellaneous); + + if (miscellaneous) { + settings->set("CloseAfterLaunch", m_ui->closeAfterLaunchCheck->isChecked()); + settings->set("QuitAfterGameStop", m_ui->quitAfterGameStopCheck->isChecked()); + } else { + settings->reset("CloseAfterLaunch"); + settings->reset("QuitAfterGameStop"); + } + + // Console + bool console = m_instance == nullptr || m_ui->consoleSettingsBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideConsole", console); + + if (console) { + settings->set("ShowConsole", m_ui->showConsoleCheck->isChecked()); + settings->set("AutoCloseConsole", m_ui->autoCloseConsoleCheck->isChecked()); + settings->set("ShowConsoleOnError", m_ui->showConsoleErrorCheck->isChecked()); + } else { + settings->reset("ShowConsole"); + settings->reset("AutoCloseConsole"); + settings->reset("ShowConsoleOnError"); + } + + // Window Size + bool window = m_instance == nullptr || m_ui->windowSizeGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideWindow", window); + + if (window) { + settings->set("LaunchMaximized", m_ui->maximizedCheckBox->isChecked()); + settings->set("MinecraftWinWidth", m_ui->windowWidthSpinBox->value()); + settings->set("MinecraftWinHeight", m_ui->windowHeightSpinBox->value()); + } else { + settings->reset("LaunchMaximized"); + settings->reset("MinecraftWinWidth"); + settings->reset("MinecraftWinHeight"); + } + + // Custom Commands + bool custcmd = m_instance == nullptr || m_ui->customCommands->checked(); + + if (m_instance != nullptr) + settings->set("OverrideCommands", custcmd); + + if (custcmd) { + settings->set("PreLaunchCommand", m_ui->customCommands->prelaunchCommand()); + settings->set("WrapperCommand", m_ui->customCommands->wrapperCommand()); + settings->set("PostExitCommand", m_ui->customCommands->postexitCommand()); + } else { + settings->reset("PreLaunchCommand"); + settings->reset("WrapperCommand"); + settings->reset("PostExitCommand"); + } + + // Environment Variables + auto env = m_instance == nullptr || m_ui->environmentVariables->override(); + + if (m_instance != nullptr) + settings->set("OverrideEnv", env); + + if (env) + settings->set("Env", m_ui->environmentVariables->value()); + else + settings->reset("Env"); + + // Workarounds + bool workarounds = m_instance == nullptr || m_ui->nativeWorkaroundsGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideNativeWorkarounds", workarounds); + + if (workarounds) { + settings->set("UseNativeGLFW", m_ui->useNativeGLFWCheck->isChecked()); + settings->set("CustomGLFWPath", m_ui->lineEditGLFWPath->text()); + settings->set("UseNativeOpenAL", m_ui->useNativeOpenALCheck->isChecked()); + settings->set("CustomOpenALPath", m_ui->lineEditOpenALPath->text()); + } else { + settings->reset("UseNativeGLFW"); + settings->reset("CustomGLFWPath"); + settings->reset("UseNativeOpenAL"); + settings->reset("CustomOpenALPath"); + } + + // Performance + bool performance = m_instance == nullptr || m_ui->perfomanceGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverridePerformance", performance); + + if (performance) { + settings->set("EnableFeralGamemode", m_ui->enableFeralGamemodeCheck->isChecked()); + settings->set("EnableMangoHud", m_ui->enableMangoHud->isChecked()); + settings->set("UseDiscreteGpu", m_ui->useDiscreteGpuCheck->isChecked()); + settings->set("UseZink", m_ui->useZink->isChecked()); + } else { + settings->reset("EnableFeralGamemode"); + settings->reset("EnableMangoHud"); + settings->reset("UseDiscreteGpu"); + settings->reset("UseZink"); + } + + // Game time + bool gameTime = m_instance == nullptr || m_ui->gameTimeGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideGameTime", gameTime); + + if (gameTime) { + settings->set("ShowGameTime", m_ui->showGameTime->isChecked()); + settings->set("RecordGameTime", m_ui->recordGameTime->isChecked()); + } else { + settings->reset("ShowGameTime"); + settings->reset("RecordGameTime"); + } + + if (m_instance == nullptr) { + settings->set("ShowGlobalGameTime", m_ui->showGlobalGameTime->isChecked()); + settings->set("ShowGameTimeWithoutDays", m_ui->showGameTimeWithoutDays->isChecked()); + } + + bool overrideLegacySettings = m_instance == nullptr || m_ui->legacySettingsGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideLegacySettings", overrideLegacySettings); + + if (overrideLegacySettings) { + settings->set("OnlineFixes", m_ui->onlineFixes->isChecked()); + } else { + settings->reset("OnlineFixes"); + } + + if (m_instance != nullptr) + m_instance->updateRuntimeContext(); +} + +SettingsObjectPtr MinecraftSettingsWidget::getSettings() const +{ + if (m_instance != nullptr) + return m_instance->settings(); + + return APPLICATION->settings(); +} diff --git a/launcher/ui/pages/global/CustomCommandsPage.h b/launcher/ui/widgets/MinecraftSettingsWidget.h similarity index 69% rename from launcher/ui/pages/global/CustomCommandsPage.h rename to launcher/ui/widgets/MinecraftSettingsWidget.h index ec1204ffe..3a4bf30a5 100644 --- a/launcher/ui/pages/global/CustomCommandsPage.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -2,6 +2,7 @@ /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 Jamie Mansfield + * Copyright (C) 2024 TheKodeToad * * 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 @@ -35,29 +36,24 @@ #pragma once -#include -#include +#include +#include -#include -#include "ui/pages/BasePage.h" -#include "ui/widgets/CustomCommands.h" - -class CustomCommandsPage : public QWidget, public BasePage { - Q_OBJECT +namespace Ui { +class MinecraftSettingsWidget; +} +class MinecraftSettingsWidget : public QWidget { public: - explicit CustomCommandsPage(QWidget* parent = 0); - ~CustomCommandsPage(); + MinecraftSettingsWidget(InstancePtr instance, QWidget* parent = nullptr); + ~MinecraftSettingsWidget() override; - QString displayName() const override { return tr("Custom Commands"); } - QIcon icon() const override { return APPLICATION->getThemedIcon("custom-commands"); } - QString id() const override { return "custom-commands"; } - QString helpPage() const override { return "Custom-commands"; } - bool apply() override; - void retranslate() override; + void loadSettings(); + void saveSettings(); private: - void applySettings(); - void loadSettings(); - CustomCommands* commands; + SettingsObjectPtr getSettings() const; + + InstancePtr m_instance; + Ui::MinecraftSettingsWidget* m_ui; }; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui new file mode 100644 index 000000000..a70d2418e --- /dev/null +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -0,0 +1,876 @@ + + + MinecraftSettingsWidget + + + + 0 + 0 + 648 + 400 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Open &Global Settings + + + The settings here are overrides for global settings. + + + + + + + 0 + + + + General + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + -131 + 610 + 607 + + + + + + + true + + + Game &Window + + + false + + + false + + + + + + Start Minecraft maximized + + + + + + + The base game only supports resolution. In order to simulate the maximized behaviour the current implementation approximates the maximum display size. + + + <html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: The maximized option may not be fully supported on all Minecraft versions.</span></p></body></html> + + + + + + + + + Window height: + + + + + + + Window width: + + + + + + + 1 + + + 65536 + + + 1 + + + 854 + + + + + + + 1 + + + 65536 + + + 480 + + + + + + + + + + + + true + + + Game &Time + + + false + + + false + + + + + + Show time spent &playing instances + + + + + + + &Record time spent playing instances + + + + + + + Show &total of time played across instances + + + + + + + Always show durations in &hours + + + + + + + + + + true + + + &Console + + + false + + + false + + + + + + Show console while the game is running + + + + + + + Automatically close console when the game quits + + + + + + + Show console when the game crashes + + + + + + + + + + &Miscellaneous + + + false + + + false + + + + + + Close the launcher after game window opens + + + + + + + Quit the launcher after game window closes + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Java + + + + + + true + + + + + 0 + 0 + 610 + 454 + + + + + + + true + + + Java Insta&llation + + + true + + + false + + + + + + If enabled, the launcher will not check if an instance is compatible with the selected Java version. + + + Skip Java compatibility checks + + + + + + + + + + + + Browse + + + + + + + + + + + Download Java + + + + + + + Auto-detect... + + + + + + + Test + + + + + + + + + + + + true + + + Memor&y + + + true + + + false + + + + + + PermGen: + + + + + + + Minimum memory allocation: + + + + + + + Maximum memory allocation: + + + + + + + Note: Permgen is set automatically by Java 8 and later + + + + + + + The amount of memory Minecraft is started with. + + + MiB + + + 8 + + + 1048576 + + + 128 + + + 256 + + + + + + + The maximum amount of memory Minecraft is allowed to use. + + + MiB + + + 8 + + + 1048576 + + + 128 + + + 1024 + + + + + + + The amount of memory available to store loaded Java classes. + + + MiB + + + 4 + + + 999999999 + + + 8 + + + 64 + + + + + + + + + + Qt::AlignCenter + + + maxMemSpinBox + + + + + + + + + + true + + + Java Argumen&ts + + + true + + + false + + + + + + + + + + + + + + + + + Tweaks + + + + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 610 + 439 + + + + + + + &Legacy Tweaks + + + false + + + false + + + + + + <html><head/><body><p>Emulates usages of old online services which are no longer operating.</p><p>Current fixes include: skin and online mode support.</p></body></html> + + + Enable online fixes (experimental) + + + + + + + + + + true + + + &Native Libraries + + + false + + + false + + + + + + Use system installation of OpenAL + + + + + + + &GLFW library path + + + lineEditGLFWPath + + + + + + + Use system installation of GLFW + + + + + + + false + + + + + + + &OpenAL library path + + + lineEditOpenALPath + + + + + + + false + + + + + + + + + + true + + + &Performance + + + true + + + false + + + + + + <html><head/><body><p>Enable Feral Interactive's GameMode, to potentially improve gaming performance.</p></body></html> + + + Enable Feral GameMode + + + + + + + <html><head/><body><p>Enable MangoHud's advanced performance overlay.</p></body></html> + + + Enable MangoHud + + + + + + + <html><head/><body><p>Use the discrete GPU instead of the primary GPU.</p></body></html> + + + Use discrete GPU + + + + + + + Use Zink, a Mesa OpenGL driver that implements OpenGL on top of Vulkan. Performance may vary depending on the situation. Note: If no suitable Vulkan driver is found, software rendering will be used. + + + Use Zink + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Launch + + + + + + true + + + + + 0 + 0 + 624 + 291 + + + + + + + Override default &account + + + true + + + false + + + + + + + + + 0 + 0 + + + + Account: + + + + + + + + + + + + + + + Set a &target to join on launch + + + true + + + false + + + + + + Server address: + + + + + + + + + + Singleplayer world + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Custom Commands + + + + + + + + + + Environment Variables + + + + + + + + + + + + + + CustomCommands + QWidget +
ui/widgets/CustomCommands.h
+ 1 +
+ + EnvironmentVariables + QWidget +
ui/widgets/EnvironmentVariables.h
+ 1 +
+
+ + maximizedCheckBox + windowWidthSpinBox + windowHeightSpinBox + showConsoleCheck + autoCloseConsoleCheck + showConsoleErrorCheck + useNativeGLFWCheck + useNativeOpenALCheck + closeAfterLaunchCheck + quitAfterGameStopCheck + + + +
From 223b6b3b2b4b5ffa943c8185b7718d61835333e2 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 7 Nov 2024 00:22:22 +0000 Subject: [PATCH 019/102] Fix non-Linux build Signed-off-by: TheKodeToad --- launcher/ui/widgets/MinecraftSettingsWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index 32c99f03f..79ff4c060 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -137,7 +137,7 @@ void MinecraftSettingsWidget::loadSettings() m_ui->useZink->setChecked(settings->get("UseZink").toBool()); #if !defined(Q_OS_LINUX) - m_ui->settingsTabs->setTabVisible(ui->settingsTabs->indexOf(ui->performancePage), false); + m_ui->perfomanceGroupBox->hide(); #endif if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { From e06b3e7a7aba613fc054b63edf4ff0c0df3f7828 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 7 Nov 2024 00:47:32 +0000 Subject: [PATCH 020/102] Implement open global settings Signed-off-by: TheKodeToad --- launcher/Application.cpp | 9 +++++--- .../ui/widgets/MinecraftSettingsWidget.cpp | 22 ++++++++++++++----- launcher/ui/widgets/MinecraftSettingsWidget.h | 2 ++ .../ui/widgets/MinecraftSettingsWidget.ui | 4 ++-- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index c45bb1c8c..de60f86eb 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -972,7 +972,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) [[fallthrough]]; default: { qDebug() << "Exiting because update lockfile is present"; - QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection); + QMetaObject::invokeMethod( + this, []() { exit(1); }, Qt::QueuedConnection); return; } } @@ -1004,7 +1005,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) [[fallthrough]]; default: { qDebug() << "Exiting because update lockfile is present"; - QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection); + QMetaObject::invokeMethod( + this, []() { exit(1); }, Qt::QueuedConnection); return; } } @@ -1734,7 +1736,8 @@ QString Application::getJarPath(QString jarFile) #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) FS::PathCombine(m_rootPath, "share", BuildConfig.LAUNCHER_NAME), #endif - FS::PathCombine(m_rootPath, "jars"), FS::PathCombine(applicationDirPath(), "jars"), + FS::PathCombine(m_rootPath, "jars"), + FS::PathCombine(applicationDirPath(), "jars"), FS::PathCombine(applicationDirPath(), "..", "jars") // from inside build dir, for debuging }; for (QString p : potentialPaths) { diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index 79ff4c060..cfe7a49c1 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -51,7 +51,7 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* m_ui->settingsTabs->removeTab(1); // Launch m_ui->settingsTabs->removeTab(2); - m_ui->openGlobalJavaSettingsButton->setVisible(false); + m_ui->openGlobalSettingsButton->setVisible(false); } else { m_ui->showGameTime->setText(tr("Show time &playing this instance")); m_ui->recordGameTime->setText(tr("&Record time playing this instance")); @@ -61,6 +61,8 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* m_ui->maximizedWarning->setText( tr("Warning: The maximized option is " "not fully supported on this Minecraft version.")); + + connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings); } m_ui->maximizedWarning->hide(); @@ -68,6 +70,10 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* connect(m_ui->maximizedCheckBox, &QCheckBox::toggled, this, [this](const bool value) { m_ui->maximizedWarning->setVisible(value && (m_instance == nullptr || !m_instance->isLegacy())); }); +#if !defined(Q_OS_LINUX) + m_ui->perfomanceGroupBox->hide(); +#endif + loadSettings(); } @@ -136,10 +142,6 @@ void MinecraftSettingsWidget::loadSettings() m_ui->useDiscreteGpuCheck->setChecked(settings->get("UseDiscreteGpu").toBool()); m_ui->useZink->setChecked(settings->get("UseZink").toBool()); -#if !defined(Q_OS_LINUX) - m_ui->perfomanceGroupBox->hide(); -#endif - if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { m_ui->enableFeralGamemodeCheck->setDisabled(true); m_ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system.")); @@ -311,6 +313,16 @@ void MinecraftSettingsWidget::saveSettings() m_instance->updateRuntimeContext(); } +void MinecraftSettingsWidget::openGlobalSettings() +{ + const QString id = m_ui->settingsTabs->currentWidget()->objectName(); + + if (id == "javaPage") + APPLICATION->ShowGlobalSettings(this, "java-settings"); + else // TODO select tab + APPLICATION->ShowGlobalSettings(this, "minecraft-settings"); +} + SettingsObjectPtr MinecraftSettingsWidget::getSettings() const { if (m_instance != nullptr) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.h b/launcher/ui/widgets/MinecraftSettingsWidget.h index 3a4bf30a5..a76ff647a 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -51,6 +51,8 @@ class MinecraftSettingsWidget : public QWidget { void loadSettings(); void saveSettings(); + void openGlobalSettings(); + private: SettingsObjectPtr getSettings() const; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index a70d2418e..d86fe20f4 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -24,7 +24,7 @@ 0 - + Open &Global Settings @@ -61,7 +61,7 @@ 0 - -131 + 0 610 607 From 8132828ad7f6f53513d8c3012c3110e1f583050f Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 7 Nov 2024 13:36:30 +0000 Subject: [PATCH 021/102] Phrasing fix Signed-off-by: TheKodeToad --- launcher/ui/widgets/MinecraftSettingsWidget.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index d86fe20f4..6b93f55bb 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -181,7 +181,7 @@ - Show &total of time played across instances + Show the &total time played across instances From 012bbca197b64a22e4b7befd001414283f300712 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 7 Nov 2024 14:51:43 +0000 Subject: [PATCH 022/102] JavaSettingsWidget -> JavaWizardWidget Signed-off-by: TheKodeToad --- launcher/CMakeLists.txt | 4 +- launcher/ui/setupwizard/JavaWizardPage.cpp | 10 +- launcher/ui/setupwizard/JavaWizardPage.h | 4 +- ...ettingsWidget.cpp => JavaWizardWidget.cpp} | 68 ++--- ...avaSettingsWidget.h => JavaWizardWidget.h} | 6 +- .../ui/widgets/MinecraftSettingsWidget.ui | 239 ------------------ 6 files changed, 46 insertions(+), 285 deletions(-) rename launcher/ui/widgets/{JavaSettingsWidget.cpp => JavaWizardWidget.cpp} (91%) rename launcher/ui/widgets/{JavaSettingsWidget.h => JavaWizardWidget.h} (95%) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 7a23b2300..28d184501 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1085,8 +1085,8 @@ SET(LAUNCHER_SOURCES ui/widgets/FocusLineEdit.h ui/widgets/IconLabel.cpp ui/widgets/IconLabel.h - ui/widgets/JavaSettingsWidget.cpp - ui/widgets/JavaSettingsWidget.h + ui/widgets/JavaWizardWidget.cpp + ui/widgets/JavaWizardWidget.h ui/widgets/LabeledToolButton.cpp ui/widgets/LabeledToolButton.h ui/widgets/LanguageSelectionWidget.cpp diff --git a/launcher/ui/setupwizard/JavaWizardPage.cpp b/launcher/ui/setupwizard/JavaWizardPage.cpp index 8caae173c..6b8ece9f7 100644 --- a/launcher/ui/setupwizard/JavaWizardPage.cpp +++ b/launcher/ui/setupwizard/JavaWizardPage.cpp @@ -14,7 +14,7 @@ #include "JavaCommon.h" -#include "ui/widgets/JavaSettingsWidget.h" +#include "ui/widgets/JavaWizardWidget.h" #include "ui/widgets/VersionSelectWidget.h" JavaWizardPage::JavaWizardPage(QWidget* parent) : BaseWizardPage(parent) @@ -27,7 +27,7 @@ void JavaWizardPage::setupUi() setObjectName(QStringLiteral("javaPage")); QVBoxLayout* layout = new QVBoxLayout(this); - m_java_widget = new JavaSettingsWidget(this); + m_java_widget = new JavaWizardWidget(this); layout->addWidget(m_java_widget); setLayout(layout); @@ -58,13 +58,13 @@ bool JavaWizardPage::validatePage() settings->set("UserAskedAboutAutomaticJavaDownload", true); switch (result) { default: - case JavaSettingsWidget::ValidationStatus::Bad: { + case JavaWizardWidget::ValidationStatus::Bad: { return false; } - case JavaSettingsWidget::ValidationStatus::AllOK: { + case JavaWizardWidget::ValidationStatus::AllOK: { settings->set("JavaPath", m_java_widget->javaPath()); } /* fallthrough */ - case JavaSettingsWidget::ValidationStatus::JavaBad: { + case JavaWizardWidget::ValidationStatus::JavaBad: { // Memory auto s = APPLICATION->settings(); s->set("MinMemAlloc", m_java_widget->minHeapSize()); diff --git a/launcher/ui/setupwizard/JavaWizardPage.h b/launcher/ui/setupwizard/JavaWizardPage.h index 9bf9cfa2b..914630d0b 100644 --- a/launcher/ui/setupwizard/JavaWizardPage.h +++ b/launcher/ui/setupwizard/JavaWizardPage.h @@ -2,7 +2,7 @@ #include "BaseWizardPage.h" -class JavaSettingsWidget; +class JavaWizardWidget; class JavaWizardPage : public BaseWizardPage { Q_OBJECT @@ -21,5 +21,5 @@ class JavaWizardPage : public BaseWizardPage { void retranslate() override; private: /* data */ - JavaSettingsWidget* m_java_widget = nullptr; + JavaWizardWidget* m_java_widget = nullptr; }; diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaWizardWidget.cpp similarity index 91% rename from launcher/ui/widgets/JavaSettingsWidget.cpp rename to launcher/ui/widgets/JavaWizardWidget.cpp index 2b270c482..edf49fab8 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaWizardWidget.cpp @@ -1,4 +1,4 @@ -#include "JavaSettingsWidget.h" +#include "JavaWizardWidget.h" #include #include @@ -29,7 +29,7 @@ #include "Application.h" #include "BuildConfig.h" -JavaSettingsWidget::JavaSettingsWidget(QWidget* parent) : QWidget(parent) +JavaWizardWidget::JavaWizardWidget(QWidget* parent) : QWidget(parent) { m_availableMemory = Sys::getSystemRam() / Sys::mebibyte; @@ -42,17 +42,17 @@ JavaSettingsWidget::JavaSettingsWidget(QWidget* parent) : QWidget(parent) connect(m_minMemSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onSpinBoxValueChanged(int))); connect(m_maxMemSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onSpinBoxValueChanged(int))); connect(m_permGenSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onSpinBoxValueChanged(int))); - connect(m_memoryTimer, &QTimer::timeout, this, &JavaSettingsWidget::memoryValueChanged); - connect(m_versionWidget, &VersionSelectWidget::selectedVersionChanged, this, &JavaSettingsWidget::javaVersionSelected); - connect(m_javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::on_javaBrowseBtn_clicked); - connect(m_javaPathTextBox, &QLineEdit::textEdited, this, &JavaSettingsWidget::javaPathEdited); - connect(m_javaStatusBtn, &QToolButton::clicked, this, &JavaSettingsWidget::on_javaStatusBtn_clicked); + connect(m_memoryTimer, &QTimer::timeout, this, &JavaWizardWidget::memoryValueChanged); + connect(m_versionWidget, &VersionSelectWidget::selectedVersionChanged, this, &JavaWizardWidget::javaVersionSelected); + connect(m_javaBrowseBtn, &QPushButton::clicked, this, &JavaWizardWidget::on_javaBrowseBtn_clicked); + connect(m_javaPathTextBox, &QLineEdit::textEdited, this, &JavaWizardWidget::javaPathEdited); + connect(m_javaStatusBtn, &QToolButton::clicked, this, &JavaWizardWidget::on_javaStatusBtn_clicked); if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { - connect(m_javaDownloadBtn, &QPushButton::clicked, this, &JavaSettingsWidget::javaDownloadBtn_clicked); + connect(m_javaDownloadBtn, &QPushButton::clicked, this, &JavaWizardWidget::javaDownloadBtn_clicked); } } -void JavaSettingsWidget::setupUi() +void JavaWizardWidget::setupUi() { setObjectName(QStringLiteral("javaSettingsWidget")); m_verticalLayout = new QVBoxLayout(this); @@ -183,7 +183,7 @@ void JavaSettingsWidget::setupUi() retranslate(); } -void JavaSettingsWidget::initialize() +void JavaWizardWidget::initialize() { m_versionWidget->initialize(APPLICATION->javalist().get()); m_versionWidget->selectSearch(); @@ -202,7 +202,7 @@ void JavaSettingsWidget::initialize() } } -void JavaSettingsWidget::refresh() +void JavaWizardWidget::refresh() { if (BuildConfig.JAVA_DOWNLOADER_ENABLED && m_autodownloadCheckBox->isChecked()) { return; @@ -214,7 +214,7 @@ void JavaSettingsWidget::refresh() m_versionWidget->loadList(); } -JavaSettingsWidget::ValidationStatus JavaSettingsWidget::validate() +JavaWizardWidget::ValidationStatus JavaWizardWidget::validate() { switch (javaStatus) { default: @@ -277,12 +277,12 @@ JavaSettingsWidget::ValidationStatus JavaSettingsWidget::validate() } } -QString JavaSettingsWidget::javaPath() const +QString JavaWizardWidget::javaPath() const { return m_javaPathTextBox->text(); } -int JavaSettingsWidget::maxHeapSize() const +int JavaWizardWidget::maxHeapSize() const { auto min = m_minMemSpinBox->value(); auto max = m_maxMemSpinBox->value(); @@ -291,7 +291,7 @@ int JavaSettingsWidget::maxHeapSize() const return max; } -int JavaSettingsWidget::minHeapSize() const +int JavaWizardWidget::minHeapSize() const { auto min = m_minMemSpinBox->value(); auto max = m_maxMemSpinBox->value(); @@ -300,17 +300,17 @@ int JavaSettingsWidget::minHeapSize() const return min; } -bool JavaSettingsWidget::permGenEnabled() const +bool JavaWizardWidget::permGenEnabled() const { return m_permGenSpinBox->isVisible(); } -int JavaSettingsWidget::permGenSize() const +int JavaWizardWidget::permGenSize() const { return m_permGenSpinBox->value(); } -void JavaSettingsWidget::memoryValueChanged() +void JavaWizardWidget::memoryValueChanged() { bool actuallyChanged = false; unsigned int min = m_minMemSpinBox->value(); @@ -334,7 +334,7 @@ void JavaSettingsWidget::memoryValueChanged() } } -void JavaSettingsWidget::javaVersionSelected(BaseVersion::Ptr version) +void JavaWizardWidget::javaVersionSelected(BaseVersion::Ptr version) { auto java = std::dynamic_pointer_cast(version); if (!java) { @@ -347,7 +347,7 @@ void JavaSettingsWidget::javaVersionSelected(BaseVersion::Ptr version) checkJavaPath(java->path); } -void JavaSettingsWidget::on_javaBrowseBtn_clicked() +void JavaWizardWidget::on_javaBrowseBtn_clicked() { auto filter = QString("Java (%1)").arg(JavaUtils::javaExecutable); auto raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"), QString(), filter); @@ -359,13 +359,13 @@ void JavaSettingsWidget::on_javaBrowseBtn_clicked() checkJavaPath(cooked_path); } -void JavaSettingsWidget::javaDownloadBtn_clicked() +void JavaWizardWidget::javaDownloadBtn_clicked() { auto jdialog = new Java::InstallDialog({}, nullptr, this); jdialog->exec(); } -void JavaSettingsWidget::on_javaStatusBtn_clicked() +void JavaWizardWidget::on_javaStatusBtn_clicked() { QString text; bool failed = false; @@ -412,7 +412,7 @@ void JavaSettingsWidget::on_javaStatusBtn_clicked() ->show(); } -void JavaSettingsWidget::setJavaStatus(JavaSettingsWidget::JavaStatus status) +void JavaWizardWidget::setJavaStatus(JavaWizardWidget::JavaStatus status) { javaStatus = status; switch (javaStatus) { @@ -429,12 +429,12 @@ void JavaSettingsWidget::setJavaStatus(JavaSettingsWidget::JavaStatus status) } } -void JavaSettingsWidget::javaPathEdited(const QString& path) +void JavaWizardWidget::javaPathEdited(const QString& path) { checkJavaPathOnEdit(path); } -void JavaSettingsWidget::checkJavaPathOnEdit(const QString& path) +void JavaWizardWidget::checkJavaPathOnEdit(const QString& path) { auto realPath = FS::ResolveExecutable(path); QFileInfo pathInfo(realPath); @@ -447,7 +447,7 @@ void JavaSettingsWidget::checkJavaPathOnEdit(const QString& path) } } -void JavaSettingsWidget::checkJavaPath(const QString& path) +void JavaWizardWidget::checkJavaPath(const QString& path) { if (m_checker) { queuedCheck = path; @@ -461,11 +461,11 @@ void JavaSettingsWidget::checkJavaPath(const QString& path) setJavaStatus(JavaStatus::Pending); m_checker.reset( new JavaChecker(path, "", minHeapSize(), maxHeapSize(), m_permGenSpinBox->isVisible() ? m_permGenSpinBox->value() : 0, 0, this)); - connect(m_checker.get(), &JavaChecker::checkFinished, this, &JavaSettingsWidget::checkFinished); + connect(m_checker.get(), &JavaChecker::checkFinished, this, &JavaWizardWidget::checkFinished); m_checker->start(); } -void JavaSettingsWidget::checkFinished(const JavaChecker::Result& result) +void JavaWizardWidget::checkFinished(const JavaChecker::Result& result) { m_result = result; switch (result.validity) { @@ -490,7 +490,7 @@ void JavaSettingsWidget::checkFinished(const JavaChecker::Result& result) } } -void JavaSettingsWidget::retranslate() +void JavaWizardWidget::retranslate() { m_memoryGroupBox->setTitle(tr("Memory")); m_maxMemSpinBox->setToolTip(tr("The maximum amount of memory Minecraft is allowed to use.")); @@ -506,7 +506,7 @@ void JavaSettingsWidget::retranslate() m_autoJavaGroupBox->setTitle(tr("Autodetect Java")); } -void JavaSettingsWidget::updateThresholds() +void JavaWizardWidget::updateThresholds() { QString iconName; @@ -538,22 +538,22 @@ void JavaSettingsWidget::updateThresholds() } } -bool JavaSettingsWidget::autoDownloadJava() const +bool JavaWizardWidget::autoDownloadJava() const { return m_autodownloadCheckBox && m_autodownloadCheckBox->isChecked(); } -bool JavaSettingsWidget::autoDetectJava() const +bool JavaWizardWidget::autoDetectJava() const { return m_autodetectJavaCheckBox->isChecked(); } -void JavaSettingsWidget::onSpinBoxValueChanged(int) +void JavaWizardWidget::onSpinBoxValueChanged(int) { m_memoryTimer->start(500); } -JavaSettingsWidget::~JavaSettingsWidget() +JavaWizardWidget::~JavaWizardWidget() { delete m_verticalSpacer; }; \ No newline at end of file diff --git a/launcher/ui/widgets/JavaSettingsWidget.h b/launcher/ui/widgets/JavaWizardWidget.h similarity index 95% rename from launcher/ui/widgets/JavaSettingsWidget.h rename to launcher/ui/widgets/JavaWizardWidget.h index 35be48478..9c76c0610 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.h +++ b/launcher/ui/widgets/JavaWizardWidget.h @@ -22,12 +22,12 @@ class QSpacerItem; /** * This is a widget for all the Java settings dialogs and pages. */ -class JavaSettingsWidget : public QWidget { +class JavaWizardWidget : public QWidget { Q_OBJECT public: - explicit JavaSettingsWidget(QWidget* parent); - virtual ~JavaSettingsWidget(); + explicit JavaWizardWidget(QWidget* parent); + virtual ~JavaWizardWidget(); enum class JavaStatus { NotSet, Pending, Good, DoesNotExist, DoesNotStart, ReturnedInvalidData } javaStatus = JavaStatus::NotSet; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index 6b93f55bb..78fae9639 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -282,245 +282,6 @@ - - - Java - - - - - - true - - - - - 0 - 0 - 610 - 454 - - - - - - - true - - - Java Insta&llation - - - true - - - false - - - - - - If enabled, the launcher will not check if an instance is compatible with the selected Java version. - - - Skip Java compatibility checks - - - - - - - - - - - - Browse - - - - - - - - - - - Download Java - - - - - - - Auto-detect... - - - - - - - Test - - - - - - - - - - - - true - - - Memor&y - - - true - - - false - - - - - - PermGen: - - - - - - - Minimum memory allocation: - - - - - - - Maximum memory allocation: - - - - - - - Note: Permgen is set automatically by Java 8 and later - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 256 - - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 1024 - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 4 - - - 999999999 - - - 8 - - - 64 - - - - - - - - - - Qt::AlignCenter - - - maxMemSpinBox - - - - - - - - - - true - - - Java Argumen&ts - - - true - - - false - - - - - - - - - - - - - - Tweaks From dedb7a2343f7d433492dee5930802ed47294b722 Mon Sep 17 00:00:00 2001 From: sshcrack <34072808+sshcrack@users.noreply.github.com> Date: Sun, 8 Dec 2024 14:17:04 +0100 Subject: [PATCH 023/102] change order of steps Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com> --- launcher/minecraft/MinecraftInstance.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 98ac7647f..e35dd973e 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -1083,6 +1083,12 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(step); } + // check java + { + process->appendStep(makeShared(pptr)); + process->appendStep(makeShared(pptr)); + } + // run pre-launch command if that's needed if (getPreLaunchCommand().size()) { auto step = makeShared(pptr); @@ -1096,12 +1102,6 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(makeShared(pptr, makeShared(this, mode, pptr))); } - // check java - { - process->appendStep(makeShared(pptr)); - process->appendStep(makeShared(pptr)); - } - // if we aren't in offline mode,. if (session->status != AuthSession::PlayableOffline) { if (!session->demo) { From cf2dcbd431b0c4bb03ff527465f972d72f713b0c Mon Sep 17 00:00:00 2001 From: sshcrack <34072808+sshcrack@users.noreply.github.com> Date: Sun, 8 Dec 2024 18:27:57 +0100 Subject: [PATCH 024/102] load meta first Signed-off-by: sshcrack <34072808+sshcrack@users.noreply.github.com> --- launcher/minecraft/MinecraftInstance.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index e35dd973e..995dd15d7 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -1083,6 +1083,12 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(step); } + // load meta + { + auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline; + process->appendStep(makeShared(pptr, makeShared(this, mode, pptr))); + } + // check java { process->appendStep(makeShared(pptr)); @@ -1096,12 +1102,6 @@ shared_qobject_ptr MinecraftInstance::createLaunchTask(AuthSessionPt process->appendStep(step); } - // load meta - { - auto mode = session->status != AuthSession::PlayableOffline ? Net::Mode::Online : Net::Mode::Offline; - process->appendStep(makeShared(pptr, makeShared(this, mode, pptr))); - } - // if we aren't in offline mode,. if (session->status != AuthSession::PlayableOffline) { if (!session->demo) { From eb8c375ec5023bbc7c02e45d63da866058e56b26 Mon Sep 17 00:00:00 2001 From: Edgars Cirulis Date: Mon, 9 Dec 2024 00:40:05 +0200 Subject: [PATCH 025/102] chore: update Qt to 6.8.1 Signed-off-by: Edgars Cirulis --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a96278ba3..7bb6c0ad7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,7 +82,7 @@ jobs: qt_ver: 6 qt_host: "windows" qt_arch: "win64_msvc2022_64" - qt_version: "6.8.0" + qt_version: "6.8.1" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -95,7 +95,7 @@ jobs: qt_ver: 6 qt_host: "windows" qt_arch: "win64_msvc2022_arm64_cross_compiled" - qt_version: "6.8.0" + qt_version: "6.8.1" qt_modules: "qt5compat qtimageformats qtnetworkauth" nscurl_tag: "v24.9.26.122" nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" @@ -106,7 +106,7 @@ jobs: qt_ver: 6 qt_host: mac qt_arch: "" - qt_version: "6.8.0" + qt_version: "6.8.1" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: macos-14 From e01df73debc8cb578e3e1b1e557388a8d0a7a052 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 31 Dec 2024 11:13:01 +0200 Subject: [PATCH 026/102] remove EditAccountDialog Signed-off-by: Trial97 --- launcher/CMakeLists.txt | 3 - launcher/ui/dialogs/EditAccountDialog.cpp | 64 --------------- launcher/ui/dialogs/EditAccountDialog.h | 52 ------------- launcher/ui/dialogs/EditAccountDialog.ui | 94 ----------------------- 4 files changed, 213 deletions(-) delete mode 100644 launcher/ui/dialogs/EditAccountDialog.cpp delete mode 100644 launcher/ui/dialogs/EditAccountDialog.h delete mode 100644 launcher/ui/dialogs/EditAccountDialog.ui diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 991f610dd..00a7274ea 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1030,8 +1030,6 @@ SET(LAUNCHER_SOURCES ui/dialogs/CopyInstanceDialog.h ui/dialogs/CustomMessageBox.cpp ui/dialogs/CustomMessageBox.h - ui/dialogs/EditAccountDialog.cpp - ui/dialogs/EditAccountDialog.h ui/dialogs/ExportInstanceDialog.cpp ui/dialogs/ExportInstanceDialog.h ui/dialogs/ExportPackDialog.cpp @@ -1217,7 +1215,6 @@ qt_wrap_ui(LAUNCHER_UI ui/dialogs/MSALoginDialog.ui ui/dialogs/OfflineLoginDialog.ui ui/dialogs/AboutDialog.ui - ui/dialogs/EditAccountDialog.ui ui/dialogs/ReviewMessageBox.ui ui/dialogs/ScrollMessageBox.ui ui/dialogs/BlockedModsDialog.ui diff --git a/launcher/ui/dialogs/EditAccountDialog.cpp b/launcher/ui/dialogs/EditAccountDialog.cpp deleted file mode 100644 index 9d0175bbc..000000000 --- a/launcher/ui/dialogs/EditAccountDialog.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* 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 "EditAccountDialog.h" -#include -#include -#include -#include "ui_EditAccountDialog.h" - -EditAccountDialog::EditAccountDialog(const QString& text, QWidget* parent, int flags) : QDialog(parent), ui(new Ui::EditAccountDialog) -{ - ui->setupUi(this); - - ui->label->setText(text); - ui->label->setVisible(!text.isEmpty()); - - ui->userTextBox->setEnabled(flags & UsernameField); - ui->passTextBox->setEnabled(flags & PasswordField); - - ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); - ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK")); -} - -EditAccountDialog::~EditAccountDialog() -{ - delete ui; -} - -void EditAccountDialog::on_label_linkActivated(const QString& link) -{ - DesktopServices::openUrl(QUrl(link)); -} - -void EditAccountDialog::setUsername(const QString& user) const -{ - ui->userTextBox->setText(user); -} - -QString EditAccountDialog::username() const -{ - return ui->userTextBox->text(); -} - -void EditAccountDialog::setPassword(const QString& pass) const -{ - ui->passTextBox->setText(pass); -} - -QString EditAccountDialog::password() const -{ - return ui->passTextBox->text(); -} diff --git a/launcher/ui/dialogs/EditAccountDialog.h b/launcher/ui/dialogs/EditAccountDialog.h deleted file mode 100644 index 7a9ccba79..000000000 --- a/launcher/ui/dialogs/EditAccountDialog.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - */ - -#pragma once - -#include - -namespace Ui { -class EditAccountDialog; -} - -class EditAccountDialog : public QDialog { - Q_OBJECT - - public: - explicit EditAccountDialog(const QString& text = "", QWidget* parent = 0, int flags = UsernameField | PasswordField); - ~EditAccountDialog(); - - void setUsername(const QString& user) const; - void setPassword(const QString& pass) const; - - QString username() const; - QString password() const; - - enum Flags { - NoFlags = 0, - - //! Specifies that the dialog should have a username field. - UsernameField, - - //! Specifies that the dialog should have a password field. - PasswordField, - }; - - private slots: - void on_label_linkActivated(const QString& link); - - private: - Ui::EditAccountDialog* ui; -}; diff --git a/launcher/ui/dialogs/EditAccountDialog.ui b/launcher/ui/dialogs/EditAccountDialog.ui deleted file mode 100644 index e87509bcb..000000000 --- a/launcher/ui/dialogs/EditAccountDialog.ui +++ /dev/null @@ -1,94 +0,0 @@ - - - EditAccountDialog - - - - 0 - 0 - 400 - 148 - - - - Login - - - - - - Message label placeholder. - - - Qt::RichText - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Email - - - - - - - QLineEdit::Password - - - Password - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - EditAccountDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - EditAccountDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - From 54da41c6253ddd8af20ff30044a208c9b529db7c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 11 Jan 2025 22:11:18 +0000 Subject: [PATCH 027/102] chore(deps): update hendrikmuhs/ccache-action action to v1.2.16 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0770b66dd..f9469be2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -167,7 +167,7 @@ jobs: - name: Setup ccache if: (runner.os != 'Windows' || matrix.msystem == '') && inputs.build_type == 'Debug' - uses: hendrikmuhs/ccache-action@v1.2.14 + uses: hendrikmuhs/ccache-action@v1.2.16 with: key: ${{ matrix.os }}-qt${{ matrix.qt_ver }}-${{ matrix.architecture }} From 03834e14558475bafd542ad1365f35cce243682f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Jan 2025 00:26:01 +0000 Subject: [PATCH 028/102] chore(nix): update lockfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/6df24922a1400241dae323af55f30e4318a6ca65?narHash=sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk%3D' (2025-01-02) → 'github:NixOS/nixpkgs/bffc22eb12172e6db3c5dde9e3e5628f8e3e7912?narHash=sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc%2Bc2c%3D' (2025-01-08) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index c2f37cf0d..3ab2fcd67 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "lastModified": 1736344531, + "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", "type": "github" }, "original": { From 3ee73916ca31666abc48f45e8b0bfcf8d678e6cf Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 13 Jan 2025 08:16:12 +0200 Subject: [PATCH 029/102] fix modrinth link Signed-off-by: Trial97 --- launcher/ui/pages/global/APIPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 9c713aa79..05c256bb2 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -207,7 +207,7 @@ - <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/#section/Authentication">documentation</a> for more information.</p></body></html> + <html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api/#authentication">documentation</a> for more information.</p></body></html> true From e4ad4051c8b87bd5102a76a860408de2b447d74d Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 13 Jan 2025 13:56:55 +0200 Subject: [PATCH 030/102] fix curseforge with empty loader as newest version Signed-off-by: Trial97 --- launcher/modplatform/flame/FlameAPI.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/launcher/modplatform/flame/FlameAPI.cpp b/launcher/modplatform/flame/FlameAPI.cpp index 53eadcf02..699eb792a 100644 --- a/launcher/modplatform/flame/FlameAPI.cpp +++ b/launcher/modplatform/flame/FlameAPI.cpp @@ -270,6 +270,7 @@ std::optional FlameAPI::getLatestVersion(QList instanceLoaders, ModPlatform::ModLoaderTypes modLoaders) { + static const auto noLoader = ModPlatform::ModLoaderType(0); QHash bestMatch; auto checkVersion = [&bestMatch](const ModPlatform::IndexedVersion& version, const ModPlatform::ModLoaderType& loader) { if (bestMatch.contains(loader)) { @@ -284,7 +285,7 @@ std::optional FlameAPI::getLatestVersion(QList FlameAPI::getLatestVersion(QList fabric version will be prioritizated on update auto currentLoaders = instanceLoaders + ModPlatform::modLoaderTypesToList(modLoaders); - currentLoaders.append(ModPlatform::ModLoaderType(0)); // add a fallback in case the versions do not define a loader + currentLoaders.append(noLoader); // add a fallback in case the versions do not define a loader for (auto loader : currentLoaders) { if (bestMatch.contains(loader)) { - return bestMatch.value(loader); + auto bestForLoader = bestMatch.value(loader); + // awkward case where the mod has only two loaders and one of them is not specified + if (loader != noLoader && bestMatch.contains(noLoader) && bestMatch.size() == 2) { + auto bestForNoLoader = bestMatch.value(noLoader); + if (bestForNoLoader.date > bestForLoader.date) { + return bestForNoLoader; + } + } + return bestForLoader; } } return {}; From bca517b8d3cd685540beebf69fbc1f80fe0a6ce4 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 16 Jan 2025 12:10:19 +0200 Subject: [PATCH 031/102] fix appimage Signed-off-by: Trial97 --- .github/workflows/build.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0770b66dd..12dea1715 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: qt_version: "5.15.2" qt_modules: "qtnetworkauth" - - os: ubuntu-20.04 + - os: ubuntu-22.04 qt_ver: 6 qt_host: linux qt_arch: "" @@ -259,7 +259,7 @@ jobs: wget "https://github.com/AppImageCommunity/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage" - sudo apt install libopengl0 + sudo apt install libopengl0 libfuse2 - name: Add QT_HOST_PATH var (Windows MSVC arm64) if: runner.os == 'Windows' && matrix.architecture == 'arm64' @@ -521,8 +521,8 @@ jobs: cp -r ${{ runner.workspace }}/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ - cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ cp /usr/lib/x86_64-linux-gnu/libOpenGL.so.0* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib" @@ -547,8 +547,27 @@ jobs: mv "PrismLauncher-Linux-x86_64.AppImage" "PrismLauncher-Linux-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage" - - name: Package (Linux, portable) - if: runner.os == 'Linux' + - name: Package (Linux, qt6, portable) + if: runner.os == 'Linux' && matrix.qt_ver != 5 + run: | + cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja + cmake --install ${{ env.BUILD_DIR }} + cmake --install ${{ env.BUILD_DIR }} --component portable + + mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libffi.so.8 ${{ env.INSTALL_PORTABLE_DIR }}/lib + mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib + + for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt + cd ${{ env.INSTALL_PORTABLE_DIR }} + tar -czf ../PrismLauncher-portable.tar.gz * + + - name: Package (Linux, qt5, portable) + if: runner.os == 'Linux' && matrix.qt_ver == 5 run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja cmake --install ${{ env.BUILD_DIR }} From 7cb8deeb9072d0635728d72835645102ff241da3 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 20 Jul 2023 19:59:58 +0300 Subject: [PATCH 032/102] feat: updated flame mod resolution Signed-off-by: Trial97 --- .../modplatform/flame/FileResolvingTask.cpp | 28 +++++++++++++++++++ .../flame/FlameInstanceCreationTask.cpp | 3 +- launcher/modplatform/flame/PackManifest.h | 3 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/launcher/modplatform/flame/FileResolvingTask.cpp b/launcher/modplatform/flame/FileResolvingTask.cpp index d69bf12c0..7ff38d57e 100644 --- a/launcher/modplatform/flame/FileResolvingTask.cpp +++ b/launcher/modplatform/flame/FileResolvingTask.cpp @@ -87,6 +87,30 @@ void Flame::FileResolvingTask::executeTask() m_task->start(); } +PackedResourceType getResourceType(int classId) +{ + switch (classId) { + case 17: // Worlds + return PackedResourceType::WorldSave; + case 6: // Mods + return PackedResourceType::Mod; + case 12: // Resource Packs + // return PackedResourceType::ResourcePack; // not really a resourcepack + /* fallthrough */ + case 4546: // Customization + // return PackedResourceType::ShaderPack; // not really a shaderPack + /* fallthrough */ + case 4471: // Modpacks + /* fallthrough */ + case 5: // Bukkit Plugins + /* fallthrough */ + case 4559: // Addons + /* fallthrough */ + default: + return PackedResourceType::UNKNOWN; + } +} + void Flame::FileResolvingTask::netJobFinished() { setProgress(1, 3); @@ -232,6 +256,10 @@ void Flame::FileResolvingTask::getFlameProjects() setStatus(tr("Parsing API response from CurseForge for '%1'...").arg(file->version.fileName)); FlameMod::loadIndexedPack(file->pack, entry_obj); + file->resourceType = getResourceType(Json::requireInteger(entry_obj, "classId", "modClassId")); + if (file->resourceType == PackedResourceType::WorldSave) { + file->targetFolder = "saves"; + } } } catch (Json::JsonException& e) { qDebug() << e.cause(); diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp index e60d32cc0..b16277b48 100644 --- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp +++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp @@ -474,7 +474,7 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) QList blocked_mods; auto anyBlocked = false; for (const auto& result : results.files.values()) { - if (result.version.fileName.endsWith(".zip")) { + if (result.resourceType != PackedResourceType::Mod) { m_ZIP_resources.append(std::make_pair(result.version.fileName, result.targetFolder)); } @@ -678,6 +678,7 @@ void FlameCreationTask::validateZIPResources(QEventLoop& loop) installWorld(worldPath); break; case PackedResourceType::UNKNOWN: + /* fallthrough */ default: qDebug() << "Can't Identify" << fileName << "at" << localPath << ", leaving it where it is."; break; diff --git a/launcher/modplatform/flame/PackManifest.h b/launcher/modplatform/flame/PackManifest.h index 49a0b2d68..7d3693756 100644 --- a/launcher/modplatform/flame/PackManifest.h +++ b/launcher/modplatform/flame/PackManifest.h @@ -40,6 +40,7 @@ #include #include #include +#include "minecraft/mod/tasks/LocalResourceParse.h" #include "modplatform/ModIndex.h" namespace Flame { @@ -54,6 +55,8 @@ struct File { // our QString targetFolder = QStringLiteral("mods"); + enum class Type { Unknown, Folder, Ctoc, SingleFile, Cmod2, Modpack, Mod } type = Type::Mod; + PackedResourceType resourceType; }; struct Modloader { From 9317a675eddd5cb6f4845ca74f57f09b27453a2e Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 16 Jan 2025 17:07:44 +0200 Subject: [PATCH 033/102] removed unused type Signed-off-by: Trial97 --- launcher/modplatform/flame/PackManifest.h | 1 - 1 file changed, 1 deletion(-) diff --git a/launcher/modplatform/flame/PackManifest.h b/launcher/modplatform/flame/PackManifest.h index 7d3693756..7af3b9d6b 100644 --- a/launcher/modplatform/flame/PackManifest.h +++ b/launcher/modplatform/flame/PackManifest.h @@ -55,7 +55,6 @@ struct File { // our QString targetFolder = QStringLiteral("mods"); - enum class Type { Unknown, Folder, Ctoc, SingleFile, Cmod2, Modpack, Mod } type = Type::Mod; PackedResourceType resourceType; }; From 1d8bf1d5a788e689d26e0afa8f5cfca0e3859e5d Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 1 Jan 2025 01:36:17 +0200 Subject: [PATCH 034/102] map modrinth snapshots Signed-off-by: Trial97 --- launcher/modplatform/modrinth/ModrinthAPI.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 3a5c21ed1..8974161d7 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -170,9 +170,16 @@ class ModrinthAPI : public NetworkResourceAPI { QString getGameVersionsArray(std::list mcVersions) const { + static const QString preString = " Pre-Release "; QString s; for (auto& ver : mcVersions) { - s += QString("\"versions:%1\",").arg(ver.toString()); + auto verStr = ver.toString(); + + if (verStr.contains(preString)) { + verStr.replace(preString, "-pre"); + } + verStr.replace(" ", "-"); + s += QString("\"versions:%1\",").arg(verStr); } s.remove(s.length() - 1, 1); // remove last comma return s.isEmpty() ? QString() : s; From 8e5a7c6e333969b5412efd1349f9430ced5654c8 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 17 Jan 2025 10:35:13 +0200 Subject: [PATCH 035/102] ensure that the snapshot mapping is on all apis Signed-off-by: Trial97 --- launcher/modplatform/ResourceAPI.h | 18 ++++++++++--- launcher/modplatform/modrinth/ModrinthAPI.cpp | 4 +-- launcher/modplatform/modrinth/ModrinthAPI.h | 26 ++++++++++++------- .../modrinth/ModrinthPackIndex.cpp | 12 ++++----- .../modrinth/ModrinthPackManifest.cpp | 4 +-- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/launcher/modplatform/ResourceAPI.h b/launcher/modplatform/ResourceAPI.h index 4f457a48e..62a1ff199 100644 --- a/launcher/modplatform/ResourceAPI.h +++ b/launcher/modplatform/ResourceAPI.h @@ -73,7 +73,7 @@ class ResourceAPI { std::optional search; std::optional sorting; std::optional loaders; - std::optional > versions; + std::optional> versions; std::optional side; std::optional categoryIds; bool openSource; @@ -169,11 +169,23 @@ class ResourceAPI { protected: [[nodiscard]] inline QString debugName() const { return "External resource API"; } - [[nodiscard]] inline auto getGameVersionsString(std::list mcVersions) const -> QString + [[nodiscard]] inline QString mapMCVersionToModrinth(Version v) const + { + static const QString preString = " Pre-Release "; + auto verStr = v.toString(); + + if (verStr.contains(preString)) { + verStr.replace(preString, "-pre"); + } + verStr.replace(" ", "-"); + return verStr; + } + + [[nodiscard]] inline QString getGameVersionsString(std::list mcVersions) const { QString s; for (auto& ver : mcVersions) { - s += QString("\"%1\",").arg(ver.toString()); + s += QString("\"%1\",").arg(mapMCVersionToModrinth(ver)); } s.remove(s.length() - 1, 1); // remove last comma return s; diff --git a/launcher/modplatform/modrinth/ModrinthAPI.cpp b/launcher/modplatform/modrinth/ModrinthAPI.cpp index a954f65a5..bdef1a0e5 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.cpp +++ b/launcher/modplatform/modrinth/ModrinthAPI.cpp @@ -54,7 +54,7 @@ Task::Ptr ModrinthAPI::latestVersion(QString hash, if (mcVersions.has_value()) { QStringList game_versions; for (auto& ver : mcVersions.value()) { - game_versions.append(ver.toString()); + game_versions.append(mapMCVersionToModrinth(ver)); } Json::writeStringList(body_obj, "game_versions", game_versions); } @@ -87,7 +87,7 @@ Task::Ptr ModrinthAPI::latestVersions(const QStringList& hashes, if (mcVersions.has_value()) { QStringList game_versions; for (auto& ver : mcVersions.value()) { - game_versions.append(ver.toString()); + game_versions.append(mapMCVersionToModrinth(ver)); } Json::writeStringList(body_obj, "game_versions", game_versions); } diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 8974161d7..9c6bed4ca 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -81,6 +81,21 @@ class ModrinthAPI : public NetworkResourceAPI { return {}; } + [[nodiscard]] static inline QString mapMCVersionFromModrinth(QString v) + { + static const QString preString = " Pre-Release "; + bool pre = false; + if (v.contains("-pre")) { + pre = true; + v.replace("-pre", preString); + } + v.replace("-", " "); + if (pre) { + v.replace(" Pre Release ", preString); + } + return v; + } + private: [[nodiscard]] static QString resourceTypeParameter(ModPlatform::ResourceType type) { @@ -170,16 +185,9 @@ class ModrinthAPI : public NetworkResourceAPI { QString getGameVersionsArray(std::list mcVersions) const { - static const QString preString = " Pre-Release "; QString s; for (auto& ver : mcVersions) { - auto verStr = ver.toString(); - - if (verStr.contains(preString)) { - verStr.replace(preString, "-pre"); - } - verStr.replace(" ", "-"); - s += QString("\"versions:%1\",").arg(verStr); + s += QString("\"versions:%1\",").arg(mapMCVersionToModrinth(ver)); } s.remove(s.length() - 1, 1); // remove last comma return s.isEmpty() ? QString() : s; @@ -196,7 +204,7 @@ class ModrinthAPI : public NetworkResourceAPI { : QString("%1/project/%2/version?game_versions=[\"%3\"]&loaders=[\"%4\"]") .arg(BuildConfig.MODRINTH_PROD_URL) .arg(args.dependency.addonId.toString()) - .arg(args.mcVersion.toString()) + .arg(mapMCVersionToModrinth(args.mcVersion)) .arg(getModLoaderStrings(args.loader).join("\",\"")); }; }; diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp index 48b27a597..72550937c 100644 --- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp @@ -131,9 +131,7 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArra pack.versionsLoaded = true; } -auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, - QString preferred_hash_type, - QString preferred_file_name) -> ModPlatform::IndexedVersion +ModPlatform::IndexedVersion Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_type, QString preferred_file_name) { ModPlatform::IndexedVersion file; @@ -145,7 +143,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, return {}; } for (auto mcVer : versionArray) { - file.mcVersion.append(mcVer.toString()); + file.mcVersion.append(ModrinthAPI::mapMCVersionFromModrinth(mcVer.toString())); } auto loaders = Json::requireArray(obj, "loaders"); for (auto loader : loaders) { @@ -247,9 +245,9 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, return {}; } -auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, - QJsonArray& arr, - const BaseInstance* inst) -> ModPlatform::IndexedVersion +ModPlatform::IndexedVersion Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, + QJsonArray& arr, + const BaseInstance* inst) { auto profile = (dynamic_cast(inst))->getPackProfile(); QString mcVersion = profile->getComponentVersion("net.minecraft"); diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp index c52a1743b..89ef6e4c4 100644 --- a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp @@ -40,9 +40,6 @@ #include "modplatform/modrinth/ModrinthAPI.h" -#include "minecraft/MinecraftInstance.h" -#include "minecraft/PackProfile.h" - #include static ModrinthAPI api; @@ -134,6 +131,7 @@ auto loadIndexedVersion(QJsonObject& obj) -> ModpackVersion auto gameVersions = Json::ensureArray(obj, "game_versions"); if (!gameVersions.isEmpty()) { file.gameVersion = Json::ensureString(gameVersions[0]); + file.gameVersion = ModrinthAPI::mapMCVersionFromModrinth(file.gameVersion); } auto loaders = Json::requireArray(obj, "loaders"); for (auto loader : loaders) { From 7d3238d234ca514436f608384ce7ceb94d0630eb Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 17 Jan 2025 21:09:44 +0200 Subject: [PATCH 036/102] rename variables Signed-off-by: Trial97 --- .../flame/FlameInstanceCreationTask.cpp | 78 +++++++++---------- .../flame/FlameInstanceCreationTask.h | 14 ++-- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp index b16277b48..6073e90a2 100644 --- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp +++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp @@ -75,12 +75,12 @@ bool FlameCreationTask::abort() return false; m_abort = true; - if (m_process_update_file_info_job) - m_process_update_file_info_job->abort(); - if (m_files_job) - m_files_job->abort(); - if (m_mod_id_resolver) - m_mod_id_resolver->abort(); + if (m_processUpdateFileInfoJob) + m_processUpdateFileInfoJob->abort(); + if (m_filesJob) + m_filesJob->abort(); + if (m_modIdResolver) + m_modIdResolver->abort(); return Task::abort(); } @@ -232,12 +232,12 @@ bool FlameCreationTask::updateInstance() connect(job.get(), &Task::failed, this, [](QString reason) { qCritical() << "Failed to get files: " << reason; }); connect(job.get(), &Task::finished, &loop, &QEventLoop::quit); - m_process_update_file_info_job = job; + m_processUpdateFileInfoJob = job; job->start(); loop.exec(); - m_process_update_file_info_job = nullptr; + m_processUpdateFileInfoJob = nullptr; } else { // We don't have an old index file, so we may duplicate stuff! auto dialog = CustomMessageBox::selectable(m_parent, tr("No index file."), @@ -430,26 +430,26 @@ bool FlameCreationTask::createInstance() } // Don't add managed info to packs without an ID (most likely imported from ZIP) - if (!m_managed_id.isEmpty()) - instance.setManagedPack("flame", m_managed_id, m_pack.name, m_managed_version_id, m_pack.version); + if (!m_managedId.isEmpty()) + instance.setManagedPack("flame", m_managedId, m_pack.name, m_managedVersionId, m_pack.version); else instance.setManagedPack("flame", "", name(), "", ""); instance.setName(name()); - m_mod_id_resolver.reset(new Flame::FileResolvingTask(APPLICATION->network(), m_pack)); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::succeeded, this, [this, &loop] { idResolverSucceeded(loop); }); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::failed, [this, &loop](QString reason) { - m_mod_id_resolver.reset(); + m_modIdResolver.reset(new Flame::FileResolvingTask(APPLICATION->network(), m_pack)); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::succeeded, this, [this, &loop] { idResolverSucceeded(loop); }); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::failed, [this, &loop](QString reason) { + m_modIdResolver.reset(); setError(tr("Unable to resolve mod IDs:\n") + reason); loop.quit(); }); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::aborted, &loop, &QEventLoop::quit); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::progress, this, &FlameCreationTask::setProgress); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::status, this, &FlameCreationTask::setStatus); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::stepProgress, this, &FlameCreationTask::propagateStepProgress); - connect(m_mod_id_resolver.get(), &Flame::FileResolvingTask::details, this, &FlameCreationTask::setDetails); - m_mod_id_resolver->start(); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::aborted, &loop, &QEventLoop::quit); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::progress, this, &FlameCreationTask::setProgress); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::status, this, &FlameCreationTask::setStatus); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::stepProgress, this, &FlameCreationTask::propagateStepProgress); + connect(m_modIdResolver.get(), &Flame::FileResolvingTask::details, this, &FlameCreationTask::setDetails); + m_modIdResolver->start(); loop.exec(); @@ -468,14 +468,14 @@ bool FlameCreationTask::createInstance() void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) { - auto results = m_mod_id_resolver->getResults(); + auto results = m_modIdResolver->getResults(); // first check for blocked mods QList blocked_mods; auto anyBlocked = false; for (const auto& result : results.files.values()) { if (result.resourceType != PackedResourceType::Mod) { - m_ZIP_resources.append(std::make_pair(result.version.fileName, result.targetFolder)); + m_otherResources.append(std::make_pair(result.version.fileName, result.targetFolder)); } if (result.version.downloadUrl.isEmpty()) { @@ -507,7 +507,7 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) copyBlockedMods(blocked_mods); setupDownloadJob(loop); } else { - m_mod_id_resolver.reset(); + m_modIdResolver.reset(); setError("Canceled"); loop.quit(); } @@ -518,8 +518,8 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop) void FlameCreationTask::setupDownloadJob(QEventLoop& loop) { - m_files_job.reset(new NetJob(tr("Mod Download Flame"), APPLICATION->network())); - auto results = m_mod_id_resolver->getResults().files; + m_filesJob.reset(new NetJob(tr("Mod Download Flame"), APPLICATION->network())); + auto results = m_modIdResolver->getResults().files; QStringList optionalFiles; for (auto& result : results) { @@ -554,26 +554,26 @@ void FlameCreationTask::setupDownloadJob(QEventLoop& loop) if (!result.version.downloadUrl.isEmpty()) { qDebug() << "Will download" << result.version.downloadUrl << "to" << path; auto dl = Net::ApiDownload::makeFile(result.version.downloadUrl, path); - m_files_job->addNetAction(dl); + m_filesJob->addNetAction(dl); } } - connect(m_files_job.get(), &NetJob::finished, this, [this, &loop]() { - m_files_job.reset(); - validateZIPResources(loop); + connect(m_filesJob.get(), &NetJob::finished, this, [this, &loop]() { + m_filesJob.reset(); + validateOtherResources(loop); }); - connect(m_files_job.get(), &NetJob::failed, [this](QString reason) { - m_files_job.reset(); + connect(m_filesJob.get(), &NetJob::failed, [this](QString reason) { + m_filesJob.reset(); setError(reason); }); - connect(m_files_job.get(), &NetJob::progress, this, [this](qint64 current, qint64 total) { + connect(m_filesJob.get(), &NetJob::progress, this, [this](qint64 current, qint64 total) { setDetails(tr("%1 out of %2 complete").arg(current).arg(total)); setProgress(current, total); }); - connect(m_files_job.get(), &NetJob::stepProgress, this, &FlameCreationTask::propagateStepProgress); + connect(m_filesJob.get(), &NetJob::stepProgress, this, &FlameCreationTask::propagateStepProgress); setStatus(tr("Downloading mods...")); - m_files_job->start(); + m_filesJob->start(); } /// @brief copy the matched blocked mods to the instance staging area @@ -614,11 +614,11 @@ void FlameCreationTask::copyBlockedMods(QList const& blocked_mods) setAbortable(true); } -void FlameCreationTask::validateZIPResources(QEventLoop& loop) +void FlameCreationTask::validateOtherResources(QEventLoop& loop) { - qDebug() << "Validating whether resources stored as .zip are in the right place"; + qDebug() << "Validating whether other resources are in the right place"; QStringList zipMods; - for (auto [fileName, targetFolder] : m_ZIP_resources) { + for (auto [fileName, targetFolder] : m_otherResources) { qDebug() << "Checking" << fileName << "..."; auto localPath = FS::PathCombine(m_stagingPath, "minecraft", targetFolder, fileName); @@ -686,7 +686,7 @@ void FlameCreationTask::validateZIPResources(QEventLoop& loop) } // TODO make this work with other sorts of resource auto task = makeShared("CreateModMetadata", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()); - auto results = m_mod_id_resolver->getResults().files; + auto results = m_modIdResolver->getResults().files; auto folder = FS::PathCombine(m_stagingPath, "minecraft", "mods", ".index"); for (auto file : results) { if (file.targetFolder != "mods" || (file.version.fileName.endsWith(".zip") && !zipMods.contains(file.version.fileName))) { @@ -695,6 +695,6 @@ void FlameCreationTask::validateZIPResources(QEventLoop& loop) task->addTask(makeShared(folder, file.pack, file.version)); } connect(task.get(), &Task::finished, &loop, &QEventLoop::quit); - m_process_update_file_info_job = task; + m_processUpdateFileInfoJob = task; task->start(); } diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.h b/launcher/modplatform/flame/FlameInstanceCreationTask.h index 28ab176c2..3e586a416 100644 --- a/launcher/modplatform/flame/FlameInstanceCreationTask.h +++ b/launcher/modplatform/flame/FlameInstanceCreationTask.h @@ -57,7 +57,7 @@ class FlameCreationTask final : public InstanceCreationTask { QString id, QString version_id, QString original_instance_id = {}) - : InstanceCreationTask(), m_parent(parent), m_managed_id(std::move(id)), m_managed_version_id(std::move(version_id)) + : InstanceCreationTask(), m_parent(parent), m_managedId(std::move(id)), m_managedVersionId(std::move(version_id)) { setStagingPath(staging_path); setParentSettings(global_settings); @@ -74,22 +74,22 @@ class FlameCreationTask final : public InstanceCreationTask { void idResolverSucceeded(QEventLoop&); void setupDownloadJob(QEventLoop&); void copyBlockedMods(QList const& blocked_mods); - void validateZIPResources(QEventLoop& loop); + void validateOtherResources(QEventLoop& loop); QString getVersionForLoader(QString uid, QString loaderType, QString version, QString mcVersion); private: QWidget* m_parent = nullptr; - shared_qobject_ptr m_mod_id_resolver; + shared_qobject_ptr m_modIdResolver; Flame::Manifest m_pack; // Handle to allow aborting - Task::Ptr m_process_update_file_info_job = nullptr; - NetJob::Ptr m_files_job = nullptr; + Task::Ptr m_processUpdateFileInfoJob = nullptr; + NetJob::Ptr m_filesJob = nullptr; - QString m_managed_id, m_managed_version_id; + QString m_managedId, m_managedVersionId; - QList> m_ZIP_resources; + QList> m_otherResources; std::optional m_instance; }; From dc00c47f2e2b79705c32f438298d968aaa4fdf26 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sat, 18 Jan 2025 13:27:18 +0200 Subject: [PATCH 037/102] update submodules Signed-off-by: Trial97 --- flatpak/shared-modules | 2 +- libraries/cmark | 2 +- libraries/extra-cmake-modules | 2 +- libraries/filesystem | 2 +- libraries/quazip | 2 +- libraries/tomlplusplus | 2 +- libraries/zlib | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flatpak/shared-modules b/flatpak/shared-modules index f2b0c16a2..f5d368a31 160000 --- a/flatpak/shared-modules +++ b/flatpak/shared-modules @@ -1 +1 @@ -Subproject commit f2b0c16a2a217a1822ce5a6538ba8f755ed1dd32 +Subproject commit f5d368a31d6ef046eb2955c74ec6f54f32ed5c4e diff --git a/libraries/cmark b/libraries/cmark index 8fbf02968..3460cd809 160000 --- a/libraries/cmark +++ b/libraries/cmark @@ -1 +1 @@ -Subproject commit 8fbf029685482827828b5858444157052f1b0a5f +Subproject commit 3460cd809b6dd311b58e92733ece2fc956224fd2 diff --git a/libraries/extra-cmake-modules b/libraries/extra-cmake-modules index bbcbaff78..a3d9394ab 160000 --- a/libraries/extra-cmake-modules +++ b/libraries/extra-cmake-modules @@ -1 +1 @@ -Subproject commit bbcbaff78283270c2beee69afd8d5b91da854af8 +Subproject commit a3d9394aba4b35789293378e04fb7473d65edf97 diff --git a/libraries/filesystem b/libraries/filesystem index 2fc4b4637..076592ce6 160000 --- a/libraries/filesystem +++ b/libraries/filesystem @@ -1 +1 @@ -Subproject commit 2fc4b463759e043476fc0036da094e5877e3dd50 +Subproject commit 076592ce6e64568521b88a11881aa36b3d3f7048 diff --git a/libraries/quazip b/libraries/quazip index 9d3aa3ee9..8aeb3f7d8 160000 --- a/libraries/quazip +++ b/libraries/quazip @@ -1 +1 @@ -Subproject commit 9d3aa3ee948c1cde5a9f873ecbc3bb229c1182ee +Subproject commit 8aeb3f7d8254f4bf1f7c6cf2a8f59c2ca141a552 diff --git a/libraries/tomlplusplus b/libraries/tomlplusplus index 7eb2ffcc0..c4369ae1d 160000 --- a/libraries/tomlplusplus +++ b/libraries/tomlplusplus @@ -1 +1 @@ -Subproject commit 7eb2ffcc09f8e9890dc0b77ff8ab00fc53b1f2b8 +Subproject commit c4369ae1d8955cae20c4ab40b9813ef4b60e48be diff --git a/libraries/zlib b/libraries/zlib index 04f42ceca..51b7f2abd 160000 --- a/libraries/zlib +++ b/libraries/zlib @@ -1 +1 @@ -Subproject commit 04f42ceca40f73e2978b50e93806c2a18c1281fc +Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf From 8e8538b506b5f3ae2b2424599078966600bb764c Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 18 Jan 2025 16:55:25 -0500 Subject: [PATCH 038/102] ci: build nix packages for aarch64-linux Signed-off-by: seth --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9469be2e..5cc71d88d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -665,6 +665,9 @@ jobs: - os: ubuntu-22.04 system: x86_64-linux + - os: ubuntu-22.04-arm + system: aarch64-linux + - os: macos-13 system: x86_64-darwin From 66f0397087d9b88c93e69c5e26a138d235344546 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 18 Jan 2025 17:05:17 -0500 Subject: [PATCH 039/102] ci: build flatpaks for arm Signed-off-by: seth --- .github/workflows/build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9469be2e..338c7219e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -633,10 +633,24 @@ jobs: ccache -s flatpak: - runs-on: ubuntu-latest + name: Flatpak (${{ matrix.arch }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + arch: x86_64 + + - os: ubuntu-22.04-arm + arch: aarch64 + + runs-on: ${{ matrix.os }} + container: image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8 options: --privileged + steps: - name: Checkout uses: actions/checkout@v4 @@ -654,6 +668,7 @@ jobs: with: bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml + arch: ${{ matrix.arch }} nix: name: Nix (${{ matrix.system }}) From be3eca8c97fdbb8daede84cab20fbd7695334242 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Sun, 19 Jan 2025 01:05:06 +0200 Subject: [PATCH 040/102] remove specific step for qt6 Signed-off-by: Trial97 --- .github/workflows/build.yml | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12dea1715..bbe2adee4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -547,8 +547,8 @@ jobs: mv "PrismLauncher-Linux-x86_64.AppImage" "PrismLauncher-Linux-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage" - - name: Package (Linux, qt6, portable) - if: runner.os == 'Linux' && matrix.qt_ver != 5 + - name: Package (Linux, portable) + if: runner.os == 'Linux' run: | cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja cmake --install ${{ env.BUILD_DIR }} @@ -557,28 +557,9 @@ jobs: mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libffi.so.8 ${{ env.INSTALL_PORTABLE_DIR }}/lib - mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib - - for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt - cd ${{ env.INSTALL_PORTABLE_DIR }} - tar -czf ../PrismLauncher-portable.tar.gz * - - - name: Package (Linux, qt5, portable) - if: runner.os == 'Linux' && matrix.qt_ver == 5 - run: | - cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PORTABLE_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=official -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -DINSTALL_BUNDLE=full -G Ninja - cmake --install ${{ env.BUILD_DIR }} - cmake --install ${{ env.BUILD_DIR }} --component portable - - mkdir ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /lib/x86_64-linux-gnu/libbz2.so.1.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libffi.so.7 ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libffi.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt From 1b5d3c2bf903bbcade7b38c22c0b103a0c6999f8 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Sun, 19 Jan 2025 02:03:21 +0200 Subject: [PATCH 041/102] Update .github/workflows/build.yml Co-authored-by: seth Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbe2adee4..169d63176 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -521,8 +521,8 @@ jobs: cp -r ${{ runner.workspace }}/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines - cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ - cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ + cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ cp /usr/lib/x86_64-linux-gnu/libOpenGL.so.0* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib" From 8d4f27953978d1f308ac152fa5cfb9e860bf7cef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 19 Jan 2025 00:24:56 +0000 Subject: [PATCH 042/102] chore(nix): update lockfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/bffc22eb12172e6db3c5dde9e3e5628f8e3e7912?narHash=sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc%2Bc2c%3D' (2025-01-08) → 'github:NixOS/nixpkgs/5df43628fdf08d642be8ba5b3625a6c70731c19c?narHash=sha256-Tbk1MZbtV2s5aG%2BiM99U8FqwxU/YNArMcWAv6clcsBc%3D' (2025-01-16) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 3ab2fcd67..01f66b974 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1736344531, - "narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=", + "lastModified": 1737062831, + "narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912", + "rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c", "type": "github" }, "original": { From db766574a42a4b7db6b320b6d469b233ce5f3100 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 21 Jan 2025 01:38:13 +0200 Subject: [PATCH 043/102] Update .github/workflows/build.yml Co-authored-by: Seth Flynn Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 169d63176..680a39a4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -559,7 +559,7 @@ jobs: cp /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /usr/lib/x86_64-linux-gnu/libcrypto.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib cp /usr/lib/x86_64-linux-gnu/libssl.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib - cp /usr/lib/x86_64-linux-gnu/libffi.so.* ${{ env.INSTALL_PORTABLE_DIR }}/lib + cp /usr/lib/x86_64-linux-gnu/libffi.so.*.* ${{ env.INSTALL_PORTABLE_DIR }}/lib mv ${{ env.INSTALL_PORTABLE_DIR }}/bin/*.so* ${{ env.INSTALL_PORTABLE_DIR }}/lib for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt From e66f447ce5bca996b0a12fac02216b2b6ab8ccb6 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 20 Jan 2025 20:35:37 -0500 Subject: [PATCH 044/102] feat: use better compile flags for mingw Signed-off-by: Seth Flynn --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcf13c577..d61817ecf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,13 @@ else() # ATL's pack list needs more than the default 1 Mib stack on windows if(WIN32) set(CMAKE_EXE_LINKER_FLAGS "-Wl,--stack,8388608 ${CMAKE_EXE_LINKER_FLAGS}") + + # -ffunction-sections and -fdata-sections help reduce binary size + # -mguard=cf enables Control Flow Guard + # TODO: Look into -gc-sections to further reduce binary size + foreach(lang C CXX) + set("CMAKE_${lang}_FLAGS_RELEASE" "-ffunction-sections -fdata-sections -mguard=cf") + endforeach() endif() endif() From 2a403b3bfe9f4c79c38c33e80515a232576f6018 Mon Sep 17 00:00:00 2001 From: eff3ry Date: Wed, 22 Jan 2025 01:39:28 +1300 Subject: [PATCH 045/102] Edit Modrinth search faucets Edit Modrinth search faucets to alter the client and server filters to be more in-line with the Modrinth website and Launcher, making it easier to find client-side only mods etc. Signed-off-by: Jeffery Tolmie Jeffery.tolmie@gmail.com --- launcher/modplatform/modrinth/ModrinthAPI.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 3a5c21ed1..ae74545e2 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -71,13 +71,15 @@ class ModrinthAPI : public NetworkResourceAPI { static auto getSideFilters(QString side) -> const QString { - if (side.isEmpty() || side == "both") { + if (side.isEmpty()) { return {}; } + if (side == "both") + return QString("\"client_side:required\"],[\"server_side:required\""); if (side == "client") - return QString("\"client_side:required\",\"client_side:optional\""); + return QString("\"client_side:required\",\"client_side:optional\"],[\"server_side:optional\",\"server_side:unsupported\""); if (side == "server") - return QString("\"server_side:required\",\"server_side:optional\""); + return QString("\"server_side:required\",\"server_side:optional\"],[\"client_side:optional\",\"client_side:unsupported\""); return {}; } From 4ba3fd559d2664099524848825adb6f5a60650ab Mon Sep 17 00:00:00 2001 From: eff3ry Date: Wed, 22 Jan 2025 01:40:59 +1300 Subject: [PATCH 046/102] Update Filter Checks Updates the filter checks so that options both and none can be differentiated. Signed-off-by: Jeffery Tolmie Jeffery.tolmie@gmail.com --- launcher/ui/widgets/ModFilterWidget.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/launcher/ui/widgets/ModFilterWidget.cpp b/launcher/ui/widgets/ModFilterWidget.cpp index 5ae49d3a5..36afbcd87 100644 --- a/launcher/ui/widgets/ModFilterWidget.cpp +++ b/launcher/ui/widgets/ModFilterWidget.cpp @@ -279,14 +279,14 @@ void ModFilterWidget::onSideFilterChanged() { QString side; - if (ui->clientSide->isChecked() != ui->serverSide->isChecked()) { - if (ui->clientSide->isChecked()) - side = "client"; - else - side = "server"; + if (ui->clientSide->isChecked() && !ui->serverSide->isChecked()) { + side = "client"; + } else if (!ui->clientSide->isChecked() && ui->serverSide->isChecked()) { + side = "server"; + } else if (ui->clientSide->isChecked() && ui->serverSide->isChecked()) { + side = "both"; } else { - // both are checked or none are checked; in either case no filtering will happen - side = ""; + side = "none"; } m_filter_changed = side != m_filter->side; From 532fec77480fd6de608f6bb4966cf234427cc777 Mon Sep 17 00:00:00 2001 From: eff3ry Date: Wed, 22 Jan 2025 01:48:04 +1300 Subject: [PATCH 047/102] DCO Remediation Commit DCO Remediation Commit for eff3ry I, eff3ry , hereby add my Signed-off-by to this commit: 2a403b3bfe9f4c79c38c33e80515a232576f6018 I, eff3ry , hereby add my Signed-off-by to this commit: 4ba3fd559d2664099524848825adb6f5a60650ab Signed-off-by: eff3ry --- launcher/ui/widgets/ModFilterWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/ui/widgets/ModFilterWidget.cpp b/launcher/ui/widgets/ModFilterWidget.cpp index 36afbcd87..d39b7a81a 100644 --- a/launcher/ui/widgets/ModFilterWidget.cpp +++ b/launcher/ui/widgets/ModFilterWidget.cpp @@ -289,6 +289,7 @@ void ModFilterWidget::onSideFilterChanged() side = "none"; } + m_filter_changed = side != m_filter->side; m_filter->side = side; if (m_filter_changed) From caccaefb3954bbe168a032b61f2590e9e796ad8e Mon Sep 17 00:00:00 2001 From: Jeffery Tolmie Date: Wed, 22 Jan 2025 02:06:49 +1300 Subject: [PATCH 048/102] Change "none" to "" Co-authored-by: Alexandru Ionut Tripon Signed-off-by: Jeffery Tolmie --- launcher/ui/widgets/ModFilterWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/widgets/ModFilterWidget.cpp b/launcher/ui/widgets/ModFilterWidget.cpp index d39b7a81a..37211693f 100644 --- a/launcher/ui/widgets/ModFilterWidget.cpp +++ b/launcher/ui/widgets/ModFilterWidget.cpp @@ -286,7 +286,7 @@ void ModFilterWidget::onSideFilterChanged() } else if (ui->clientSide->isChecked() && ui->serverSide->isChecked()) { side = "both"; } else { - side = "none"; + side = ""; } From 705375c0dfc1e3f64a32bed182e288e55a312bbf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:35:18 +0000 Subject: [PATCH 049/102] chore(deps): update determinatesystems/magic-nix-cache-action action to v9 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index feea08543..a14b07cec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -700,7 +700,7 @@ jobs: # For PRs - name: Setup Nix Magic Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 + uses: DeterminateSystems/magic-nix-cache-action@v9 # For in-tree builds - name: Setup Cachix From 3d9e07372143e2e153688d3e4e0b1909acecbf0a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 26 Jan 2025 00:23:21 +0000 Subject: [PATCH 050/102] chore(nix): update lockfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/5df43628fdf08d642be8ba5b3625a6c70731c19c?narHash=sha256-Tbk1MZbtV2s5aG%2BiM99U8FqwxU/YNArMcWAv6clcsBc%3D' (2025-01-16) → 'github:NixOS/nixpkgs/825479c345a7f806485b7f00dbe3abb50641b083?narHash=sha256-nU6AezEX4EuahTO1YopzueAXfjFfmCHylYEFCagduHU%3D' (2025-01-24) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 01f66b974..dc07808f0 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737062831, - "narHash": "sha256-Tbk1MZbtV2s5aG+iM99U8FqwxU/YNArMcWAv6clcsBc=", + "lastModified": 1737746512, + "narHash": "sha256-nU6AezEX4EuahTO1YopzueAXfjFfmCHylYEFCagduHU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5df43628fdf08d642be8ba5b3625a6c70731c19c", + "rev": "825479c345a7f806485b7f00dbe3abb50641b083", "type": "github" }, "original": { From 1b4b36df33fe32b3fbc731b2f74bcbdbf0226146 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 26 Jan 2025 22:25:26 +0000 Subject: [PATCH 051/102] Unify Java page Signed-off-by: TheKodeToad --- launcher/CMakeLists.txt | 3 + launcher/ui/pages/global/JavaPage.cpp | 173 +-------- launcher/ui/pages/global/JavaPage.h | 15 +- launcher/ui/pages/global/JavaPage.ui | 309 +--------------- launcher/ui/widgets/JavaSettingsWidget.cpp | 309 ++++++++++++++++ launcher/ui/widgets/JavaSettingsWidget.h | 67 ++++ launcher/ui/widgets/JavaSettingsWidget.ui | 254 +++++++++++++ launcher/ui/widgets/JavaWizardWidget.cpp | 2 +- .../ui/widgets/MinecraftSettingsWidget.cpp | 333 +++++++++--------- launcher/ui/widgets/MinecraftSettingsWidget.h | 4 +- .../ui/widgets/MinecraftSettingsWidget.ui | 30 +- 11 files changed, 865 insertions(+), 634 deletions(-) create mode 100644 launcher/ui/widgets/JavaSettingsWidget.cpp create mode 100644 launcher/ui/widgets/JavaSettingsWidget.h create mode 100644 launcher/ui/widgets/JavaSettingsWidget.ui diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 28d184501..297178c88 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1124,6 +1124,8 @@ SET(LAUNCHER_SOURCES ui/widgets/ThemeCustomizationWidget.cpp ui/widgets/MinecraftSettingsWidget.h ui/widgets/MinecraftSettingsWidget.cpp + ui/widgets/JavaSettingsWidget.h + ui/widgets/JavaSettingsWidget.cpp # GUI - instance group view ui/instanceview/InstanceProxyModel.cpp @@ -1197,6 +1199,7 @@ qt_wrap_ui(LAUNCHER_UI ui/widgets/SubTaskProgressBar.ui ui/widgets/ThemeCustomizationWidget.ui ui/widgets/MinecraftSettingsWidget.ui + ui/widgets/JavaSettingsWidget.ui ui/dialogs/CopyInstanceDialog.ui ui/dialogs/ProfileSetupDialog.ui ui/dialogs/ProgressDialog.ui diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp index 0ae296815..9f681c6f1 100644 --- a/launcher/ui/pages/global/JavaPage.cpp +++ b/launcher/ui/pages/global/JavaPage.cpp @@ -62,6 +62,9 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) { ui->setupUi(this); + + m_javaSettings = new JavaSettingsWidget(nullptr, this); + ui->generalScrollArea->setWidget(m_javaSettings); if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { ui->managedJavaList->initialize(new JavaInstallList(this, true)); @@ -69,18 +72,8 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) ui->managedJavaList->selectCurrent(); ui->managedJavaList->setEmptyString(tr("No managed Java versions are installed")); ui->managedJavaList->setEmptyErrorString(tr("Couldn't load the managed Java list!")); - connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] { - ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked()); - if (!ui->autodetectJavaCheckBox->isChecked()) - ui->autodownloadCheckBox->setChecked(false); - }); - } else { - ui->autodownloadCheckBox->setHidden(true); + } else ui->tabWidget->tabBar()->hide(); - } - - loadSettings(); - updateThresholds(); } JavaPage::~JavaPage() @@ -88,117 +81,18 @@ JavaPage::~JavaPage() delete ui; } +void JavaPage::retranslate() +{ + ui->retranslateUi(this); +} + bool JavaPage::apply() { - applySettings(); + m_javaSettings->saveSettings(); + JavaCommon::checkJVMArgs(APPLICATION->settings()->get("JvmArgs").toString(), this); return true; } -void JavaPage::applySettings() -{ - auto s = APPLICATION->settings(); - - // Memory - int min = ui->minMemSpinBox->value(); - int max = ui->maxMemSpinBox->value(); - if (min < max) { - s->set("MinMemAlloc", min); - s->set("MaxMemAlloc", max); - } else { - s->set("MinMemAlloc", max); - s->set("MaxMemAlloc", min); - } - s->set("PermGen", ui->permGenSpinBox->value()); - - // Java Settings - s->set("JavaPath", ui->javaPathTextBox->text()); - s->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " ")); - s->set("IgnoreJavaCompatibility", ui->skipCompatibilityCheckbox->isChecked()); - s->set("IgnoreJavaWizard", ui->skipJavaWizardCheckbox->isChecked()); - s->set("AutomaticJavaSwitch", ui->autodetectJavaCheckBox->isChecked()); - s->set("AutomaticJavaDownload", ui->autodownloadCheckBox->isChecked()); - JavaCommon::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget()); -} -void JavaPage::loadSettings() -{ - auto s = APPLICATION->settings(); - // Memory - int min = s->get("MinMemAlloc").toInt(); - int max = s->get("MaxMemAlloc").toInt(); - if (min < max) { - ui->minMemSpinBox->setValue(min); - ui->maxMemSpinBox->setValue(max); - } else { - ui->minMemSpinBox->setValue(max); - ui->maxMemSpinBox->setValue(min); - } - ui->permGenSpinBox->setValue(s->get("PermGen").toInt()); - - // Java Settings - ui->javaPathTextBox->setText(s->get("JavaPath").toString()); - ui->jvmArgsTextBox->setPlainText(s->get("JvmArgs").toString()); - ui->skipCompatibilityCheckbox->setChecked(s->get("IgnoreJavaCompatibility").toBool()); - ui->skipJavaWizardCheckbox->setChecked(s->get("IgnoreJavaWizard").toBool()); - ui->autodetectJavaCheckBox->setChecked(s->get("AutomaticJavaSwitch").toBool()); - ui->autodownloadCheckBox->setChecked(s->get("AutomaticJavaSwitch").toBool() && s->get("AutomaticJavaDownload").toBool()); -} - -void JavaPage::on_javaDetectBtn_clicked() -{ - if (JavaUtils::getJavaCheckPath().isEmpty()) { - JavaCommon::javaCheckNotFound(this); - return; - } - - JavaInstallPtr java; - - VersionSelectDialog vselect(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); - vselect.setResizeOn(2); - vselect.exec(); - - if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) { - java = std::dynamic_pointer_cast(vselect.selectedVersion()); - ui->javaPathTextBox->setText(java->path); - if (!java->is_64bit && APPLICATION->settings()->get("MaxMemAlloc").toInt() > 2048) { - CustomMessageBox::selectable(this, tr("Confirm Selection"), - tr("You selected a 32-bit version of Java.\n" - "This installation does not support more than 2048MiB of RAM.\n" - "Please make sure that the maximum memory value is lower."), - QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok) - ->exec(); - } - } -} - -void JavaPage::on_javaBrowseBtn_clicked() -{ - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable")); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if (raw_path.isEmpty()) { - return; - } - - QString cooked_path = FS::NormalizePath(raw_path); - QFileInfo javaInfo(cooked_path); - ; - if (!javaInfo.exists() || !javaInfo.isExecutable()) { - return; - } - ui->javaPathTextBox->setText(cooked_path); -} - -void JavaPage::on_javaTestBtn_clicked() -{ - if (checker) { - return; - } - checker.reset(new JavaCommon::TestCheck(this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->toPlainText().replace("\n", " "), - ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value())); - connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished())); - checker->run(); -} - void JavaPage::on_downloadJavaButton_clicked() { auto jdialog = new Java::InstallDialog({}, nullptr, this); @@ -206,51 +100,6 @@ void JavaPage::on_downloadJavaButton_clicked() ui->managedJavaList->loadList(); } -void JavaPage::on_maxMemSpinBox_valueChanged([[maybe_unused]] int i) -{ - updateThresholds(); -} - -void JavaPage::checkerFinished() -{ - checker.reset(); -} - -void JavaPage::retranslate() -{ - ui->retranslateUi(this); -} - -void JavaPage::updateThresholds() -{ - auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; - unsigned int maxMem = ui->maxMemSpinBox->value(); - unsigned int minMem = ui->minMemSpinBox->value(); - - QString iconName; - - if (maxMem >= sysMiB) { - iconName = "status-bad"; - ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity.")); - } else if (maxMem > (sysMiB * 0.9)) { - iconName = "status-yellow"; - ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity.")); - } else if (maxMem < minMem) { - iconName = "status-yellow"; - ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value")); - } else { - iconName = "status-good"; - ui->labelMaxMemIcon->setToolTip(""); - } - - { - auto height = ui->labelMaxMemIcon->fontInfo().pixelSize(); - QIcon icon = APPLICATION->getThemedIcon(iconName); - QPixmap pix = icon.pixmap(height, height); - ui->labelMaxMemIcon->setPixmap(pix); - } -} - void JavaPage::on_removeJavaButton_clicked() { auto version = ui->managedJavaList->selectedVersion(); diff --git a/launcher/ui/pages/global/JavaPage.h b/launcher/ui/pages/global/JavaPage.h index 0a1c4a6be..75fd69e6a 100644 --- a/launcher/ui/pages/global/JavaPage.h +++ b/launcher/ui/pages/global/JavaPage.h @@ -37,6 +37,7 @@ #include #include +#include #include #include #include "JavaCommon.h" @@ -59,26 +60,16 @@ class JavaPage : public QWidget, public BasePage { QIcon icon() const override { return APPLICATION->getThemedIcon("java"); } QString id() const override { return "java-settings"; } QString helpPage() const override { return "Java-settings"; } - bool apply() override; void retranslate() override; - void updateThresholds(); - - private: - void applySettings(); - void loadSettings(); + bool apply() override; private slots: - void on_javaDetectBtn_clicked(); - void on_javaTestBtn_clicked(); - void on_javaBrowseBtn_clicked(); void on_downloadJavaButton_clicked(); void on_removeJavaButton_clicked(); void on_refreshJavaButton_clicked(); - void on_maxMemSpinBox_valueChanged(int i); - void checkerFinished(); private: Ui::JavaPage* ui; - unique_qobject_ptr checker; + JavaSettingsWidget* m_javaSettings; }; diff --git a/launcher/ui/pages/global/JavaPage.ui b/launcher/ui/pages/global/JavaPage.ui index e6bbeb15a..9baa2f6f1 100644 --- a/launcher/ui/pages/global/JavaPage.ui +++ b/launcher/ui/pages/global/JavaPage.ui @@ -40,292 +40,22 @@ - - - Memory + + + true - - - - - Ma&ximum memory allocation: - - - maxMemSpinBox - - - - - - - &PermGen: - - - permGenSpinBox - - - - - - - &Minimum memory allocation: - - - minMemSpinBox - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 256 - - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 1024 - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 4 - - - 999999999 - - - 8 - - - 64 - - - - - - - - - - maxMemSpinBox - - - - + + + + 0 + 0 + 535 + 610 + + + - - - - Java Runtime - - - - - - - 0 - 0 - - - - If enabled, the launcher will not check if an instance is compatible with the selected Java version. - - - &Skip Java compatibility checks - - - - - - - - - - 0 - 0 - - - - &Auto-detect... - - - - - - - - 0 - 0 - - - - &Test - - - - - - - - - - 0 - 0 - - - - JVM arguments: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - If enabled, the launcher will not prompt you to choose a Java version if one isn't found. - - - Skip Java &Wizard - - - - - - - true - - - - 0 - 0 - - - - - 16777215 - 100 - - - - - - - - Automatically selects the Java version that is compatible with the current Minecraft instance, based on the major version required. - - - Autodetect Java version - - - - - - - - - - 0 - 0 - - - - &Java path: - - - javaPathTextBox - - - - - - - - - - - 0 - 0 - - - - Browse - - - - - - - - - false - - - Automatically downloads and selects the Java version recommended by Mojang. - - - Auto-download Mojang Java - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -417,19 +147,6 @@ 1 - - minMemSpinBox - maxMemSpinBox - permGenSpinBox - javaPathTextBox - javaBrowseBtn - javaDetectBtn - javaTestBtn - skipCompatibilityCheckbox - skipJavaWizardCheckbox - jvmArgsTextBox - tabWidget -
diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp new file mode 100644 index 000000000..980876f35 --- /dev/null +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -0,0 +1,309 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (c) 2022 Jamie Mansfield + * Copyright (C) 2022 Sefa Eyeoglu + * Copyright (C) 2024 TheKodeToad + * + * 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 . + * + * 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 "JavaSettingsWidget.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ui_JavaSettingsWidget.h" + +JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent) + : QWidget(parent), m_instance(std::move(instance)), m_ui(new Ui::JavaSettingsWidget) +{ + m_ui->setupUi(this); + + if (m_instance == nullptr) { + m_ui->javaDownloadBtn->hide(); + if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { + connect(m_ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this](bool state) { + m_ui->autodownloadJavaCheckBox->setEnabled(state); + if (!state) + m_ui->autodownloadJavaCheckBox->setChecked(false); + }); + } else { + m_ui->autodownloadJavaCheckBox->hide(); + } + } else { + m_ui->javaDownloadBtn->setVisible(BuildConfig.JAVA_DOWNLOADER_ENABLED); + m_ui->skipWizardCheckBox->hide(); + m_ui->autodetectJavaCheckBox->hide(); + m_ui->autodownloadJavaCheckBox->hide(); + + m_ui->javaInstallationGroupBox->setCheckable(true); + m_ui->memoryGroupBox->setCheckable(true); + m_ui->javaArgumentsGroupBox->setCheckable(true); + + SettingsObjectPtr settings = m_instance->settings(); + + connect(settings->getSetting("OverrideJavaLocation").get(), &Setting::SettingChanged, m_ui->javaInstallationGroupBox, + [this, settings] { m_ui->javaInstallationGroupBox->setChecked(settings->get("OverrideJavaLocation").toBool()); }); + connect(settings->getSetting("JavaPath").get(), &Setting::SettingChanged, m_ui->javaInstallationGroupBox, + [this, settings] { m_ui->javaPathTextBox->setText(settings->get("JavaPath").toString()); }); + + connect(m_ui->javaDownloadBtn, &QPushButton::clicked, this, [this] { + auto javaDialog = new Java::InstallDialog({}, m_instance.get(), this); + javaDialog->exec(); + }); + } + + connect(m_ui->javaTestBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaTest); + connect(m_ui->javaDetectBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaAutodetect); + connect(m_ui->javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaBrowse); + + connect(m_ui->maxMemSpinBox, &QSpinBox::valueChanged, this, &JavaSettingsWidget::updateThresholds); + + loadSettings(); + updateThresholds(); +} + +JavaSettingsWidget::~JavaSettingsWidget() +{ + delete m_ui; +} + +void JavaSettingsWidget::loadSettings() +{ + SettingsObjectPtr settings; + + if (m_instance != nullptr) + settings = m_instance->settings(); + else + settings = APPLICATION->settings(); + + // Java Settings + m_ui->javaInstallationGroupBox->setChecked(settings->get("OverrideJavaLocation").toBool()); + m_ui->javaPathTextBox->setText(settings->get("JavaPath").toString()); + + m_ui->skipCompatibilityCheckBox->setChecked(settings->get("IgnoreJavaCompatibility").toBool()); + + m_ui->javaArgumentsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideJavaArgs").toBool()); + m_ui->jvmArgsTextBox->setPlainText(settings->get("JvmArgs").toString()); + + if (m_instance == nullptr) { + m_ui->skipWizardCheckBox->setChecked(settings->get("IgnoreJavaWizard").toBool()); + m_ui->autodetectJavaCheckBox->setChecked(settings->get("AutomaticJavaSwitch").toBool()); + m_ui->autodetectJavaCheckBox->stateChanged(m_ui->autodetectJavaCheckBox->isChecked()); + m_ui->autodownloadJavaCheckBox->setChecked(settings->get("AutomaticJavaDownload").toBool()); + } + + // Memory + m_ui->memoryGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideMemory").toBool()); + int min = settings->get("MinMemAlloc").toInt(); + int max = settings->get("MaxMemAlloc").toInt(); + if (min < max) { + m_ui->minMemSpinBox->setValue(min); + m_ui->maxMemSpinBox->setValue(max); + } else { + m_ui->minMemSpinBox->setValue(max); + m_ui->maxMemSpinBox->setValue(min); + } + m_ui->permGenSpinBox->setValue(settings->get("PermGen").toInt()); + + // Java arguments + m_ui->javaArgumentsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideJavaArgs").toBool()); + m_ui->jvmArgsTextBox->setPlainText(settings->get("JvmArgs").toString()); +} + +void JavaSettingsWidget::saveSettings() +{ + SettingsObjectPtr settings; + + if (m_instance != nullptr) + settings = m_instance->settings(); + else + settings = APPLICATION->settings(); + + SettingsObject::Lock lock(settings); + + // Java Install Settings + bool javaInstall = m_instance == nullptr || m_ui->javaInstallationGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideJavaLocation", javaInstall); + + if (javaInstall) { + settings->set("JavaPath", m_ui->javaPathTextBox->text()); + settings->set("IgnoreJavaCompatibility", m_ui->skipCompatibilityCheckBox->isChecked()); + } else { + settings->reset("JavaPath"); + settings->reset("IgnoreJavaCompatibility"); + } + + if (m_instance == nullptr) { + settings->set("IgnoreJavaWizard", m_ui->skipWizardCheckBox->isChecked()); + settings->set("AutomaticJavaSwitch", m_ui->autodetectJavaCheckBox->isChecked()); + settings->set("AutomaticJavaDownload", m_ui->autodownloadJavaCheckBox->isChecked()); + } + + // Memory + bool memory = m_instance == nullptr || m_ui->memoryGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideMemory", memory); + + if (memory) { + int min = m_ui->minMemSpinBox->value(); + int max = m_ui->maxMemSpinBox->value(); + if (min < max) { + settings->set("MinMemAlloc", min); + settings->set("MaxMemAlloc", max); + } else { + settings->set("MinMemAlloc", max); + settings->set("MaxMemAlloc", min); + } + settings->set("PermGen", m_ui->permGenSpinBox->value()); + } else { + settings->reset("MinMemAlloc"); + settings->reset("MaxMemAlloc"); + settings->reset("PermGen"); + } + + // Java arguments + bool javaArgs = m_instance == nullptr || m_ui->javaArgumentsGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideJavaArgs", javaArgs); + + if (javaArgs) { + settings->set("JvmArgs", m_ui->jvmArgsTextBox->toPlainText().replace("\n", " ")); + } else { + settings->reset("JvmArgs"); + } +} + +void JavaSettingsWidget::onJavaBrowse() +{ + QString rawPath = QFileDialog::getOpenFileName(this, tr("Find Java executable")); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (rawPath.isEmpty()) { + return; + } + + QString cookedPath = FS::NormalizePath(rawPath); + QFileInfo javaInfo(cookedPath); + if (!javaInfo.exists() || !javaInfo.isExecutable()) { + return; + } + m_ui->javaPathTextBox->setText(cookedPath); +} + +void JavaSettingsWidget::onJavaTest() +{ + if (m_checker != nullptr) + return; + + QString jvmArgs; + + if (m_instance == nullptr || m_ui->javaArgumentsGroupBox->isChecked()) + jvmArgs = m_ui->jvmArgsTextBox->toPlainText().replace("\n", " "); + else + jvmArgs = APPLICATION->settings()->get("JvmArgs").toString(); + + m_checker.reset(new JavaCommon::TestCheck(this, m_ui->javaPathTextBox->text(), jvmArgs, m_ui->minMemSpinBox->value(), + m_ui->maxMemSpinBox->value(), m_ui->permGenSpinBox->value())); + connect(m_checker.get(), &JavaCommon::TestCheck::finished, this, [this] { m_checker.reset(); }); + m_checker->run(); +} + +void JavaSettingsWidget::onJavaAutodetect() +{ + if (JavaUtils::getJavaCheckPath().isEmpty()) { + JavaCommon::javaCheckNotFound(this); + return; + } + + VersionSelectDialog versionDialog(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); + versionDialog.setResizeOn(2); + versionDialog.exec(); + + if (versionDialog.result() == QDialog::Accepted && versionDialog.selectedVersion()) { + JavaInstallPtr java = std::dynamic_pointer_cast(versionDialog.selectedVersion()); + m_ui->javaPathTextBox->setText(java->path); + + if (!java->is_64bit && m_ui->maxMemSpinBox->value() > 2048) { + CustomMessageBox::selectable(this, tr("Confirm Selection"), + tr("You selected a 32-bit version of Java.\n" + "This installation does not support more than 2048MiB of RAM.\n" + "Please make sure that the maximum memory value is lower."), + QMessageBox::Warning, QMessageBox::Ok, QMessageBox::Ok) + ->exec(); + } + } +} +void JavaSettingsWidget::updateThresholds() +{ + auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; + unsigned int maxMem = m_ui->maxMemSpinBox->value(); + unsigned int minMem = m_ui->minMemSpinBox->value(); + + QString iconName; + + if (maxMem >= sysMiB) { + iconName = "status-bad"; + m_ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation exceeds your system memory capacity.")); + } else if (maxMem > (sysMiB * 0.9)) { + iconName = "status-yellow"; + m_ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation approaches your system memory capacity.")); + } else if (maxMem < minMem) { + iconName = "status-yellow"; + m_ui->labelMaxMemIcon->setToolTip(tr("Your maximum memory allocation is smaller than the minimum value")); + } else { + iconName = "status-good"; + m_ui->labelMaxMemIcon->setToolTip(""); + } + + { + auto height = m_ui->labelMaxMemIcon->fontInfo().pixelSize(); + QIcon icon = APPLICATION->getThemedIcon(iconName); + QPixmap pix = icon.pixmap(height, height); + m_ui->labelMaxMemIcon->setPixmap(pix); + } +} diff --git a/launcher/ui/widgets/JavaSettingsWidget.h b/launcher/ui/widgets/JavaSettingsWidget.h new file mode 100644 index 000000000..433a5f19f --- /dev/null +++ b/launcher/ui/widgets/JavaSettingsWidget.h @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (c) 2022 Jamie Mansfield + * Copyright (C) 2024 TheKodeToad + * + * 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 . + * + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace Ui { +class JavaSettingsWidget; +} + +class JavaSettingsWidget : public QWidget { + Q_OBJECT + + public: + explicit JavaSettingsWidget(InstancePtr instance, QWidget* parent = nullptr); + ~JavaSettingsWidget() override; + + void loadSettings(); + void saveSettings(); + + private slots: + void onJavaBrowse(); + void onJavaAutodetect(); + void onJavaTest(); + void updateThresholds(); + + private: + InstancePtr m_instance; + Ui::JavaSettingsWidget* m_ui; + unique_qobject_ptr m_checker; +}; diff --git a/launcher/ui/widgets/JavaSettingsWidget.ui b/launcher/ui/widgets/JavaSettingsWidget.ui new file mode 100644 index 000000000..a68059907 --- /dev/null +++ b/launcher/ui/widgets/JavaSettingsWidget.ui @@ -0,0 +1,254 @@ + + + JavaSettingsWidget + + + + 0 + 0 + 500 + 600 + + + + Form + + + + + + true + + + Java Insta&llation + + + false + + + false + + + + + + Auto-&detect Java version + + + + + + + + + + + + Browse + + + + + + + + + + + Download Java + + + + + + + Auto-detect... + + + + + + + Test + + + + + + + + + Automatically downloads and selects the Java build recommended by Mojang. + + + Auto-download &Mojang Java + + + + + + + If enabled, the launcher won't prompt you to choose a Java version if one is not found on startup. + + + Skip Java setup prompt on startup + + + + + + + If enabled, the launcher will not check if an instance is compatible with the selected Java version. + + + Skip Java compatibility checks + + + + + + + + + + true + + + Memor&y + + + false + + + false + + + + + + PermGen (Java 7 and earlier): + + + + + + + Minimum memory allocation: + + + + + + + The amount of memory available to store loaded Java classes. + + + MiB + + + 4 + + + 999999999 + + + 8 + + + 64 + + + + + + + Maximum memory allocation: + + + + + + + + + + Qt::AlignCenter + + + maxMemSpinBox + + + + + + + The maximum amount of memory Minecraft is allowed to use. + + + MiB + + + 8 + + + 1048576 + + + 128 + + + 1024 + + + + + + + The amount of memory Minecraft is started with. + + + MiB + + + 8 + + + 1048576 + + + 128 + + + 256 + + + + + + + + + + true + + + Java Argumen&ts + + + false + + + false + + + + + + + + + + + + + diff --git a/launcher/ui/widgets/JavaWizardWidget.cpp b/launcher/ui/widgets/JavaWizardWidget.cpp index edf49fab8..2d7f7840d 100644 --- a/launcher/ui/widgets/JavaWizardWidget.cpp +++ b/launcher/ui/widgets/JavaWizardWidget.cpp @@ -502,7 +502,7 @@ void JavaWizardWidget::retranslate() if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { m_autodownloadCheckBox->setText(tr("Auto-download Mojang Java")); } - m_autodetectJavaCheckBox->setText(tr("Autodetect Java version")); + m_autodetectJavaCheckBox->setText(tr("Auto-detect Java version")); m_autoJavaGroupBox->setTitle(tr("Autodetect Java")); } diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index cfe7a49c1..a49ab2dca 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -47,12 +47,20 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* m_ui->setupUi(this); if (m_instance == nullptr) { - // Java - m_ui->settingsTabs->removeTab(1); - // Launch - m_ui->settingsTabs->removeTab(2); + for (int i = 0; i < m_ui->settingsTabs->count(); ++i) { + const QString name = m_ui->settingsTabs->widget(i)->objectName(); + + if (name == "javaTab" || name == "launchTab") { + m_ui->settingsTabs->removeTab(i); + --i; + } + } + m_ui->openGlobalSettingsButton->setVisible(false); } else { + m_javaSettings = new JavaSettingsWidget(m_instance, this); + m_ui->javaScrollArea->setWidget(m_javaSettings); + m_ui->showGameTime->setText(tr("Show time &playing this instance")); m_ui->recordGameTime->setText(tr("&Record time playing this instance")); m_ui->showGlobalGameTime->hide(); @@ -63,6 +71,14 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* "not fully supported on this Minecraft version.")); connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings); + + m_ui->miscellaneousSettingsBox->setCheckable(true); + m_ui->consoleSettingsBox->setCheckable(true); + m_ui->windowSizeGroupBox->setCheckable(true); + m_ui->nativeWorkaroundsGroupBox->setCheckable(true); + m_ui->perfomanceGroupBox->setCheckable(true); + m_ui->gameTimeGroupBox->setCheckable(true); + m_ui->legacySettingsGroupBox->setCheckable(true); } m_ui->maximizedWarning->hide(); @@ -84,29 +100,34 @@ MinecraftSettingsWidget::~MinecraftSettingsWidget() void MinecraftSettingsWidget::loadSettings() { - const SettingsObjectPtr settings = getSettings(); + SettingsObjectPtr settings; + + if (m_instance != nullptr) + settings = m_instance->settings(); + else + settings = APPLICATION->settings(); // Miscellaneous - m_ui->miscellaneousSettingsBox->setCheckable(m_instance != nullptr); m_ui->miscellaneousSettingsBox->setChecked(settings->get("OverrideMiscellaneous").toBool()); m_ui->closeAfterLaunchCheck->setChecked(settings->get("CloseAfterLaunch").toBool()); m_ui->quitAfterGameStopCheck->setChecked(settings->get("QuitAfterGameStop").toBool()); // Console - m_ui->consoleSettingsBox->setCheckable(m_instance != nullptr); m_ui->consoleSettingsBox->setChecked(m_instance == nullptr || settings->get("OverrideConsole").toBool()); m_ui->showConsoleCheck->setChecked(settings->get("ShowConsole").toBool()); m_ui->autoCloseConsoleCheck->setChecked(settings->get("AutoCloseConsole").toBool()); m_ui->showConsoleErrorCheck->setChecked(settings->get("ShowConsoleOnError").toBool()); // Window Size - m_ui->windowSizeGroupBox->setCheckable(m_instance != nullptr); m_ui->windowSizeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideWindow").toBool()); m_ui->windowSizeGroupBox->setChecked(settings->get("OverrideWindow").toBool()); m_ui->maximizedCheckBox->setChecked(settings->get("LaunchMaximized").toBool()); m_ui->windowWidthSpinBox->setValue(settings->get("MinecraftWinWidth").toInt()); m_ui->windowHeightSpinBox->setValue(settings->get("MinecraftWinHeight").toInt()); + if (m_javaSettings != nullptr) + m_javaSettings->loadSettings(); + // Custom commands m_ui->customCommands->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideCommands").toBool(), settings->get("PreLaunchCommand").toString(), settings->get("WrapperCommand").toString(), @@ -117,7 +138,6 @@ void MinecraftSettingsWidget::loadSettings() settings->get("Env").toMap()); // Workarounds - m_ui->nativeWorkaroundsGroupBox->setCheckable(m_instance != nullptr); m_ui->nativeWorkaroundsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideNativeWorkarounds").toBool()); m_ui->useNativeGLFWCheck->setChecked(settings->get("UseNativeGLFW").toBool()); m_ui->lineEditGLFWPath->setText(settings->get("CustomGLFWPath").toString()); @@ -135,7 +155,6 @@ void MinecraftSettingsWidget::loadSettings() #endif // Performance - m_ui->perfomanceGroupBox->setCheckable(m_instance != nullptr); m_ui->perfomanceGroupBox->setChecked(m_instance == nullptr || settings->get("OverridePerformance").toBool()); m_ui->enableFeralGamemodeCheck->setChecked(settings->get("EnableFeralGamemode").toBool()); m_ui->enableMangoHud->setChecked(settings->get("EnableMangoHud").toBool()); @@ -153,164 +172,170 @@ void MinecraftSettingsWidget::loadSettings() } // Miscellanous - m_ui->gameTimeGroupBox->setCheckable(m_instance != nullptr); m_ui->gameTimeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideGameTime").toBool()); m_ui->showGameTime->setChecked(settings->get("ShowGameTime").toBool()); m_ui->recordGameTime->setChecked(settings->get("RecordGameTime").toBool()); - m_ui->showGlobalGameTime->setChecked(m_instance != nullptr && settings->get("ShowGlobalGameTime").toBool()); - m_ui->showGameTimeWithoutDays->setChecked(m_instance != nullptr && settings->get("ShowGameTimeWithoutDays").toBool()); + m_ui->showGlobalGameTime->setChecked(m_instance == nullptr && settings->get("ShowGlobalGameTime").toBool()); + m_ui->showGameTimeWithoutDays->setChecked(m_instance == nullptr && settings->get("ShowGameTimeWithoutDays").toBool()); - m_ui->legacySettingsGroupBox->setCheckable(m_instance != nullptr); m_ui->legacySettingsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideLegacySettings").toBool()); m_ui->onlineFixes->setChecked(settings->get("OnlineFixes").toBool()); } void MinecraftSettingsWidget::saveSettings() { - SettingsObjectPtr settings = getSettings(); - SettingsObject::Lock lock(settings); - - // Miscellaneous - bool miscellaneous = m_instance == nullptr || m_ui->miscellaneousSettingsBox->isChecked(); + SettingsObjectPtr settings; if (m_instance != nullptr) - settings->set("OverrideMiscellaneous", miscellaneous); - - if (miscellaneous) { - settings->set("CloseAfterLaunch", m_ui->closeAfterLaunchCheck->isChecked()); - settings->set("QuitAfterGameStop", m_ui->quitAfterGameStopCheck->isChecked()); - } else { - settings->reset("CloseAfterLaunch"); - settings->reset("QuitAfterGameStop"); - } - - // Console - bool console = m_instance == nullptr || m_ui->consoleSettingsBox->isChecked(); - - if (m_instance != nullptr) - settings->set("OverrideConsole", console); - - if (console) { - settings->set("ShowConsole", m_ui->showConsoleCheck->isChecked()); - settings->set("AutoCloseConsole", m_ui->autoCloseConsoleCheck->isChecked()); - settings->set("ShowConsoleOnError", m_ui->showConsoleErrorCheck->isChecked()); - } else { - settings->reset("ShowConsole"); - settings->reset("AutoCloseConsole"); - settings->reset("ShowConsoleOnError"); - } - - // Window Size - bool window = m_instance == nullptr || m_ui->windowSizeGroupBox->isChecked(); - - if (m_instance != nullptr) - settings->set("OverrideWindow", window); - - if (window) { - settings->set("LaunchMaximized", m_ui->maximizedCheckBox->isChecked()); - settings->set("MinecraftWinWidth", m_ui->windowWidthSpinBox->value()); - settings->set("MinecraftWinHeight", m_ui->windowHeightSpinBox->value()); - } else { - settings->reset("LaunchMaximized"); - settings->reset("MinecraftWinWidth"); - settings->reset("MinecraftWinHeight"); - } - - // Custom Commands - bool custcmd = m_instance == nullptr || m_ui->customCommands->checked(); - - if (m_instance != nullptr) - settings->set("OverrideCommands", custcmd); - - if (custcmd) { - settings->set("PreLaunchCommand", m_ui->customCommands->prelaunchCommand()); - settings->set("WrapperCommand", m_ui->customCommands->wrapperCommand()); - settings->set("PostExitCommand", m_ui->customCommands->postexitCommand()); - } else { - settings->reset("PreLaunchCommand"); - settings->reset("WrapperCommand"); - settings->reset("PostExitCommand"); - } - - // Environment Variables - auto env = m_instance == nullptr || m_ui->environmentVariables->override(); - - if (m_instance != nullptr) - settings->set("OverrideEnv", env); - - if (env) - settings->set("Env", m_ui->environmentVariables->value()); + settings = m_instance->settings(); else - settings->reset("Env"); + settings = APPLICATION->settings(); - // Workarounds - bool workarounds = m_instance == nullptr || m_ui->nativeWorkaroundsGroupBox->isChecked(); + { + SettingsObject::Lock lock(settings); - if (m_instance != nullptr) - settings->set("OverrideNativeWorkarounds", workarounds); + // Miscellaneous + bool miscellaneous = m_instance == nullptr || m_ui->miscellaneousSettingsBox->isChecked(); - if (workarounds) { - settings->set("UseNativeGLFW", m_ui->useNativeGLFWCheck->isChecked()); - settings->set("CustomGLFWPath", m_ui->lineEditGLFWPath->text()); - settings->set("UseNativeOpenAL", m_ui->useNativeOpenALCheck->isChecked()); - settings->set("CustomOpenALPath", m_ui->lineEditOpenALPath->text()); - } else { - settings->reset("UseNativeGLFW"); - settings->reset("CustomGLFWPath"); - settings->reset("UseNativeOpenAL"); - settings->reset("CustomOpenALPath"); + if (m_instance != nullptr) + settings->set("OverrideMiscellaneous", miscellaneous); + + if (miscellaneous) { + settings->set("CloseAfterLaunch", m_ui->closeAfterLaunchCheck->isChecked()); + settings->set("QuitAfterGameStop", m_ui->quitAfterGameStopCheck->isChecked()); + } else { + settings->reset("CloseAfterLaunch"); + settings->reset("QuitAfterGameStop"); + } + + // Console + bool console = m_instance == nullptr || m_ui->consoleSettingsBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideConsole", console); + + if (console) { + settings->set("ShowConsole", m_ui->showConsoleCheck->isChecked()); + settings->set("AutoCloseConsole", m_ui->autoCloseConsoleCheck->isChecked()); + settings->set("ShowConsoleOnError", m_ui->showConsoleErrorCheck->isChecked()); + } else { + settings->reset("ShowConsole"); + settings->reset("AutoCloseConsole"); + settings->reset("ShowConsoleOnError"); + } + + // Window Size + bool window = m_instance == nullptr || m_ui->windowSizeGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideWindow", window); + + if (window) { + settings->set("LaunchMaximized", m_ui->maximizedCheckBox->isChecked()); + settings->set("MinecraftWinWidth", m_ui->windowWidthSpinBox->value()); + settings->set("MinecraftWinHeight", m_ui->windowHeightSpinBox->value()); + } else { + settings->reset("LaunchMaximized"); + settings->reset("MinecraftWinWidth"); + settings->reset("MinecraftWinHeight"); + } + + // Custom Commands + bool custcmd = m_instance == nullptr || m_ui->customCommands->checked(); + + if (m_instance != nullptr) + settings->set("OverrideCommands", custcmd); + + if (custcmd) { + settings->set("PreLaunchCommand", m_ui->customCommands->prelaunchCommand()); + settings->set("WrapperCommand", m_ui->customCommands->wrapperCommand()); + settings->set("PostExitCommand", m_ui->customCommands->postexitCommand()); + } else { + settings->reset("PreLaunchCommand"); + settings->reset("WrapperCommand"); + settings->reset("PostExitCommand"); + } + + // Environment Variables + auto env = m_instance == nullptr || m_ui->environmentVariables->override(); + + if (m_instance != nullptr) + settings->set("OverrideEnv", env); + + if (env) + settings->set("Env", m_ui->environmentVariables->value()); + else + settings->reset("Env"); + + // Workarounds + bool workarounds = m_instance == nullptr || m_ui->nativeWorkaroundsGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideNativeWorkarounds", workarounds); + + if (workarounds) { + settings->set("UseNativeGLFW", m_ui->useNativeGLFWCheck->isChecked()); + settings->set("CustomGLFWPath", m_ui->lineEditGLFWPath->text()); + settings->set("UseNativeOpenAL", m_ui->useNativeOpenALCheck->isChecked()); + settings->set("CustomOpenALPath", m_ui->lineEditOpenALPath->text()); + } else { + settings->reset("UseNativeGLFW"); + settings->reset("CustomGLFWPath"); + settings->reset("UseNativeOpenAL"); + settings->reset("CustomOpenALPath"); + } + + // Performance + bool performance = m_instance == nullptr || m_ui->perfomanceGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverridePerformance", performance); + + if (performance) { + settings->set("EnableFeralGamemode", m_ui->enableFeralGamemodeCheck->isChecked()); + settings->set("EnableMangoHud", m_ui->enableMangoHud->isChecked()); + settings->set("UseDiscreteGpu", m_ui->useDiscreteGpuCheck->isChecked()); + settings->set("UseZink", m_ui->useZink->isChecked()); + } else { + settings->reset("EnableFeralGamemode"); + settings->reset("EnableMangoHud"); + settings->reset("UseDiscreteGpu"); + settings->reset("UseZink"); + } + + // Game time + bool gameTime = m_instance == nullptr || m_ui->gameTimeGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideGameTime", gameTime); + + if (gameTime) { + settings->set("ShowGameTime", m_ui->showGameTime->isChecked()); + settings->set("RecordGameTime", m_ui->recordGameTime->isChecked()); + } else { + settings->reset("ShowGameTime"); + settings->reset("RecordGameTime"); + } + + if (m_instance == nullptr) { + settings->set("ShowGlobalGameTime", m_ui->showGlobalGameTime->isChecked()); + settings->set("ShowGameTimeWithoutDays", m_ui->showGameTimeWithoutDays->isChecked()); + } + + bool overrideLegacySettings = m_instance == nullptr || m_ui->legacySettingsGroupBox->isChecked(); + + if (m_instance != nullptr) + settings->set("OverrideLegacySettings", overrideLegacySettings); + + if (overrideLegacySettings) { + settings->set("OnlineFixes", m_ui->onlineFixes->isChecked()); + } else { + settings->reset("OnlineFixes"); + } } - // Performance - bool performance = m_instance == nullptr || m_ui->perfomanceGroupBox->isChecked(); - - if (m_instance != nullptr) - settings->set("OverridePerformance", performance); - - if (performance) { - settings->set("EnableFeralGamemode", m_ui->enableFeralGamemodeCheck->isChecked()); - settings->set("EnableMangoHud", m_ui->enableMangoHud->isChecked()); - settings->set("UseDiscreteGpu", m_ui->useDiscreteGpuCheck->isChecked()); - settings->set("UseZink", m_ui->useZink->isChecked()); - } else { - settings->reset("EnableFeralGamemode"); - settings->reset("EnableMangoHud"); - settings->reset("UseDiscreteGpu"); - settings->reset("UseZink"); - } - - // Game time - bool gameTime = m_instance == nullptr || m_ui->gameTimeGroupBox->isChecked(); - - if (m_instance != nullptr) - settings->set("OverrideGameTime", gameTime); - - if (gameTime) { - settings->set("ShowGameTime", m_ui->showGameTime->isChecked()); - settings->set("RecordGameTime", m_ui->recordGameTime->isChecked()); - } else { - settings->reset("ShowGameTime"); - settings->reset("RecordGameTime"); - } - - if (m_instance == nullptr) { - settings->set("ShowGlobalGameTime", m_ui->showGlobalGameTime->isChecked()); - settings->set("ShowGameTimeWithoutDays", m_ui->showGameTimeWithoutDays->isChecked()); - } - - bool overrideLegacySettings = m_instance == nullptr || m_ui->legacySettingsGroupBox->isChecked(); - - if (m_instance != nullptr) - settings->set("OverrideLegacySettings", overrideLegacySettings); - - if (overrideLegacySettings) { - settings->set("OnlineFixes", m_ui->onlineFixes->isChecked()); - } else { - settings->reset("OnlineFixes"); - } - - if (m_instance != nullptr) - m_instance->updateRuntimeContext(); + if (m_javaSettings != nullptr) + m_javaSettings->saveSettings(); } void MinecraftSettingsWidget::openGlobalSettings() @@ -322,11 +347,3 @@ void MinecraftSettingsWidget::openGlobalSettings() else // TODO select tab APPLICATION->ShowGlobalSettings(this, "minecraft-settings"); } - -SettingsObjectPtr MinecraftSettingsWidget::getSettings() const -{ - if (m_instance != nullptr) - return m_instance->settings(); - - return APPLICATION->settings(); -} diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.h b/launcher/ui/widgets/MinecraftSettingsWidget.h index a76ff647a..a7491770a 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -38,6 +38,7 @@ #include #include +#include "JavaSettingsWidget.h" namespace Ui { class MinecraftSettingsWidget; @@ -54,8 +55,7 @@ class MinecraftSettingsWidget : public QWidget { void openGlobalSettings(); private: - SettingsObjectPtr getSettings() const; - InstancePtr m_instance; Ui::MinecraftSettingsWidget* m_ui; + JavaSettingsWidget* m_javaSettings = nullptr; }; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index 78fae9639..0acd34815 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -63,7 +63,7 @@ 0 0 610 - 607 + 550 @@ -282,6 +282,30 @@ + + + Java + + + + + + true + + + + + 0 + 0 + 624 + 297 + + + + + + + Tweaks @@ -301,7 +325,7 @@ 0 0 610 - 439 + 398 @@ -489,7 +513,7 @@ 0 0 624 - 291 + 297 From 36a35d792515b57ad589a879011e5cb2f8728ddf Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 26 Jan 2025 22:34:50 +0000 Subject: [PATCH 052/102] Fix tab order Signed-off-by: TheKodeToad --- launcher/ui/widgets/JavaSettingsWidget.ui | 15 ++++++++++ .../ui/widgets/MinecraftSettingsWidget.ui | 29 +++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/launcher/ui/widgets/JavaSettingsWidget.ui b/launcher/ui/widgets/JavaSettingsWidget.ui index a68059907..15ce88f0c 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.ui +++ b/launcher/ui/widgets/JavaSettingsWidget.ui @@ -249,6 +249,21 @@ + + javaPathTextBox + javaBrowseBtn + javaDownloadBtn + javaDetectBtn + javaTestBtn + skipCompatibilityCheckBox + skipWizardCheckBox + autodetectJavaCheckBox + autodownloadJavaCheckBox + minMemSpinBox + maxMemSpinBox + permGenSpinBox + jvmArgsTextBox + diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index 0acd34815..309758423 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -645,16 +645,41 @@ + openGlobalSettingsButton + settingsTabs + scrollArea maximizedCheckBox windowWidthSpinBox windowHeightSpinBox + showGameTime + recordGameTime + showGlobalGameTime + showGameTimeWithoutDays showConsoleCheck autoCloseConsoleCheck showConsoleErrorCheck - useNativeGLFWCheck - useNativeOpenALCheck closeAfterLaunchCheck quitAfterGameStopCheck + javaScrollArea + scrollArea_2 + onlineFixes + useNativeGLFWCheck + lineEditGLFWPath + useNativeOpenALCheck + lineEditOpenALPath + perfomanceGroupBox + enableFeralGamemodeCheck + enableMangoHud + useDiscreteGpuCheck + useZink + scrollArea_3 + instanceAccountGroupBox + instanceAccountSelector + serverJoinGroupBox + serverJoinAddressButton + serverJoinAddress + worldJoinButton + worldsCb From 39ae2fbd4a8b59ccbdb369c5755584e5b4d9eff3 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 26 Jan 2025 22:44:43 +0000 Subject: [PATCH 053/102] Fix tab inconsistencies Signed-off-by: TheKodeToad --- launcher/ui/widgets/MinecraftSettingsWidget.cpp | 4 +++- launcher/ui/widgets/MinecraftSettingsWidget.ui | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index a49ab2dca..9a2b9b10c 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -50,7 +50,7 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* for (int i = 0; i < m_ui->settingsTabs->count(); ++i) { const QString name = m_ui->settingsTabs->widget(i)->objectName(); - if (name == "javaTab" || name == "launchTab") { + if (name == "javaPage" || name == "launchPage") { m_ui->settingsTabs->removeTab(i); --i; } @@ -342,6 +342,8 @@ void MinecraftSettingsWidget::openGlobalSettings() { const QString id = m_ui->settingsTabs->currentWidget()->objectName(); + qDebug() << id; + if (id == "javaPage") APPLICATION->ShowGlobalSettings(this, "java-settings"); else // TODO select tab diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index 309758423..d9949b173 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -282,7 +282,7 @@ - + Java From 9d0918a0646c184cc5e40aa75e9d4ed1729291a1 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 13:19:10 +0000 Subject: [PATCH 054/102] Remove outdated JavaWizardWidget comment Signed-off-by: TheKodeToad --- launcher/ui/widgets/JavaWizardWidget.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/launcher/ui/widgets/JavaWizardWidget.h b/launcher/ui/widgets/JavaWizardWidget.h index 9c76c0610..69f093000 100644 --- a/launcher/ui/widgets/JavaWizardWidget.h +++ b/launcher/ui/widgets/JavaWizardWidget.h @@ -19,9 +19,6 @@ class QLabel; class QToolButton; class QSpacerItem; -/** - * This is a widget for all the Java settings dialogs and pages. - */ class JavaWizardWidget : public QWidget { Q_OBJECT From 147b315c14dd02b3bc06e63800853d44336562f6 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 14:15:07 +0000 Subject: [PATCH 055/102] Update thresholds when min. memory value is changed too Signed-off-by: TheKodeToad --- launcher/ui/widgets/JavaSettingsWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp index 980876f35..6602aea11 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -98,6 +98,7 @@ JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent) connect(m_ui->javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaBrowse); connect(m_ui->maxMemSpinBox, &QSpinBox::valueChanged, this, &JavaSettingsWidget::updateThresholds); + connect(m_ui->minMemSpinBox, &QSpinBox::valueChanged, this, &JavaSettingsWidget::updateThresholds); loadSettings(); updateThresholds(); From 81769b904760a8d28db67738c41ba3cf1c3e8aa4 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 14:34:07 +0000 Subject: [PATCH 056/102] Use MinecraftInstancePtr instance of InstancePtr Signed-off-by: TheKodeToad --- launcher/ui/pages/instance/InstanceSettingsPage.h | 2 +- launcher/ui/widgets/MinecraftSettingsWidget.cpp | 2 +- launcher/ui/widgets/MinecraftSettingsWidget.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.h b/launcher/ui/pages/instance/InstanceSettingsPage.h index b13dc572f..e778a0c9c 100644 --- a/launcher/ui/pages/instance/InstanceSettingsPage.h +++ b/launcher/ui/pages/instance/InstanceSettingsPage.h @@ -45,7 +45,7 @@ class InstanceSettingsPage : public MinecraftSettingsWidget, public BasePage { Q_OBJECT public: - explicit InstanceSettingsPage(InstancePtr instance, QWidget* parent = nullptr) : MinecraftSettingsWidget(std::move(instance), parent) + explicit InstanceSettingsPage(MinecraftInstancePtr instance, QWidget* parent = nullptr) : MinecraftSettingsWidget(std::move(instance), parent) { connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::saveSettings); connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index 9a2b9b10c..606dee21a 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -41,7 +41,7 @@ #include "settings/Setting.h" #include "ui_MinecraftSettingsWidget.h" -MinecraftSettingsWidget::MinecraftSettingsWidget(InstancePtr instance, QWidget* parent) +MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance, QWidget* parent) : QWidget(parent), m_instance(std::move(instance)), m_ui(new Ui::MinecraftSettingsWidget) { m_ui->setupUi(this); diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.h b/launcher/ui/widgets/MinecraftSettingsWidget.h index a7491770a..710ce8249 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -46,7 +46,7 @@ class MinecraftSettingsWidget; class MinecraftSettingsWidget : public QWidget { public: - MinecraftSettingsWidget(InstancePtr instance, QWidget* parent = nullptr); + MinecraftSettingsWidget(MinecraftInstancePtr instance, QWidget* parent = nullptr); ~MinecraftSettingsWidget() override; void loadSettings(); @@ -55,7 +55,7 @@ class MinecraftSettingsWidget : public QWidget { void openGlobalSettings(); private: - InstancePtr m_instance; + MinecraftInstancePtr m_instance; Ui::MinecraftSettingsWidget* m_ui; JavaSettingsWidget* m_javaSettings = nullptr; }; From 7aaa9fa93cc333a5f20184cc34c913260768895d Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 16:46:26 +0000 Subject: [PATCH 057/102] Finish off MinecraftSettingsWidget implementation Signed-off-by: TheKodeToad --- .../ui/widgets/MinecraftSettingsWidget.cpp | 170 ++++++++++++++---- launcher/ui/widgets/MinecraftSettingsWidget.h | 7 +- .../ui/widgets/MinecraftSettingsWidget.ui | 6 +- 3 files changed, 148 insertions(+), 35 deletions(-) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index 606dee21a..ea9506d75 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -36,8 +36,10 @@ */ #include "MinecraftSettingsWidget.h" -#include +#include "Application.h" +#include "minecraft/WorldList.h" +#include "minecraft/auth/AccountList.h" #include "settings/Setting.h" #include "ui_MinecraftSettingsWidget.h" @@ -70,8 +72,6 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance, tr("Warning: The maximized option is " "not fully supported on this Minecraft version.")); - connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings); - m_ui->miscellaneousSettingsBox->setCheckable(true); m_ui->consoleSettingsBox->setCheckable(true); m_ui->windowSizeGroupBox->setCheckable(true); @@ -79,6 +79,25 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance, m_ui->perfomanceGroupBox->setCheckable(true); m_ui->gameTimeGroupBox->setCheckable(true); m_ui->legacySettingsGroupBox->setCheckable(true); + + m_quickPlaySingleplayer = m_instance->traits().contains("feature:is_quick_play_singleplayer"); + if (m_quickPlaySingleplayer) { + auto worlds = m_instance->worldList(); + worlds->update(); + for (const auto& world : worlds->allWorlds()) { + m_ui->worldsCb->addItem(world.folderName()); + } + } else { + m_ui->worldsCb->hide(); + m_ui->worldJoinButton->hide(); + m_ui->serverJoinAddressButton->setChecked(true); + m_ui->serverJoinAddress->setEnabled(true); + m_ui->serverJoinAddressButton->setStyleSheet("QRadioButton::indicator { width: 0px; height: 0px; }"); + } + + connect(m_ui->openGlobalSettingsButton, &QCommandLinkButton::clicked, this, &MinecraftSettingsWidget::openGlobalSettings); + connect(m_ui->serverJoinAddressButton, &QAbstractButton::toggled, m_ui->serverJoinAddress, &QWidget::setEnabled); + connect(m_ui->worldJoinButton, &QAbstractButton::toggled, m_ui->worldsCb, &QWidget::setEnabled); } m_ui->maximizedWarning->hide(); @@ -90,6 +109,19 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance, m_ui->perfomanceGroupBox->hide(); #endif + if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { + m_ui->enableFeralGamemodeCheck->setDisabled(true); + m_ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system.")); + } + + if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) { + m_ui->enableMangoHud->setEnabled(false); + m_ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system.")); + } + + connect(m_ui->useNativeOpenALCheck, &QAbstractButton::toggled, m_ui->lineEditOpenALPath, &QWidget::setEnabled); + connect(m_ui->useNativeGLFWCheck, &QAbstractButton::toggled, m_ui->lineEditGLFWPath, &QWidget::setEnabled); + loadSettings(); } @@ -107,10 +139,19 @@ void MinecraftSettingsWidget::loadSettings() else settings = APPLICATION->settings(); - // Miscellaneous - m_ui->miscellaneousSettingsBox->setChecked(settings->get("OverrideMiscellaneous").toBool()); - m_ui->closeAfterLaunchCheck->setChecked(settings->get("CloseAfterLaunch").toBool()); - m_ui->quitAfterGameStopCheck->setChecked(settings->get("QuitAfterGameStop").toBool()); + // Game Window + m_ui->windowSizeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideWindow").toBool()); + m_ui->windowSizeGroupBox->setChecked(settings->get("OverrideWindow").toBool()); + m_ui->maximizedCheckBox->setChecked(settings->get("LaunchMaximized").toBool()); + m_ui->windowWidthSpinBox->setValue(settings->get("MinecraftWinWidth").toInt()); + m_ui->windowHeightSpinBox->setValue(settings->get("MinecraftWinHeight").toInt()); + + // Game Time + m_ui->gameTimeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideGameTime").toBool()); + m_ui->showGameTime->setChecked(settings->get("ShowGameTime").toBool()); + m_ui->recordGameTime->setChecked(settings->get("RecordGameTime").toBool()); + m_ui->showGlobalGameTime->setChecked(m_instance == nullptr && settings->get("ShowGlobalGameTime").toBool()); + m_ui->showGameTimeWithoutDays->setChecked(m_instance == nullptr && settings->get("ShowGameTimeWithoutDays").toBool()); // Console m_ui->consoleSettingsBox->setChecked(m_instance == nullptr || settings->get("OverrideConsole").toBool()); @@ -118,12 +159,10 @@ void MinecraftSettingsWidget::loadSettings() m_ui->autoCloseConsoleCheck->setChecked(settings->get("AutoCloseConsole").toBool()); m_ui->showConsoleErrorCheck->setChecked(settings->get("ShowConsoleOnError").toBool()); - // Window Size - m_ui->windowSizeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideWindow").toBool()); - m_ui->windowSizeGroupBox->setChecked(settings->get("OverrideWindow").toBool()); - m_ui->maximizedCheckBox->setChecked(settings->get("LaunchMaximized").toBool()); - m_ui->windowWidthSpinBox->setValue(settings->get("MinecraftWinWidth").toInt()); - m_ui->windowHeightSpinBox->setValue(settings->get("MinecraftWinHeight").toInt()); + // Miscellaneous + m_ui->miscellaneousSettingsBox->setChecked(settings->get("OverrideMiscellaneous").toBool()); + m_ui->closeAfterLaunchCheck->setChecked(settings->get("CloseAfterLaunch").toBool()); + m_ui->quitAfterGameStopCheck->setChecked(settings->get("QuitAfterGameStop").toBool()); if (m_javaSettings != nullptr) m_javaSettings->loadSettings(); @@ -137,7 +176,11 @@ void MinecraftSettingsWidget::loadSettings() m_ui->environmentVariables->initialize(m_instance != nullptr, m_instance == nullptr || settings->get("OverrideEnv").toBool(), settings->get("Env").toMap()); - // Workarounds + // Legacy Tweaks + m_ui->legacySettingsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideLegacySettings").toBool()); + m_ui->onlineFixes->setChecked(settings->get("OnlineFixes").toBool()); + + // Native Libraries m_ui->nativeWorkaroundsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideNativeWorkarounds").toBool()); m_ui->useNativeGLFWCheck->setChecked(settings->get("UseNativeGLFW").toBool()); m_ui->lineEditGLFWPath->setText(settings->get("CustomGLFWPath").toString()); @@ -161,24 +204,33 @@ void MinecraftSettingsWidget::loadSettings() m_ui->useDiscreteGpuCheck->setChecked(settings->get("UseDiscreteGpu").toBool()); m_ui->useZink->setChecked(settings->get("UseZink").toBool()); - if (!(APPLICATION->capabilities() & Application::SupportsGameMode)) { - m_ui->enableFeralGamemodeCheck->setDisabled(true); - m_ui->enableFeralGamemodeCheck->setToolTip(tr("Feral Interactive's GameMode could not be found on your system.")); + m_ui->serverJoinGroupBox->setChecked(settings->get("JoinServerOnLaunch").toBool()); + + if (m_instance != nullptr) { + if (auto server = settings->get("JoinServerOnLaunchAddress").toString(); !server.isEmpty()) { + m_ui->serverJoinAddress->setText(server); + m_ui->serverJoinAddressButton->setChecked(true); + m_ui->worldJoinButton->setChecked(false); + m_ui->serverJoinAddress->setEnabled(true); + m_ui->worldsCb->setEnabled(false); + } else if (auto world = settings->get("JoinWorldOnLaunch").toString(); !world.isEmpty() && m_quickPlaySingleplayer) { + m_ui->worldsCb->setCurrentText(world); + m_ui->serverJoinAddressButton->setChecked(false); + m_ui->worldJoinButton->setChecked(true); + m_ui->serverJoinAddress->setEnabled(false); + m_ui->worldsCb->setEnabled(true); + } else { + m_ui->serverJoinAddressButton->setChecked(true); + m_ui->worldJoinButton->setChecked(false); + m_ui->serverJoinAddress->setEnabled(true); + m_ui->worldsCb->setEnabled(false); + } + + m_ui->instanceAccountGroupBox->setChecked(settings->get("UseAccountForInstance").toBool()); + updateAccountsMenu(*settings); } - if (!(APPLICATION->capabilities() & Application::SupportsMangoHud)) { - m_ui->enableMangoHud->setDisabled(true); - m_ui->enableMangoHud->setToolTip(tr("MangoHud could not be found on your system.")); - } - - // Miscellanous - m_ui->gameTimeGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideGameTime").toBool()); - m_ui->showGameTime->setChecked(settings->get("ShowGameTime").toBool()); - m_ui->recordGameTime->setChecked(settings->get("RecordGameTime").toBool()); - m_ui->showGlobalGameTime->setChecked(m_instance == nullptr && settings->get("ShowGlobalGameTime").toBool()); - m_ui->showGameTimeWithoutDays->setChecked(m_instance == nullptr && settings->get("ShowGameTimeWithoutDays").toBool()); - - m_ui->legacySettingsGroupBox->setChecked(m_instance == nullptr || settings->get("OverrideLegacySettings").toBool()); + m_ui->legacySettingsGroupBox->setChecked(settings->get("OverrideLegacySettings").toBool()); m_ui->onlineFixes->setChecked(settings->get("OnlineFixes").toBool()); } @@ -322,6 +374,39 @@ void MinecraftSettingsWidget::saveSettings() settings->set("ShowGameTimeWithoutDays", m_ui->showGameTimeWithoutDays->isChecked()); } + if (m_instance != nullptr) { + // Join server on launch + bool joinServerOnLaunch = m_ui->serverJoinGroupBox->isChecked(); + settings->set("JoinServerOnLaunch", joinServerOnLaunch); + if (joinServerOnLaunch) { + if (m_ui->serverJoinAddressButton->isChecked() || !m_quickPlaySingleplayer) { + settings->set("JoinServerOnLaunchAddress", m_ui->serverJoinAddress->text()); + settings->reset("JoinWorldOnLaunch"); + } else { + settings->set("JoinWorldOnLaunch", m_ui->worldsCb->currentText()); + settings->reset("JoinServerOnLaunchAddress"); + } + } else { + settings->reset("JoinServerOnLaunchAddress"); + settings->reset("JoinWorldOnLaunch"); + } + + // Use an account for this instance + bool useAccountForInstance = m_ui->instanceAccountGroupBox->isChecked(); + settings->set("UseAccountForInstance", useAccountForInstance); + if (useAccountForInstance) { + int accountIndex = m_ui->instanceAccountSelector->currentIndex(); + + if (accountIndex != -1) { + const MinecraftAccountPtr account = APPLICATION->accounts()->at(accountIndex); + if (account != nullptr) + settings->set("InstanceAccountId", account->profileId()); + } + } else { + settings->reset("InstanceAccountId"); + } + } + bool overrideLegacySettings = m_instance == nullptr || m_ui->legacySettingsGroupBox->isChecked(); if (m_instance != nullptr) @@ -349,3 +434,28 @@ void MinecraftSettingsWidget::openGlobalSettings() else // TODO select tab APPLICATION->ShowGlobalSettings(this, "minecraft-settings"); } + +void MinecraftSettingsWidget::updateAccountsMenu(const SettingsObject& settings) +{ + m_ui->instanceAccountSelector->clear(); + auto accounts = APPLICATION->accounts(); + int accountIndex = accounts->findAccountByProfileId(settings.get("InstanceAccountId").toString()); + + for (int i = 0; i < accounts->count(); i++) { + MinecraftAccountPtr account = accounts->at(i); + + QIcon face = account->getFace(); + + if (face.isNull()) + face = APPLICATION->getThemedIcon("noaccount"); + + m_ui->instanceAccountSelector->addItem(face, account->profileName(), i); + if (i == accountIndex) + m_ui->instanceAccountSelector->setCurrentIndex(i); + } +} + +bool MinecraftSettingsWidget::isQuickPlaySupported() +{ + return m_instance->traits().contains("feature:is_quick_play_singleplayer"); +} diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.h b/launcher/ui/widgets/MinecraftSettingsWidget.h index 710ce8249..7a872f54f 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -52,10 +52,13 @@ class MinecraftSettingsWidget : public QWidget { void loadSettings(); void saveSettings(); - void openGlobalSettings(); - private: + void openGlobalSettings(); + void updateAccountsMenu(const SettingsObject& settings); + bool isQuickPlaySupported(); + MinecraftInstancePtr m_instance; Ui::MinecraftSettingsWidget* m_ui; JavaSettingsWidget* m_javaSettings = nullptr; + bool m_quickPlaySingleplayer = false; }; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.ui b/launcher/ui/widgets/MinecraftSettingsWidget.ui index d9949b173..daa065ac8 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.ui +++ b/launcher/ui/widgets/MinecraftSettingsWidget.ui @@ -61,7 +61,7 @@ 0 - 0 + -253 610 550 @@ -323,7 +323,7 @@ 0 - 0 + -101 610 398 @@ -429,7 +429,7 @@ &Performance - true + false false From a92c68adbdc7fa8061c5dac4b8c15299e7edceeb Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 16:54:45 +0000 Subject: [PATCH 058/102] Remove duplicate console section Signed-off-by: TheKodeToad --- launcher/ui/pages/global/LauncherPage.cpp | 6 ---- launcher/ui/pages/global/LauncherPage.ui | 35 +---------------------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 8bbed9643..f7d7da568 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -217,9 +217,6 @@ void LauncherPage::applySettings() s->set("RequestTimeout", ui->timeoutSecondsSpinBox->value()); // Console settings - s->set("ShowConsole", ui->showConsoleCheck->isChecked()); - s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); - s->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked()); QString consoleFontFamily = ui->consoleFont->currentFont().family(); s->set("ConsoleFont", consoleFontFamily); s->set("ConsoleFontSize", ui->fontSizeBox->value()); @@ -277,9 +274,6 @@ void LauncherPage::loadSettings() ui->timeoutSecondsSpinBox->setValue(s->get("RequestTimeout").toInt()); // Console settings - ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool()); - ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool()); - ui->showConsoleErrorCheck->setChecked(s->get("ShowConsoleOnError").toBool()); QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString(); QFont consoleFont(fontFamily); ui->consoleFont->setCurrentFont(consoleFont); diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 09e7bca5b..87c9dad78 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -59,7 +59,7 @@ 0 0 473 - 770 + 690 @@ -523,36 +523,6 @@ Console - - - - Console Settings - - - - - - Show console while the game is &running - - - - - - - &Automatically close console when the game quits - - - - - - - Show console when the game &crashes - - - - - - @@ -676,9 +646,6 @@ iconsDirBrowseBtn sortLastLaunchedBtn sortByNameBtn - showConsoleCheck - autoCloseConsoleCheck - showConsoleErrorCheck lineLimitSpinBox checkStopLogging consoleFont From dc6f5368430f6e7b61c261b4d2a2ba27c225aef4 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 18:04:41 +0000 Subject: [PATCH 059/102] Fix Qt 5 compilation Signed-off-by: TheKodeToad --- launcher/ui/widgets/JavaSettingsWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp index 6602aea11..149edcacd 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -97,8 +97,8 @@ JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent) connect(m_ui->javaDetectBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaAutodetect); connect(m_ui->javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaBrowse); - connect(m_ui->maxMemSpinBox, &QSpinBox::valueChanged, this, &JavaSettingsWidget::updateThresholds); - connect(m_ui->minMemSpinBox, &QSpinBox::valueChanged, this, &JavaSettingsWidget::updateThresholds); + connect(m_ui->maxMemSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &JavaSettingsWidget::updateThresholds); + connect(m_ui->minMemSpinBox, QOverload::of(&QSpinBox::valueChanged), this, &JavaSettingsWidget::updateThresholds); loadSettings(); updateThresholds(); From 5d179671bfef3b8556b5ff2ab12599d7487e1205 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 18:55:24 +0000 Subject: [PATCH 060/102] Fix non-Linux build Signed-off-by: TheKodeToad --- launcher/ui/widgets/MinecraftSettingsWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index ea9506d75..3c5bbebda 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -36,6 +36,7 @@ */ #include "MinecraftSettingsWidget.h" +#include #include "Application.h" #include "minecraft/WorldList.h" From 68bf409a98364cba1eab91da3e73f09ca724791d Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Mon, 27 Jan 2025 19:14:57 +0000 Subject: [PATCH 061/102] Fix formatting issues Signed-off-by: TheKodeToad --- launcher/Application.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 7ae043c16..6f675dcee 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -973,8 +973,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) [[fallthrough]]; default: { qDebug() << "Exiting because update lockfile is present"; - QMetaObject::invokeMethod( - this, []() { exit(1); }, Qt::QueuedConnection); + QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection); return; } } @@ -1006,8 +1005,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) [[fallthrough]]; default: { qDebug() << "Exiting because update lockfile is present"; - QMetaObject::invokeMethod( - this, []() { exit(1); }, Qt::QueuedConnection); + QMetaObject::invokeMethod(this, []() { exit(1); }, Qt::QueuedConnection); return; } } @@ -1737,8 +1735,7 @@ QString Application::getJarPath(QString jarFile) #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) FS::PathCombine(m_rootPath, "share", BuildConfig.LAUNCHER_NAME), #endif - FS::PathCombine(m_rootPath, "jars"), - FS::PathCombine(applicationDirPath(), "jars"), + FS::PathCombine(m_rootPath, "jars"), FS::PathCombine(applicationDirPath(), "jars"), FS::PathCombine(applicationDirPath(), "..", "jars") // from inside build dir, for debuging }; for (QString p : potentialPaths) { From 417688089d756da23ca3f482a32871963d289211 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 08:24:42 -0500 Subject: [PATCH 062/102] ci: separate nix job Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 56 ------------------- .github/workflows/nix.yml | 80 +++++++++++++++++++++++++++ .github/workflows/trigger_builds.yml | 1 - .github/workflows/trigger_release.yml | 1 - 4 files changed, 80 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/nix.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a14b07cec..d17f27c5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,6 @@ on: APPLE_NOTARIZE_PASSWORD: description: Password used for notarizing macOS builds required: false - CACHIX_AUTH_TOKEN: - description: Private token for authenticating against Cachix cache - required: false GPG_PRIVATE_KEY: description: Private key for AppImage signing required: false @@ -669,56 +666,3 @@ jobs: bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml arch: ${{ matrix.arch }} - - nix: - name: Nix (${{ matrix.system }}) - - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-22.04 - system: x86_64-linux - - - os: ubuntu-22.04-arm - system: aarch64-linux - - - os: macos-13 - system: x86_64-darwin - - - os: macos-14 - system: aarch64-darwin - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: cachix/install-nix-action@v30 - - # For PRs - - name: Setup Nix Magic Cache - uses: DeterminateSystems/magic-nix-cache-action@v9 - - # For in-tree builds - - name: Setup Cachix - uses: cachix/cachix-action@v15 - with: - name: prismlauncher - authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - - - name: Run flake checks - run: | - nix flake check --print-build-logs --show-trace - - - name: Build debug package - if: ${{ inputs.build_type == 'Debug' }} - run: | - nix build --print-build-logs .#prismlauncher-debug - - - name: Build release package - if: ${{ inputs.build_type != 'Debug' }} - run: | - nix build --print-build-logs .#prismlauncher diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 000000000..f167440cd --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,80 @@ +name: Nix + +on: + push: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "flatpak/**" + tags: + - "*" + pull_request: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "flatpak/**" + workflow_dispatch: + +permissions: + contents: read + +env: + DEBUG: ${{ github.ref_type != 'tag' }} + +jobs: + build: + name: Build (${{ matrix.system }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + system: x86_64-linux + + - os: ubuntu-22.04-arm + system: aarch64-linux + + - os: macos-13 + system: x86_64-darwin + + - os: macos-14 + system: aarch64-darwin + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + # For PRs + - name: Setup Nix Magic Cache + uses: DeterminateSystems/magic-nix-cache-action@v9 + + # For in-tree builds + - name: Setup Cachix + uses: cachix/cachix-action@v15 + with: + name: prismlauncher + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + + - name: Run Flake checks + run: | + nix flake check --print-build-logs --show-trace + + - name: Build debug package + if: ${{ env.DEBUG }} + run: | + nix build --print-build-logs .#prismlauncher-debug + + - name: Build release package + if: ${{ !env.DEBUG }} + run: | + nix build --print-build-logs .#prismlauncher diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 0b8386d69..9efafc8cc 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -38,6 +38,5 @@ jobs: APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} diff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.yml index e800653e3..134281b2c 100644 --- a/.github/workflows/trigger_release.yml +++ b/.github/workflows/trigger_release.yml @@ -22,7 +22,6 @@ jobs: APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} - CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} From 49d734f3142328a71506b28c8c1cdcb99788c34d Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 08:28:05 -0500 Subject: [PATCH 063/102] ci: separate flatpak job Signed-off-by: Seth Flynn --- .github/workflows/build.yml | 38 --------------------- .github/workflows/flatpak.yml | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/flatpak.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d17f27c5e..d7efc90c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -628,41 +628,3 @@ jobs: shell: msys2 {0} run: | ccache -s - - flatpak: - name: Flatpak (${{ matrix.arch }}) - - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-22.04 - arch: x86_64 - - - os: ubuntu-22.04-arm - arch: aarch64 - - runs-on: ${{ matrix.os }} - - container: - image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8 - options: --privileged - - steps: - - name: Checkout - uses: actions/checkout@v4 - if: inputs.build_type == 'Debug' - with: - submodules: true - - - name: Set short version - shell: bash - run: echo "VERSION=${GITHUB_SHA::7}" >> $GITHUB_ENV - - - name: Build Flatpak (Linux) - if: inputs.build_type == 'Debug' - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 - with: - bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak - manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml - arch: ${{ matrix.arch }} diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml new file mode 100644 index 000000000..41cc2a51d --- /dev/null +++ b/.github/workflows/flatpak.yml @@ -0,0 +1,62 @@ +name: Flatpak + +on: + push: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "nix/**" + # We don't do anything with these artifacts on releases. They go to Flathub + tags-ignore: + - "*" + pull_request: + paths-ignore: + - "**.md" + - "**/LICENSE" + - ".github/ISSUE_TEMPLATE/**" + - ".markdownlint**" + - "nix/**" + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Build (${{ matrix.arch }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + arch: x86_64 + + - os: ubuntu-22.04-arm + arch: aarch64 + + runs-on: ${{ matrix.os }} + + container: + image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8 + options: --privileged + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set short version + shell: bash + run: | + echo "VERSION=${GITHUB_SHA::7}" >> "$GITHUB_ENV" + + - name: Build Flatpak + uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: PrismLauncher-${{ runner.os }}-${{ env.VERSION }}-Flatpak.flatpak + manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml + arch: ${{ matrix.arch }} From 8816be166821d5ce1a4cd8edfbe7b91727b6eb34 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 16:17:01 -0500 Subject: [PATCH 064/102] ci: use flakehub cache Signed-off-by: Seth Flynn --- .github/workflows/nix.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index f167440cd..642f9e670 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -24,6 +24,7 @@ permissions: env: DEBUG: ${{ github.ref_type != 'tag' }} + USE_DETERMINATE: ${{ github.event_name == 'pull_request' }} jobs: build: @@ -47,19 +48,26 @@ jobs: runs-on: ${{ matrix.os }} + permissions: + id-token: write + steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Nix - uses: cachix/install-nix-action@v30 + uses: DeterminateSystems/nix-installer-action@v16 + with: + determinate: ${{ env.USE_DETERMINATE }} # For PRs - name: Setup Nix Magic Cache - uses: DeterminateSystems/magic-nix-cache-action@v9 + if: ${{ env.USE_DETERMINATE }} + uses: DeterminateSystems/flakehub-cache-action@v1 # For in-tree builds - name: Setup Cachix + if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} uses: cachix/cachix-action@v15 with: name: prismlauncher From 169f5728b1019582db150f3b1618515eb1438517 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 16:22:44 -0500 Subject: [PATCH 065/102] ci: run nix workflow on pull_request_target Signed-off-by: Seth Flynn --- .github/workflows/nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 642f9e670..0792b172c 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -10,7 +10,7 @@ on: - "flatpak/**" tags: - "*" - pull_request: + pull_request_target: paths-ignore: - "**.md" - "**/LICENSE" From 61d7f088838e25ddb0a7089a6fa3f7d232331c24 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 07:50:36 -0500 Subject: [PATCH 066/102] ci: use generic workflow for publishing Signed-off-by: Seth Flynn --- .github/workflows/{winget.yml => publish.yml} | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) rename .github/workflows/{winget.yml => publish.yml} (63%) diff --git a/.github/workflows/winget.yml b/.github/workflows/publish.yml similarity index 63% rename from .github/workflows/winget.yml rename to .github/workflows/publish.yml index eacf23099..8a7da812e 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,21 @@ -name: Publish to WinGet +name: Publish + on: release: - types: [released] + types: [ released ] + +permissions: + contents: read jobs: - publish: + winget: + name: Winget + runs-on: windows-latest + steps: - - uses: vedantmgoyal2009/winget-releaser@v2 + - name: Publish on Winget + uses: vedantmgoyal2009/winget-releaser@v2 with: identifier: PrismLauncher.PrismLauncher version: ${{ github.event.release.tag_name }} From 86cc6d3c5ee7157d5f9978580e94b94360a119f1 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 29 Jan 2025 07:50:52 -0500 Subject: [PATCH 067/102] feat: publish on flakehub Signed-off-by: Seth Flynn --- .github/workflows/publish.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8a7da812e..d49eb4b8d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,28 @@ permissions: contents: read jobs: + flakehub: + name: FlakeHub + + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - name: Install Nix + uses: cachix/install-nix-action@v30 + + - name: Publish on FlakeHub + uses: determinatesystems/flakehub-push@v5 + with: + visibility: "public" + winget: name: Winget From 588e0d6305e673fc4e5eceebfe2692d30b8e876a Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Thu, 30 Jan 2025 13:25:15 -0500 Subject: [PATCH 068/102] ci: add nix out paths to job summary Signed-off-by: Seth Flynn --- .github/workflows/nix.yml | 50 +++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 0792b172c..b6abce79e 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -77,12 +77,54 @@ jobs: run: | nix flake check --print-build-logs --show-trace - - name: Build debug package + - name: Select debug package if: ${{ env.DEBUG }} run: | - nix build --print-build-logs .#prismlauncher-debug + echo "installable='.#prismlauncher-debug'" >> "$GITHUB_ENV" - - name: Build release package + - name: Select release package if: ${{ !env.DEBUG }} run: | - nix build --print-build-logs .#prismlauncher + echo "installable='.#prismlauncher'" >> "$GITHUB_ENV" + + - name: Build package + run: | + nix build \ + --no-link --print-build-logs --print-out-paths \ + "$installable" >> "$RUNNER_TEMP"/out-paths + + - name: Upload out paths + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.system }}-out-paths + path: ${{ runner.temp }}/out-paths + + release-gate: + name: Release gate + + if: ${{ always() }} + needs: [ build ] + + runs-on: ubuntu-22.04 + + steps: + - name: Recover out paths + uses: actions/download-artifact@v4 + + - name: Make job summary + run: | + { + for artifact in *-out-paths/; do + basename="$(basename "$artifact")" + echo "# ${basename/%-out-paths/}" + echo + echo '```' + cat "$artifact"/out-paths + echo '```' + echo + done + } >>"$GITHUB_STEP_SUMMARY" + + - name: Exit with error + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + run: exit 1 From c5efe081b4ff9ec81b882e6deabcbfc5be269329 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 31 Jan 2025 22:03:57 +0200 Subject: [PATCH 069/102] fix add resource with no instance Signed-off-by: Trial97 --- launcher/ui/MainWindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 1b3cc75c3..ee12eaa2d 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1027,6 +1027,14 @@ void MainWindow::processURLs(QList urls) continue; } + if (APPLICATION->instances()->count() <= 0) { + CustomMessageBox::selectable(this, tr("No instance!"), + tr("No instance available to add the resource to.\nPlease create a new instance before " + "attempting to install this resource again."), + QMessageBox::Critical) + ->show(); + continue; + } ImportResourceDialog dlg(localFileName, type, this); if (dlg.exec() != QDialog::Accepted) From f1671e3ded2a68f1311e709ad7d17d2a6281e9e7 Mon Sep 17 00:00:00 2001 From: Kolja Date: Sat, 1 Feb 2025 20:25:01 +0100 Subject: [PATCH 070/102] Add PackageManager category Signed-off-by: Kolja --- program_info/org.prismlauncher.PrismLauncher.desktop.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program_info/org.prismlauncher.PrismLauncher.desktop.in b/program_info/org.prismlauncher.PrismLauncher.desktop.in index c0e4e9458..182d02b1d 100644 --- a/program_info/org.prismlauncher.PrismLauncher.desktop.in +++ b/program_info/org.prismlauncher.PrismLauncher.desktop.in @@ -7,7 +7,7 @@ Terminal=false Exec=@Launcher_APP_BINARY_NAME@ %U StartupNotify=true Icon=org.@Launcher_APP_BINARY_NAME@.@Launcher_CommonName@ -Categories=Game;ActionGame;AdventureGame;Simulation; +Categories=Game;ActionGame;AdventureGame;Simulation;PackageManager; Keywords=game;minecraft;mc; StartupWMClass=@Launcher_CommonName@ MimeType=application/zip;application/x-modrinth-modpack+zip;x-scheme-handler/curseforge;x-scheme-handler/@Launcher_APP_BINARY_NAME@; From faf7e6b06ecb9704edb5725dd66e730e907723c3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 2 Feb 2025 00:24:39 +0000 Subject: [PATCH 071/102] chore(nix): update lockfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/825479c345a7f806485b7f00dbe3abb50641b083?narHash=sha256-nU6AezEX4EuahTO1YopzueAXfjFfmCHylYEFCagduHU%3D' (2025-01-24) → 'github:NixOS/nixpkgs/3a228057f5b619feb3186e986dbe76278d707b6e?narHash=sha256-xvTo0Aw0%2Bveek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc%3D' (2025-02-01) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index dc07808f0..ec0257def 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737746512, - "narHash": "sha256-nU6AezEX4EuahTO1YopzueAXfjFfmCHylYEFCagduHU=", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "825479c345a7f806485b7f00dbe3abb50641b083", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { From 138684a84fa8495ba155c2c7058e163f9e11955c Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sat, 1 Feb 2025 22:54:26 -0500 Subject: [PATCH 072/102] Revert "ci: add nix out paths to job summary" This reverts commit 588e0d6305e673fc4e5eceebfe2692d30b8e876a. Signed-off-by: Seth Flynn --- .github/workflows/nix.yml | 50 ++++----------------------------------- 1 file changed, 4 insertions(+), 46 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index b6abce79e..0792b172c 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -77,54 +77,12 @@ jobs: run: | nix flake check --print-build-logs --show-trace - - name: Select debug package + - name: Build debug package if: ${{ env.DEBUG }} run: | - echo "installable='.#prismlauncher-debug'" >> "$GITHUB_ENV" + nix build --print-build-logs .#prismlauncher-debug - - name: Select release package + - name: Build release package if: ${{ !env.DEBUG }} run: | - echo "installable='.#prismlauncher'" >> "$GITHUB_ENV" - - - name: Build package - run: | - nix build \ - --no-link --print-build-logs --print-out-paths \ - "$installable" >> "$RUNNER_TEMP"/out-paths - - - name: Upload out paths - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.system }}-out-paths - path: ${{ runner.temp }}/out-paths - - release-gate: - name: Release gate - - if: ${{ always() }} - needs: [ build ] - - runs-on: ubuntu-22.04 - - steps: - - name: Recover out paths - uses: actions/download-artifact@v4 - - - name: Make job summary - run: | - { - for artifact in *-out-paths/; do - basename="$(basename "$artifact")" - echo "# ${basename/%-out-paths/}" - echo - echo '```' - cat "$artifact"/out-paths - echo '```' - echo - done - } >>"$GITHUB_STEP_SUMMARY" - - - name: Exit with error - if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} - run: exit 1 + nix build --print-build-logs .#prismlauncher From 989e6c6cb6a400a217db302a71ae2d242ca5b013 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Sat, 1 Feb 2025 22:55:39 -0500 Subject: [PATCH 073/102] ci: directly print nix out paths to step summary Signed-off-by: Seth Flynn --- .github/workflows/nix.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 0792b172c..09e3dee1f 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -80,9 +80,13 @@ jobs: - name: Build debug package if: ${{ env.DEBUG }} run: | - nix build --print-build-logs .#prismlauncher-debug + nix build \ + --no-link --print-build-logs --print-out-paths \ + .#prismlauncher-debug >> "$GITHUB_STEP_SUMMARY" - name: Build release package if: ${{ !env.DEBUG }} run: | - nix build --print-build-logs .#prismlauncher + nix build \ + --no-link --print-build-logs --print-out-paths \ + .#prismlauncher >> "$GITHUB_STEP_SUMMARY" From 2a987b5a4a498a298f3862102b0b55e4ba1f9173 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:11:56 +0000 Subject: [PATCH 074/102] chore(deps): update hendrikmuhs/ccache-action action to v1.2.17 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7efc90c3..99dd4f1a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -164,7 +164,7 @@ jobs: - name: Setup ccache if: (runner.os != 'Windows' || matrix.msystem == '') && inputs.build_type == 'Debug' - uses: hendrikmuhs/ccache-action@v1.2.16 + uses: hendrikmuhs/ccache-action@v1.2.17 with: key: ${{ matrix.os }}-qt${{ matrix.qt_ver }}-${{ matrix.architecture }} From 9c26ba5932b1f20b2148396db01055683994d5da Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 4 Feb 2025 16:13:55 +0200 Subject: [PATCH 075/102] add stale workflow Signed-off-by: Trial97 --- .github/workflows/stale.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..e0faff447 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,29 @@ +name: Close stale issues and PRs + +on: + schedule: + # run weekly on sunday + - cron: "0 0 * * 0" + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + days-before-issue-stale: 14 + days-before-pr-stale: 360 # a year + days-before-close: -1 + days-before-issue-close: 360 # update the issue once a year + days-before-pr-close: -1 + stale-issue-message: "This issue has been inactive for a while. Please add a comment or provide an update if it's still relevant." + stale-pr-message: "This PR has had no recent activity. Please update it if it's still relevant." + close-issue-message: "Closing this issue as it has been marked stale and no further activity was detected. Feel free to reopen if needed." + exempt-issue-labels: rfc,noslate + exempt-all-milestones: true + exempt-all-assignees: true From afe6d4836da303ba8dd0b9c8c731c1b868beb440 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 4 Feb 2025 17:41:36 +0200 Subject: [PATCH 076/102] Update .github/workflows/stale.yml Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index e0faff447..534f21382 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -19,7 +19,7 @@ jobs: days-before-issue-stale: 14 days-before-pr-stale: 360 # a year days-before-close: -1 - days-before-issue-close: 360 # update the issue once a year + days-before-issue-close: -1 days-before-pr-close: -1 stale-issue-message: "This issue has been inactive for a while. Please add a comment or provide an update if it's still relevant." stale-pr-message: "This PR has had no recent activity. Please update it if it's still relevant." From 85c2710e33e553d631403651663a0fea3543ab0d Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 4 Feb 2025 22:08:16 +0200 Subject: [PATCH 077/102] Apply suggestions from code review Co-authored-by: Seth Flynn Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/stale.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 534f21382..08e3ff8d1 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: Close stale issues and PRs +name: Stale on: schedule: @@ -11,19 +11,23 @@ permissions: pull-requests: write jobs: - stale: + label: + name: Label issues and PRs + runs-on: ubuntu-latest + + permissions: + issues: write + pull-requests: write + steps: - uses: actions/stale@v9 with: - days-before-issue-stale: 14 - days-before-pr-stale: 360 # a year - days-before-close: -1 - days-before-issue-close: -1 - days-before-pr-close: -1 + days-before-issue-stale: 30 + days-before-pr-stale: 30 + days-before-close: -1 # Don't close anything stale-issue-message: "This issue has been inactive for a while. Please add a comment or provide an update if it's still relevant." stale-pr-message: "This PR has had no recent activity. Please update it if it's still relevant." - close-issue-message: "Closing this issue as it has been marked stale and no further activity was detected. Feel free to reopen if needed." - exempt-issue-labels: rfc,noslate + exempt-issue-labels: rfc,nostale exempt-all-milestones: true exempt-all-assignees: true From ac598740b3bc28a568e9b19bbedc77e99d834733 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 4 Feb 2025 22:08:46 +0200 Subject: [PATCH 078/102] Update .github/workflows/stale.yml Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/stale.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 08e3ff8d1..7afc94eed 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,9 +6,6 @@ on: - cron: "0 0 * * 0" workflow_dispatch: -permissions: - issues: write - pull-requests: write jobs: label: From 34438824c14089c226670483d89fc342b4fcb17d Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 4 Feb 2025 23:15:18 +0200 Subject: [PATCH 079/102] Update .github/workflows/stale.yml Co-authored-by: Seth Flynn Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/stale.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7afc94eed..c93ea5e87 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -20,8 +20,7 @@ jobs: steps: - uses: actions/stale@v9 with: - days-before-issue-stale: 30 - days-before-pr-stale: 30 + days-before-stale: 30 days-before-close: -1 # Don't close anything stale-issue-message: "This issue has been inactive for a while. Please add a comment or provide an update if it's still relevant." stale-pr-message: "This PR has had no recent activity. Please update it if it's still relevant." From 5a76d9b7e11596a3133fe46fafad24c8735039d2 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 4 Feb 2025 17:05:20 +0000 Subject: [PATCH 080/102] Make requested changes Signed-off-by: TheKodeToad --- launcher/ui/pages/global/JavaPage.cpp | 5 +--- launcher/ui/pages/global/JavaPage.h | 1 - launcher/ui/pages/global/JavaPage.ui | 11 +++++++++ launcher/ui/pages/global/LauncherPage.ui | 10 ++++---- launcher/ui/widgets/JavaSettingsWidget.cpp | 23 +++++++++---------- launcher/ui/widgets/JavaSettingsWidget.h | 5 ++-- .../ui/widgets/MinecraftSettingsWidget.cpp | 6 ++--- 7 files changed, 33 insertions(+), 28 deletions(-) diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp index 9f681c6f1..b99d0c63e 100644 --- a/launcher/ui/pages/global/JavaPage.cpp +++ b/launcher/ui/pages/global/JavaPage.cpp @@ -63,9 +63,6 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) { ui->setupUi(this); - m_javaSettings = new JavaSettingsWidget(nullptr, this); - ui->generalScrollArea->setWidget(m_javaSettings); - if (BuildConfig.JAVA_DOWNLOADER_ENABLED) { ui->managedJavaList->initialize(new JavaInstallList(this, true)); ui->managedJavaList->setResizeOn(2); @@ -88,7 +85,7 @@ void JavaPage::retranslate() bool JavaPage::apply() { - m_javaSettings->saveSettings(); + ui->javaSettings->saveSettings(); JavaCommon::checkJVMArgs(APPLICATION->settings()->get("JvmArgs").toString(), this); return true; } diff --git a/launcher/ui/pages/global/JavaPage.h b/launcher/ui/pages/global/JavaPage.h index 75fd69e6a..bfc355d2f 100644 --- a/launcher/ui/pages/global/JavaPage.h +++ b/launcher/ui/pages/global/JavaPage.h @@ -71,5 +71,4 @@ class JavaPage : public QWidget, public BasePage { private: Ui::JavaPage* ui; - JavaSettingsWidget* m_javaSettings; }; diff --git a/launcher/ui/pages/global/JavaPage.ui b/launcher/ui/pages/global/JavaPage.ui index 9baa2f6f1..a4b2ac203 100644 --- a/launcher/ui/pages/global/JavaPage.ui +++ b/launcher/ui/pages/global/JavaPage.ui @@ -53,6 +53,11 @@ 610 + + + + + @@ -146,6 +151,12 @@
ui/widgets/VersionSelectWidget.h
1 + + JavaSettingsWidget + QWidget +
ui/widgets/JavaSettingsWidget.h
+ 1 +
diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index c36dfdfc6..31c878f3e 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -6,7 +6,7 @@ 0 0 - 562 + 511 726 @@ -38,7 +38,7 @@ QTabWidget::Rounded - 2 + 0 @@ -58,8 +58,8 @@ 0 0 - 570 - 692 + 473 + 770 @@ -689,4 +689,4 @@ -
+
\ No newline at end of file diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp index 149edcacd..7a5e228fd 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -36,21 +36,20 @@ */ #include "JavaSettingsWidget.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include +#include "Application.h" +#include "BuildConfig.h" +#include "FileSystem.h" +#include "JavaCommon.h" +#include "java/JavaInstallList.h" +#include "java/JavaUtils.h" +#include "settings/Setting.h" +#include "sys.h" +#include "ui/dialogs/CustomMessageBox.h" +#include "ui/dialogs/VersionSelectDialog.h" +#include "ui/java/InstallJavaDialog.h" #include "ui_JavaSettingsWidget.h" diff --git a/launcher/ui/widgets/JavaSettingsWidget.h b/launcher/ui/widgets/JavaSettingsWidget.h index 433a5f19f..21a71fb8b 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.h +++ b/launcher/ui/widgets/JavaSettingsWidget.h @@ -36,9 +36,9 @@ #pragma once -#include -#include #include +#include "BaseInstance.h" +#include "JavaCommon.h" namespace Ui { class JavaSettingsWidget; @@ -48,6 +48,7 @@ class JavaSettingsWidget : public QWidget { Q_OBJECT public: + explicit JavaSettingsWidget(QWidget* parent = nullptr) : JavaSettingsWidget(nullptr, nullptr) {} explicit JavaSettingsWidget(InstancePtr instance, QWidget* parent = nullptr); ~JavaSettingsWidget() override; diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index 3c5bbebda..16fccb054 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -50,13 +50,11 @@ MinecraftSettingsWidget::MinecraftSettingsWidget(MinecraftInstancePtr instance, m_ui->setupUi(this); if (m_instance == nullptr) { - for (int i = 0; i < m_ui->settingsTabs->count(); ++i) { + for (int i = m_ui->settingsTabs->count() - 1; i >= 0; --i) { const QString name = m_ui->settingsTabs->widget(i)->objectName(); - if (name == "javaPage" || name == "launchPage") { + if (name == "javaPage" || name == "launchPage") m_ui->settingsTabs->removeTab(i); - --i; - } } m_ui->openGlobalSettingsButton->setVisible(false); From 06b50dfd3360c44b4f44b69b2fe62f24c381891f Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 5 Feb 2025 11:11:45 +0000 Subject: [PATCH 081/102] Fix more header mistakes Signed-off-by: TheKodeToad --- launcher/ui/widgets/MinecraftSettingsWidget.cpp | 2 +- launcher/ui/widgets/MinecraftSettingsWidget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.cpp b/launcher/ui/widgets/MinecraftSettingsWidget.cpp index 16fccb054..cec7f267f 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.cpp +++ b/launcher/ui/widgets/MinecraftSettingsWidget.cpp @@ -36,9 +36,9 @@ */ #include "MinecraftSettingsWidget.h" -#include #include "Application.h" +#include "BuildConfig.h" #include "minecraft/WorldList.h" #include "minecraft/auth/AccountList.h" #include "settings/Setting.h" diff --git a/launcher/ui/widgets/MinecraftSettingsWidget.h b/launcher/ui/widgets/MinecraftSettingsWidget.h index 7a872f54f..86effb337 100644 --- a/launcher/ui/widgets/MinecraftSettingsWidget.h +++ b/launcher/ui/widgets/MinecraftSettingsWidget.h @@ -36,9 +36,9 @@ #pragma once -#include #include #include "JavaSettingsWidget.h" +#include "minecraft/MinecraftInstance.h" namespace Ui { class MinecraftSettingsWidget; From 9ed6801b151972d3e2eac790f24de6a1d2c515e1 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 5 Feb 2025 12:09:12 +0000 Subject: [PATCH 082/102] Update launcher/ui/pages/global/JavaPage.h Co-authored-by: Alexandru Ionut Tripon Signed-off-by: TheKodeToad --- launcher/ui/pages/global/JavaPage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/JavaPage.h b/launcher/ui/pages/global/JavaPage.h index bfc355d2f..ea7724c1d 100644 --- a/launcher/ui/pages/global/JavaPage.h +++ b/launcher/ui/pages/global/JavaPage.h @@ -37,7 +37,7 @@ #include #include -#include +#include "ui/widgets/JavaSettingsWidget.h" #include #include #include "JavaCommon.h" From f7a401ab226c9a0bb6fa4c1ee330b9e5d3b005e8 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 5 Feb 2025 12:09:26 +0000 Subject: [PATCH 083/102] Update launcher/ui/pages/instance/InstanceSettingsPage.h Co-authored-by: Alexandru Ionut Tripon Signed-off-by: TheKodeToad --- launcher/ui/pages/instance/InstanceSettingsPage.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.h b/launcher/ui/pages/instance/InstanceSettingsPage.h index e778a0c9c..fa1dce3dc 100644 --- a/launcher/ui/pages/instance/InstanceSettingsPage.h +++ b/launcher/ui/pages/instance/InstanceSettingsPage.h @@ -35,10 +35,10 @@ #pragma once -#include -#include -#include -#include +#include "Application.h" +#include "BaseInstance.h" +#include "ui/pages/BasePage.h" +#include "ui/widgets/MinecraftSettingsWidget.h" #include class InstanceSettingsPage : public MinecraftSettingsWidget, public BasePage { From 6e3dd04a1f0dfd03e0bbae85569b847333ad3222 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 5 Feb 2025 12:09:32 +0000 Subject: [PATCH 084/102] Update launcher/ui/pages/global/MinecraftPage.h Co-authored-by: Alexandru Ionut Tripon Signed-off-by: TheKodeToad --- launcher/ui/pages/global/MinecraftPage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/MinecraftPage.h b/launcher/ui/pages/global/MinecraftPage.h index 9c01bdec6..8c928b98f 100644 --- a/launcher/ui/pages/global/MinecraftPage.h +++ b/launcher/ui/pages/global/MinecraftPage.h @@ -39,7 +39,7 @@ #include #include -#include +#include "ui/widgets/MinecraftSettingsWidget.h" #include "java/JavaChecker.h" #include "ui/pages/BasePage.h" From e1896d5b6bc4d253f2ab1dc29907615612453eed Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Wed, 5 Feb 2025 13:45:49 +0000 Subject: [PATCH 085/102] Update launcher/ui/pages/global/MinecraftPage.h Co-authored-by: Alexandru Ionut Tripon Signed-off-by: TheKodeToad --- launcher/ui/pages/global/MinecraftPage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/MinecraftPage.h b/launcher/ui/pages/global/MinecraftPage.h index 8c928b98f..e48efda04 100644 --- a/launcher/ui/pages/global/MinecraftPage.h +++ b/launcher/ui/pages/global/MinecraftPage.h @@ -38,7 +38,7 @@ #include #include -#include +#include "Application.h" #include "ui/widgets/MinecraftSettingsWidget.h" #include "java/JavaChecker.h" #include "ui/pages/BasePage.h" From cb83f8e52db1046173a8def2f216cfcf1518b91f Mon Sep 17 00:00:00 2001 From: Riley Richard Date: Wed, 5 Feb 2025 16:13:22 -0500 Subject: [PATCH 086/102] fixed thing --- launcher/minecraft/launch/LauncherPartLaunch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp index 7a086cf84..49d91e433 100644 --- a/launcher/minecraft/launch/LauncherPartLaunch.cpp +++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp @@ -171,6 +171,7 @@ void LauncherPartLaunch::on_state(LoggedProcess::State state) case LoggedProcess::Aborted: case LoggedProcess::Crashed: { m_parent->setPid(-1); + m_parent->instance()->setMinecraftRunning(false); emitFailed(tr("Game crashed.")); return; } From 17e95c0d07c0d4337bd646e8fd623da4eba80b03 Mon Sep 17 00:00:00 2001 From: Riley Richard Date: Wed, 5 Feb 2025 16:33:15 -0500 Subject: [PATCH 087/102] forgot to sign Signed-off-by: Riley Richard From f1209c1279bca89eca295f79964be5ff1ffd72f1 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 5 Feb 2025 23:43:38 +0200 Subject: [PATCH 088/102] Increase the stale operations Signed-off-by: Trial97 --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index c93ea5e87..fb33d76a7 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,7 +6,6 @@ on: - cron: "0 0 * * 0" workflow_dispatch: - jobs: label: name: Label issues and PRs @@ -27,3 +26,4 @@ jobs: exempt-issue-labels: rfc,nostale exempt-all-milestones: true exempt-all-assignees: true + operations-per-run: 1000 From 9ea33e0651de007498ed6c8df4f0cb7289765204 Mon Sep 17 00:00:00 2001 From: Riley Richard Date: Wed, 5 Feb 2025 18:10:31 -0500 Subject: [PATCH 089/102] DCO Remediation Commit for Riley Richard I, Riley Richard , hereby add my Signed-off-by to this commit: cb83f8e52db1046173a8def2f216cfcf1518b91f Signed-off-by: Riley Richard From ef825a7bc5cf8b2a7bae88ab6e728e131adff46a Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 6 Feb 2025 09:58:41 +0200 Subject: [PATCH 090/102] update stale action Signed-off-by: Trial97 --- .github/workflows/stale.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fb33d76a7..4afa7d648 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -19,11 +19,13 @@ jobs: steps: - uses: actions/stale@v9 with: - days-before-stale: 30 + days-before-stale: 60 days-before-close: -1 # Don't close anything stale-issue-message: "This issue has been inactive for a while. Please add a comment or provide an update if it's still relevant." stale-pr-message: "This PR has had no recent activity. Please update it if it's still relevant." - exempt-issue-labels: rfc,nostale + exempt-issue-labels: rfc,nostale,active,wanted exempt-all-milestones: true exempt-all-assignees: true operations-per-run: 1000 + stale-issue-label: inactive + stale-pr-label: inactive From bf1084d7fa6503b65bdb63374e5f92020ae4a3d1 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 11 Feb 2025 10:59:10 +0200 Subject: [PATCH 091/102] Fix some undefined behaviour Signed-off-by: Trial97 --- CMakeLists.txt | 8 ++++---- launcher/launch/LogModel.h | 6 +++--- launcher/ui/widgets/CheckComboBox.cpp | 16 ++++++++-------- launcher/ui/widgets/CheckComboBox.h | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d61817ecf..a9d543e83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,14 +113,14 @@ if ((CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI else() # AppleClang and Clang message(STATUS "Address Sanitizer available on Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null") endif() elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # GCC message(STATUS "Address Sanitizer available on GCC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover") link_libraries("asan") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") message(STATUS "Address Sanitizer available on MSVC") diff --git a/launcher/launch/LogModel.h b/launcher/launch/LogModel.h index 18e51d7e3..bc08053fb 100644 --- a/launcher/launch/LogModel.h +++ b/launcher/launch/LogModel.h @@ -32,12 +32,12 @@ class LogModel : public QAbstractListModel { private /* types */: struct entry { - MessageLevel::Enum level; - QString line; + MessageLevel::Enum level = MessageLevel::Enum::Unknown; + QString line = {}; }; private: /* data */ - QVector m_content; + QVector m_content = {}; int m_maxLines = 1000; // first line in the circular buffer int m_firstLine = 0; diff --git a/launcher/ui/widgets/CheckComboBox.cpp b/launcher/ui/widgets/CheckComboBox.cpp index 41def3ba1..a84e6a8fa 100644 --- a/launcher/ui/widgets/CheckComboBox.cpp +++ b/launcher/ui/widgets/CheckComboBox.cpp @@ -40,7 +40,7 @@ class CheckComboModel : public QIdentityProxyModel { { if (role == Qt::CheckStateRole) { auto txt = QIdentityProxyModel::data(index, Qt::DisplayRole).toString(); - return checked.contains(txt) ? Qt::Checked : Qt::Unchecked; + return m_checked.contains(txt) ? Qt::Checked : Qt::Unchecked; } if (role == Qt::DisplayRole) return QIdentityProxyModel::data(index, Qt::DisplayRole); @@ -50,10 +50,10 @@ class CheckComboModel : public QIdentityProxyModel { { if (role == Qt::CheckStateRole) { auto txt = QIdentityProxyModel::data(index, Qt::DisplayRole).toString(); - if (checked.contains(txt)) { - checked.removeOne(txt); + if (m_checked.contains(txt)) { + m_checked.removeOne(txt); } else { - checked.push_back(txt); + m_checked.push_back(txt); } emit dataChanged(index, index); emit checkStateChanged(); @@ -61,13 +61,13 @@ class CheckComboModel : public QIdentityProxyModel { } return QIdentityProxyModel::setData(index, value, role); } - QStringList getChecked() { return checked; } + QStringList getChecked() { return m_checked; } signals: void checkStateChanged(); private: - QStringList checked; + QStringList m_checked = {}; }; CheckComboBox::CheckComboBox(QWidget* parent) : QComboBox(parent), m_separator(", ") @@ -92,7 +92,7 @@ void CheckComboBox::setSourceModel(QAbstractItemModel* new_model) void CheckComboBox::hidePopup() { - if (!containerMousePress) + if (!m_containerMousePress) QComboBox::hidePopup(); } @@ -138,7 +138,7 @@ bool CheckComboBox::eventFilter(QObject* receiver, QEvent* event) } case QEvent::MouseButtonPress: { auto ev = static_cast(event); - containerMousePress = ev && view()->indexAt(ev->pos()).isValid(); + m_containerMousePress = ev && view()->indexAt(ev->pos()).isValid(); break; } case QEvent::Wheel: diff --git a/launcher/ui/widgets/CheckComboBox.h b/launcher/ui/widgets/CheckComboBox.h index 876c6e3e1..02516982f 100644 --- a/launcher/ui/widgets/CheckComboBox.h +++ b/launcher/ui/widgets/CheckComboBox.h @@ -58,7 +58,7 @@ class CheckComboBox : public QComboBox { void toggleCheckState(int index); private: - QString m_default_text; - QString m_separator; - bool containerMousePress; + QString m_default_text = {}; + QString m_separator = {}; + bool m_containerMousePress = false; }; \ No newline at end of file From 1d1a4f1b30837e13ebd99c016af171d79697f22f Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 11 Feb 2025 21:02:27 +0200 Subject: [PATCH 092/102] Apply suggestions from code review Co-authored-by: TheKodeToad Signed-off-by: Alexandru Ionut Tripon --- launcher/launch/LogModel.h | 4 ++-- launcher/ui/widgets/CheckComboBox.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/launcher/launch/LogModel.h b/launcher/launch/LogModel.h index bc08053fb..167f74190 100644 --- a/launcher/launch/LogModel.h +++ b/launcher/launch/LogModel.h @@ -33,11 +33,11 @@ class LogModel : public QAbstractListModel { private /* types */: struct entry { MessageLevel::Enum level = MessageLevel::Enum::Unknown; - QString line = {}; + QString line; }; private: /* data */ - QVector m_content = {}; + QVector m_content; int m_maxLines = 1000; // first line in the circular buffer int m_firstLine = 0; diff --git a/launcher/ui/widgets/CheckComboBox.h b/launcher/ui/widgets/CheckComboBox.h index 02516982f..469587762 100644 --- a/launcher/ui/widgets/CheckComboBox.h +++ b/launcher/ui/widgets/CheckComboBox.h @@ -58,7 +58,7 @@ class CheckComboBox : public QComboBox { void toggleCheckState(int index); private: - QString m_default_text = {}; - QString m_separator = {}; + QString m_default_text; + QString m_separator; bool m_containerMousePress = false; }; \ No newline at end of file From 22b59e760c0f39749916052b9323e55f4217dd72 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Tue, 11 Feb 2025 21:03:04 +0200 Subject: [PATCH 093/102] Update launcher/ui/widgets/CheckComboBox.cpp Signed-off-by: Alexandru Ionut Tripon --- launcher/ui/widgets/CheckComboBox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/widgets/CheckComboBox.cpp b/launcher/ui/widgets/CheckComboBox.cpp index a84e6a8fa..02b629162 100644 --- a/launcher/ui/widgets/CheckComboBox.cpp +++ b/launcher/ui/widgets/CheckComboBox.cpp @@ -67,7 +67,7 @@ class CheckComboModel : public QIdentityProxyModel { void checkStateChanged(); private: - QStringList m_checked = {}; + QStringList m_checked; }; CheckComboBox::CheckComboBox(QWidget* parent) : QComboBox(parent), m_separator(", ") From 14b653e08dc46427a62b154bc187106fac28fdc9 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 12 Feb 2025 20:16:00 +0200 Subject: [PATCH 094/102] remove some unused files Signed-off-by: Trial97 --- launcher/ui/pages/global/MinecraftPage.h | 6 +- launcher/ui/pages/global/MinecraftPage.ui | 361 -------- .../ui/pages/instance/InstanceSettingsPage.ui | 824 ------------------ 3 files changed, 1 insertion(+), 1190 deletions(-) delete mode 100644 launcher/ui/pages/global/MinecraftPage.ui delete mode 100644 launcher/ui/pages/instance/InstanceSettingsPage.ui diff --git a/launcher/ui/pages/global/MinecraftPage.h b/launcher/ui/pages/global/MinecraftPage.h index e48efda04..b21862536 100644 --- a/launcher/ui/pages/global/MinecraftPage.h +++ b/launcher/ui/pages/global/MinecraftPage.h @@ -39,16 +39,12 @@ #include #include "Application.h" -#include "ui/widgets/MinecraftSettingsWidget.h" #include "java/JavaChecker.h" #include "ui/pages/BasePage.h" +#include "ui/widgets/MinecraftSettingsWidget.h" class SettingsObject; -namespace Ui { -class MinecraftPage; -} - class MinecraftPage : public MinecraftSettingsWidget, public BasePage { Q_OBJECT diff --git a/launcher/ui/pages/global/MinecraftPage.ui b/launcher/ui/pages/global/MinecraftPage.ui deleted file mode 100644 index 3a28c92c7..000000000 --- a/launcher/ui/pages/global/MinecraftPage.ui +++ /dev/null @@ -1,361 +0,0 @@ - - - MinecraftPage - - - - 0 - 0 - 936 - 541 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QTabWidget::Rounded - - - 0 - - - - General - - - - - - Window Size - - - - - - Start Minecraft &maximized - - - - - - - On newer versions the game only supports resolution. In order to simulate the maximized behaviour the current implementation approximates the maximum display size. - - - <html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: On the newer Minecraft versions the start maximized option is not fully supported.</span></p></body></html> - - - - - - - - - Window &height: - - - windowHeightSpinBox - - - - - - - Window &width: - - - windowWidthSpinBox - - - - - - - 1 - - - 65536 - - - 1 - - - 854 - - - - - - - 1 - - - 65536 - - - 480 - - - - - - - - - - - - Game time - - - - - - Show time spent &playing instances - - - - - - - Show time spent playing across &all instances - - - - - - - &Record time spent playing instances - - - - - - - Show time spent playing in hours - - - - - - - - - - Miscellaneous - - - - - - <html><head/><body><p>The launcher will automatically reopen when the game crashes or exits.</p></body></html> - - - &Close the launcher after game window opens - - - - - - - <html><head/><body><p>The launcher will automatically quit after the game exits or crashes.</p></body></html> - - - &Quit the launcher after game window closes - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - Tweaks - - - - - - Legacy settings - - - - - - <html><head/><body><p>Emulates usages of old online services which are no longer operating.</p><p>Current fixes include: skin and online mode support.</p></body></html> - - - Enable online fixes (experimental) - - - - - - - - - - Native library workarounds - - - - - - Use system installation of &GLFW - - - - - - - &GLFW library path - - - lineEditGLFWPath - - - - - - - Use system installation of &OpenAL - - - - - - - &OpenAL library path - - - lineEditOpenALPath - - - - - - - false - - - - - - - false - - - - - - - - - - Performance - - - - - - <html><head/><body><p>Enable Feral Interactive's GameMode, to potentially improve gaming performance.</p></body></html> - - - Enable Feral GameMode - - - - - - - <html><head/><body><p>Enable MangoHud's advanced performance overlay.</p></body></html> - - - Enable MangoHud - - - - - - - <html><head/><body><p>Use the discrete GPU instead of the primary GPU.</p></body></html> - - - Use discrete GPU - - - - - - - <html><head/><body><p>Use Zink, a Mesa OpenGL driver that implements OpenGL on top of Vulkan. Performance may vary depending on the situation. Note: If no suitable Vulkan driver is found, software rendering will be used.</p></body></html> - - - Use Zink - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - maximizedCheckBox - windowWidthSpinBox - windowHeightSpinBox - - - - diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.ui b/launcher/ui/pages/instance/InstanceSettingsPage.ui deleted file mode 100644 index e5ef98b00..000000000 --- a/launcher/ui/pages/instance/InstanceSettingsPage.ui +++ /dev/null @@ -1,824 +0,0 @@ - - - InstanceSettingsPage - - - - 0 - 0 - 691 - 581 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Open Global Settings - - - The settings here are overrides for global settings. - - - - - - - 1 - - - - Java - - - - - - true - - - Java insta&llation - - - true - - - false - - - - - - If enabled, the launcher will not check if an instance is compatible with the selected Java version. - - - Skip Java compatibility checks - - - - - - - - - - - - Browse - - - - - - - - - - - Download Java - - - - - - - Auto-detect... - - - - - - - Test - - - - - - - - - - - - true - - - Memor&y - - - true - - - false - - - - - - PermGen: - - - - - - - Minimum memory allocation: - - - - - - - Maximum memory allocation: - - - - - - - Note: Permgen is set automatically by Java 8 and later - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 256 - - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 8 - - - 1048576 - - - 128 - - - 1024 - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 4 - - - 999999999 - - - 8 - - - 64 - - - - - - - - - - Qt::AlignCenter - - - maxMemSpinBox - - - - - - - - - - true - - - Java argumen&ts - - - true - - - false - - - - - - - - - - - - - Game windows - - - - - - true - - - Game Window - - - true - - - false - - - - - - Start Minecraft maximized - - - - - - - The base game only supports resolution. In order to simulate the maximized behaviour the current implementation approximates the maximum display size.. - - - <html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: The maximized option may not be fully supported for the current minecraft version.</span></p></body></html> - - - - - - - - - Window height: - - - - - - - Window width: - - - - - - - 1 - - - 65536 - - - 1 - - - 854 - - - - - - - 1 - - - 65536 - - - 480 - - - - - - - - - - - - true - - - Conso&le Settings - - - true - - - false - - - - - - Show console while the game is running - - - - - - - Automatically close console when the game quits - - - - - - - Show console when the game crashes - - - - - - - - - - Miscellaneous - - - true - - - false - - - - - - Close the launcher after game window opens - - - - - - - Quit the launcher after game window closes - - - - - - - - - - Qt::Vertical - - - - 88 - 125 - - - - - - - - - Custom commands - - - - - - - - - - Environment variables - - - - - - - - - - Workarounds - - - - - - true - - - Native libraries - - - true - - - false - - - - - - Use system installation of OpenAL - - - - - - - &GLFW library path - - - lineEditGLFWPath - - - - - - - Use system installation of GLFW - - - - - - - false - - - - - - - &OpenAL library path - - - lineEditOpenALPath - - - - - - - false - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Performance - - - - - - true - - - Performance - - - true - - - false - - - - - - <html><head/><body><p>Enable Feral Interactive's GameMode, to potentially improve gaming performance.</p></body></html> - - - Enable Feral GameMode - - - - - - - <html><head/><body><p>Enable MangoHud's advanced performance overlay.</p></body></html> - - - Enable MangoHud - - - - - - - <html><head/><body><p>Use the discrete GPU instead of the primary GPU.</p></body></html> - - - Use discrete GPU - - - - - - - Use Zink, a Mesa OpenGL driver that implements OpenGL on top of Vulkan. Performance may vary depending on the situation. Note: If no suitable Vulkan driver is found, software rendering will be used. - - - Use Zink - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Miscellaneous - - - - - - Legacy settings - - - true - - - false - - - - - - <html><head/><body><p>Emulates usages of old online services which are no longer operating.</p><p>Current fixes include: skin and online mode support.</p></body></html> - - - Enable online fixes (experimental) - - - - - - - - - - true - - - Override global game time settings - - - true - - - false - - - - - - Show time spent playing this instance - - - - - - - Record time spent playing this instance - - - - - - - - - - Set a target to join on launch - - - true - - - false - - - - - - Server address: - - - - - - - - - - Singleplayer world - - - - - - - - - - - - - Override default account - - - true - - - false - - - - - - - - - 0 - 0 - - - - Account: - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - CustomCommands - QWidget -
ui/widgets/CustomCommands.h
- 1 -
- - EnvironmentVariables - QWidget -
ui/widgets/EnvironmentVariables.h
- 1 -
-
- - openGlobalJavaSettingsButton - settingsTabs - javaSettingsGroupBox - javaPathTextBox - javaBrowseBtn - javaDownloadBtn - javaDetectBtn - javaTestBtn - skipCompatibilityCheckbox - memoryGroupBox - minMemSpinBox - maxMemSpinBox - permGenSpinBox - javaArgumentsGroupBox - jvmArgsTextBox - windowSizeGroupBox - maximizedCheckBox - windowWidthSpinBox - windowHeightSpinBox - consoleSettingsBox - showConsoleCheck - autoCloseConsoleCheck - showConsoleErrorCheck - nativeWorkaroundsGroupBox - useNativeGLFWCheck - useNativeOpenALCheck - showGameTime - recordGameTime - miscellaneousSettingsBox - closeAfterLaunchCheck - quitAfterGameStopCheck - perfomanceGroupBox - enableFeralGamemodeCheck - enableMangoHud - useDiscreteGpuCheck - gameTimeGroupBox - serverJoinGroupBox - serverJoinAddress - instanceAccountGroupBox - instanceAccountSelector - - - -
From 9e954548dd702c05fbf33474c9c86f52fb67d4b4 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 12 Feb 2025 20:21:45 +0200 Subject: [PATCH 095/102] add libMangoHud_shim.so to mangohub preloadlist Signed-off-by: Trial97 --- launcher/minecraft/MinecraftInstance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 3ce563a4e..d1780d497 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -656,6 +656,7 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment() // dlsym variant is only needed for OpenGL and not included in the vulkan layer appendLib("libMangoHud_dlsym.so"); appendLib("libMangoHud_opengl.so"); + appendLib("libMangoHud_shim.so"); preloadList << mangoHudLibString; } From 174cddcf42f26b24a5a74ce2eaf4923b5b269d47 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 12 Feb 2025 20:40:09 +0200 Subject: [PATCH 096/102] make sure if user changes java path also disable java management Signed-off-by: Trial97 --- launcher/ui/widgets/JavaSettingsWidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/launcher/ui/widgets/JavaSettingsWidget.cpp b/launcher/ui/widgets/JavaSettingsWidget.cpp index 7a5e228fd..a255168e9 100644 --- a/launcher/ui/widgets/JavaSettingsWidget.cpp +++ b/launcher/ui/widgets/JavaSettingsWidget.cpp @@ -90,6 +90,11 @@ JavaSettingsWidget::JavaSettingsWidget(InstancePtr instance, QWidget* parent) auto javaDialog = new Java::InstallDialog({}, m_instance.get(), this); javaDialog->exec(); }); + connect(m_ui->javaPathTextBox, &QLineEdit::textChanged, [this](QString newValue) { + if (m_instance->settings()->get("JavaPath").toString() != newValue) { + m_instance->settings()->set("AutomaticJava", false); + } + }); } connect(m_ui->javaTestBtn, &QPushButton::clicked, this, &JavaSettingsWidget::onJavaTest); From de86e63611f7c5a986c358741fefc6c6ded5f08d Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Thu, 13 Feb 2025 00:05:14 +0000 Subject: [PATCH 097/102] Update .github/workflows/stale.yml Co-authored-by: Alexandru Ionut Tripon Signed-off-by: TheKodeToad --- .github/workflows/stale.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 4afa7d648..8de9389ef 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -21,8 +21,6 @@ jobs: with: days-before-stale: 60 days-before-close: -1 # Don't close anything - stale-issue-message: "This issue has been inactive for a while. Please add a comment or provide an update if it's still relevant." - stale-pr-message: "This PR has had no recent activity. Please update it if it's still relevant." exempt-issue-labels: rfc,nostale,active,wanted exempt-all-milestones: true exempt-all-assignees: true From d22a20ffa6002ed1aa8d292c22176ac17f16ba58 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Thu, 13 Feb 2025 08:14:20 +0200 Subject: [PATCH 098/102] Update .github/workflows/stale.yml Co-authored-by: TheKodeToad Signed-off-by: Alexandru Ionut Tripon --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 8de9389ef..106a7844f 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -21,7 +21,7 @@ jobs: with: days-before-stale: 60 days-before-close: -1 # Don't close anything - exempt-issue-labels: rfc,nostale,active,wanted + exempt-issue-labels: rfc,nostale,help wanted exempt-all-milestones: true exempt-all-assignees: true operations-per-run: 1000 From bdf87fa02fb1b4a72aef6915c09fef4a0e593f9f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 16 Feb 2025 00:25:49 +0000 Subject: [PATCH 099/102] chore(nix): update lockfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/3a228057f5b619feb3186e986dbe76278d707b6e?narHash=sha256-xvTo0Aw0%2Bveek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc%3D' (2025-02-01) → 'github:NixOS/nixpkgs/2ff53fe64443980e139eaa286017f53f88336dd0?narHash=sha256-%2B/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc%3D' (2025-02-13) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index ec0257def..dd50b5395 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1738410390, - "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "lastModified": 1739446958, + "narHash": "sha256-+/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", + "rev": "2ff53fe64443980e139eaa286017f53f88336dd0", "type": "github" }, "original": { From 8f1750df51668a94ab750dd05345ec5cc4e124c2 Mon Sep 17 00:00:00 2001 From: thonkdifferent <41342923+thonkdifferent@users.noreply.github.com> Date: Sun, 16 Feb 2025 19:30:31 +0200 Subject: [PATCH 100/102] Recognize riscv64 as a 64-bit platform Currently PrismLauncher complains about the installed JDK being a 32-bit version, despite it being compiled for 64-bit RISC-V `riscv64`. This PR fixes this issue. Signed-off-by: thonkdifferent <41342923+thonkdifferent@users.noreply.github.com> --- launcher/java/JavaChecker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/java/JavaChecker.cpp b/launcher/java/JavaChecker.cpp index 772c90e42..07b5d7b40 100644 --- a/launcher/java/JavaChecker.cpp +++ b/launcher/java/JavaChecker.cpp @@ -171,7 +171,7 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status) auto os_arch = results["os.arch"]; auto java_version = results["java.version"]; auto java_vendor = results["java.vendor"]; - bool is_64 = os_arch == "x86_64" || os_arch == "amd64" || os_arch == "aarch64" || os_arch == "arm64"; + bool is_64 = os_arch == "x86_64" || os_arch == "amd64" || os_arch == "aarch64" || os_arch == "arm64" || os_arch == "riscv64"; result.validity = Result::Validity::Valid; result.is_64bit = is_64; From 73bb740bbb0b7b0c2a14c8f758df82cd8a135797 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 18:14:21 +0000 Subject: [PATCH 101/102] chore(deps): update actions/cache action to v4.2.1 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99dd4f1a5..ae4deb7a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -170,7 +170,7 @@ jobs: - name: Retrieve ccache cache (Windows MinGW-w64) if: runner.os == 'Windows' && matrix.msystem != '' && inputs.build_type == 'Debug' - uses: actions/cache@v4.2.0 + uses: actions/cache@v4.2.1 with: path: '${{ github.workspace }}\.ccache' key: ${{ matrix.os }}-mingw-w64-ccache-${{ github.run_id }} From 46385e671d07c3f207b1329f396e2265673909c3 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 18 Feb 2025 22:55:51 -0500 Subject: [PATCH 102/102] ci: always run nix workflow on push Signed-off-by: Seth Flynn --- .github/workflows/nix.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 09e3dee1f..b44011711 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -8,8 +8,6 @@ on: - ".github/ISSUE_TEMPLATE/**" - ".markdownlint**" - "flatpak/**" - tags: - - "*" pull_request_target: paths-ignore: - "**.md"