From 973b43ca7a12cdcb6891d069b3bb6782eda6f28a Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 13 Sep 2024 20:01:45 +0300 Subject: [PATCH 01/33] Add techinc client ID Signed-off-by: Trial97 --- launcher/Application.cpp | 3 ++ launcher/ui/pages/global/APIPage.cpp | 2 ++ launcher/ui/pages/global/APIPage.ui | 34 +++++++++++++++++-- .../modplatform/technic/TechnicModel.cpp | 4 +++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 9cd0445e6..ba9a9caa9 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -777,6 +777,9 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) // FTBApp instances m_settings->registerSetting("FTBAppInstancesPath", ""); + // Custom Techinc Client ID + m_settings->registerSetting("TechincClientID", ""); + // Init page provider { m_globalSettingsProvider = std::make_shared(tr("Settings")); diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 82aa76a4f..4beb0b886 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -143,6 +143,7 @@ void APIPage::loadSettings() ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); + ui->techicClientID->setText(s->get("TechincClientID").toString()); } void APIPage::applySettings() @@ -172,6 +173,7 @@ void APIPage::applySettings() QString modrinthToken = ui->modrinthToken->text(); s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); + s->set("TechincClientID", ui->techicClientID->text()); } bool APIPage::apply() diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index a7f3f3f72..f52d41d23 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 600 + 841 + 620 @@ -288,6 +288,36 @@ + + + + Techinc Client ID + + + + + + <html><head/><body><p>Note: you only need to set this to access private data.</p></body></html> + + + + + + + (None) + + + + + + + Enter a custom GUID client ID for Techinc here. + + + + + + diff --git a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp index 4181edab6..55a8b254c 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp +++ b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp @@ -154,6 +154,10 @@ void Technic::ListModel::performSearch() QString("%1search?build=%2&q=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm); searchMode = List; } + auto clientId = APPLICATION->settings()->get("TechincClientID").toString(); + if (!clientId.isEmpty()) { + searchUrl += "?cid=" + clientId; + } netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl), response)); jobPtr = netJob; jobPtr->start(); From d20f24d96fa35311935b58aa6cbae5623f437c6a Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Fri, 13 Sep 2024 21:13:21 +0300 Subject: [PATCH 02/33] Apply suggestions from code review Co-authored-by: seth Signed-off-by: Alexandru Ionut Tripon --- launcher/Application.cpp | 4 ++-- launcher/ui/pages/global/APIPage.cpp | 4 ++-- launcher/ui/pages/global/APIPage.ui | 6 +++--- launcher/ui/pages/modplatform/technic/TechnicModel.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index ba9a9caa9..815f842c5 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -777,8 +777,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) // FTBApp instances m_settings->registerSetting("FTBAppInstancesPath", ""); - // Custom Techinc Client ID - m_settings->registerSetting("TechincClientID", ""); + // Custom Technic Client ID + m_settings->registerSetting("TechnicClientID", ""); // Init page provider { diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 4beb0b886..0af34bcd6 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -143,7 +143,7 @@ void APIPage::loadSettings() ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); - ui->techicClientID->setText(s->get("TechincClientID").toString()); + ui->techicClientID->setText(s->get("TechnicClientID").toString()); } void APIPage::applySettings() @@ -173,7 +173,7 @@ void APIPage::applySettings() QString modrinthToken = ui->modrinthToken->text(); s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); - s->set("TechincClientID", ui->techicClientID->text()); + s->set("TechincClientID", ui->technicClientID->text()); } bool APIPage::apply() diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index f52d41d23..9c713aa79 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -291,7 +291,7 @@ - Techinc Client ID + Technic Client ID @@ -302,7 +302,7 @@ - + (None) @@ -311,7 +311,7 @@ - Enter a custom GUID client ID for Techinc here. + Enter a custom GUID client ID for Technic here. diff --git a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp index 55a8b254c..f7e7f4433 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp +++ b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp @@ -154,7 +154,7 @@ void Technic::ListModel::performSearch() QString("%1search?build=%2&q=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm); searchMode = List; } - auto clientId = APPLICATION->settings()->get("TechincClientID").toString(); + auto clientId = APPLICATION->settings()->get("TechnicClientID").toString(); if (!clientId.isEmpty()) { searchUrl += "?cid=" + clientId; } From 1db122f1a29b90f2b556aeaddb7336233c0c4769 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 13 Sep 2024 21:37:50 +0300 Subject: [PATCH 03/33] fix typo Signed-off-by: Trial97 --- launcher/ui/pages/global/APIPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 0af34bcd6..5ec6fbce5 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -143,7 +143,7 @@ void APIPage::loadSettings() ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); - ui->techicClientID->setText(s->get("TechnicClientID").toString()); + ui->technicClientID->setText(s->get("TechnicClientID").toString()); } void APIPage::applySettings() From e59f90eca8db7f60328ee2ca93c6b20053572ea6 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Sat, 14 Sep 2024 00:19:48 +0300 Subject: [PATCH 04/33] Update launcher/ui/pages/global/APIPage.cpp Co-authored-by: TheKodeToad Signed-off-by: Alexandru Ionut Tripon --- launcher/ui/pages/global/APIPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 5ec6fbce5..a137c4cde 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -173,7 +173,7 @@ void APIPage::applySettings() QString modrinthToken = ui->modrinthToken->text(); s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); - s->set("TechincClientID", ui->technicClientID->text()); + s->set("TechnicClientID", ui->technicClientID->text()); } bool APIPage::apply() From 77463c6d33e8cafc66ac2b3fab59e167941af819 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 18 Sep 2024 21:17:15 +0300 Subject: [PATCH 05/33] display minecraft log before instance run Signed-off-by: Trial97 --- launcher/ui/pages/instance/LogPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/instance/LogPage.cpp b/launcher/ui/pages/instance/LogPage.cpp index 0c22d1de6..6a4888f9c 100644 --- a/launcher/ui/pages/instance/LogPage.cpp +++ b/launcher/ui/pages/instance/LogPage.cpp @@ -234,7 +234,7 @@ bool LogPage::apply() bool LogPage::shouldDisplay() const { - return m_instance->isRunning() || m_proxy->rowCount() > 0; + return true; } void LogPage::on_btnPaste_clicked() From 1b2e9b95e2dd62f844c5d019d9b0b503084dd382 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 25 Sep 2024 19:37:25 +0300 Subject: [PATCH 06/33] add prefix to non-standard packwiz fields Signed-off-by: Trial97 --- launcher/modplatform/packwiz/Packwiz.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/modplatform/packwiz/Packwiz.cpp b/launcher/modplatform/packwiz/Packwiz.cpp index 77a0935f3..325b0a6e4 100644 --- a/launcher/modplatform/packwiz/Packwiz.cpp +++ b/launcher/modplatform/packwiz/Packwiz.cpp @@ -208,9 +208,9 @@ void V1::updateModIndex(QDir& index_dir, Mod& mod) auto tbl = toml::table{ { "name", mod.name.toStdString() }, { "filename", mod.filename.toStdString() }, { "side", sideToString(mod.side).toStdString() }, - { "loaders", loaders }, - { "mcVersions", mcVersions }, - { "releaseType", mod.releaseType.toString().toStdString() }, + { "x-prismlauncher-loaders", loaders }, + { "x-prismlauncher-mc-versions", mcVersions }, + { "x-prismlauncher-release-type", mod.releaseType.toString().toStdString() }, { "download", toml::table{ { "mode", mod.mode.toStdString() }, @@ -295,15 +295,15 @@ auto V1::getIndexForMod(QDir& index_dir, QString slug) -> Mod mod.name = stringEntry(table, "name"); mod.filename = stringEntry(table, "filename"); mod.side = stringToSide(stringEntry(table, "side")); - mod.releaseType = ModPlatform::IndexedVersionType(stringEntry(table, "releaseType")); - if (auto loaders = table["loaders"]; loaders && loaders.is_array()) { + mod.releaseType = ModPlatform::IndexedVersionType(stringEntry(table, "x-prismlauncher-release-type")); + if (auto loaders = table["x-prismlauncher-loaders"]; loaders && loaders.is_array()) { for (auto&& loader : *loaders.as_array()) { if (loader.is_string()) { mod.loaders |= ModPlatform::getModLoaderFromString(QString::fromStdString(loader.as_string()->value_or(""))); } } } - if (auto versions = table["mcVersions"]; versions && versions.is_array()) { + if (auto versions = table["x-prismlauncher-mc-versions"]; versions && versions.is_array()) { for (auto&& version : *versions.as_array()) { if (version.is_string()) { auto ver = QString::fromStdString(version.as_string()->value_or("")); From 6475dc5786600ee19d512f9b11f662a240922fa1 Mon Sep 17 00:00:00 2001 From: Cart <81428538+cartrigger@users.noreply.github.com> Date: Thu, 26 Sep 2024 01:58:21 -0400 Subject: [PATCH 07/33] Lots of J's for Java needed to be uppercased --- launcher/VersionProxyModel.cpp | 4 ++-- launcher/java/download/ArchiveDownloadTask.cpp | 2 +- launcher/ui/MainWindow.ui | 2 +- launcher/ui/java/InstallJavaDialog.cpp | 8 ++++---- launcher/ui/pages/global/JavaPage.cpp | 4 ++-- launcher/ui/setupwizard/AutoJavaWizardPage.ui | 2 +- launcher/ui/setupwizard/JavaWizardPage.cpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/launcher/VersionProxyModel.cpp b/launcher/VersionProxyModel.cpp index 552900d35..12a82f73d 100644 --- a/launcher/VersionProxyModel.cpp +++ b/launcher/VersionProxyModel.cpp @@ -140,9 +140,9 @@ QVariant VersionProxyModel::headerData(int section, Qt::Orientation orientation, case Path: return tr("Filesystem path to this version"); case JavaName: - return tr("The alternative name of the java version"); + return tr("The alternative name of the Java version"); case JavaMajor: - return tr("The java major version"); + return tr("The Java major version"); case Time: return tr("Release date of this version"); } diff --git a/launcher/java/download/ArchiveDownloadTask.cpp b/launcher/java/download/ArchiveDownloadTask.cpp index 6d6ab0cef..bb7cc568d 100644 --- a/launcher/java/download/ArchiveDownloadTask.cpp +++ b/launcher/java/download/ArchiveDownloadTask.cpp @@ -65,7 +65,7 @@ void ArchiveDownloadTask::executeTask() void ArchiveDownloadTask::extractJava(QString input) { - setStatus(tr("Extracting java")); + setStatus(tr("Extracting Java")); if (input.endsWith("tar")) { setStatus(tr("Extracting Java (Progress is not reported for tar archives)")); QFile in(input); diff --git a/launcher/ui/MainWindow.ui b/launcher/ui/MainWindow.ui index 89e536b01..f20c34206 100644 --- a/launcher/ui/MainWindow.ui +++ b/launcher/ui/MainWindow.ui @@ -798,7 +798,7 @@ Java - Open the java folder in a file browser. Only available if the built-in Java downloader is used. + Open the Java folder in a file browser. Only available if the built-in Java downloader is used. diff --git a/launcher/ui/java/InstallJavaDialog.cpp b/launcher/ui/java/InstallJavaDialog.cpp index f01edc5e5..0ece3220b 100644 --- a/launcher/ui/java/InstallJavaDialog.cpp +++ b/launcher/ui/java/InstallJavaDialog.cpp @@ -57,13 +57,13 @@ class InstallJavaPage : public QWidget, public BasePage { majorVersionSelect = new VersionSelectWidget(this); majorVersionSelect->selectCurrent(); - majorVersionSelect->setEmptyString(tr("No java versions are currently available in the meta.")); - majorVersionSelect->setEmptyErrorString(tr("Couldn't load or download the java version lists!")); + majorVersionSelect->setEmptyString(tr("No Java versions are currently available in the meta.")); + majorVersionSelect->setEmptyErrorString(tr("Couldn't load or download the Java version lists!")); horizontalLayout->addWidget(majorVersionSelect, 1); javaVersionSelect = new VersionSelectWidget(this); - javaVersionSelect->setEmptyString(tr("No java versions are currently available for your OS.")); - javaVersionSelect->setEmptyErrorString(tr("Couldn't load or download the java version lists!")); + javaVersionSelect->setEmptyString(tr("No Java versions are currently available for your OS.")); + javaVersionSelect->setEmptyErrorString(tr("Couldn't load or download the Java version lists!")); horizontalLayout->addWidget(javaVersionSelect, 4); connect(majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &InstallJavaPage::setSelectedVersion); connect(majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &InstallJavaPage::selectionChanged); diff --git a/launcher/ui/pages/global/JavaPage.cpp b/launcher/ui/pages/global/JavaPage.cpp index 6699b00c0..0ae296815 100644 --- a/launcher/ui/pages/global/JavaPage.cpp +++ b/launcher/ui/pages/global/JavaPage.cpp @@ -67,8 +67,8 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage) ui->managedJavaList->initialize(new JavaInstallList(this, true)); ui->managedJavaList->setResizeOn(2); ui->managedJavaList->selectCurrent(); - ui->managedJavaList->setEmptyString(tr("No managed java versions are installed")); - ui->managedJavaList->setEmptyErrorString(tr("Couldn't load the managed java list!")); + 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()) diff --git a/launcher/ui/setupwizard/AutoJavaWizardPage.ui b/launcher/ui/setupwizard/AutoJavaWizardPage.ui index bd72cf695..a862524b0 100644 --- a/launcher/ui/setupwizard/AutoJavaWizardPage.ui +++ b/launcher/ui/setupwizard/AutoJavaWizardPage.ui @@ -30,7 +30,7 @@ - We've added a feature to automatically download the correct Java version for each version of Minecraft(this can be changed in the Java Settings). Would you like to enable or disable this feature? + We've added a feature to automatically download the correct Java version for each version of Minecraft (this can be changed in the Java Settings). Would you like to enable or disable this feature? true diff --git a/launcher/ui/setupwizard/JavaWizardPage.cpp b/launcher/ui/setupwizard/JavaWizardPage.cpp index 47718d6da..8caae173c 100644 --- a/launcher/ui/setupwizard/JavaWizardPage.cpp +++ b/launcher/ui/setupwizard/JavaWizardPage.cpp @@ -83,6 +83,6 @@ void JavaWizardPage::retranslate() { setTitle(tr("Java")); setSubTitle( - tr("Please select how much memory to allocate to instances and if Prism Launcher should manage java automatically or manually.")); + tr("Please select how much memory to allocate to instances and if Prism Launcher should manage Java automatically or manually.")); m_java_widget->retranslate(); } From 2dc6f7504b4cfb64b59b3eb905f1b1ac387b8c83 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:18:35 -0700 Subject: [PATCH 08/33] add vc_redist as a NSIS install section Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- program_info/CMakeLists.txt | 15 +++++++++++++++ program_info/win_install.nsi.in | 2 ++ 2 files changed, 17 insertions(+) diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 91b213274..90d038f4d 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -41,6 +41,21 @@ configure_file(org.prismlauncher.PrismLauncher.metainfo.xml.in org.prismlauncher configure_file(prismlauncher.rc.in prismlauncher.rc @ONLY) configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY) configure_file(prismlauncher.ico prismlauncher.ico COPYONLY) + +if(MSVC) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION vc_redist) + include(InstallRequiredSystemLibraries) + file(TO_NATIVE_PATH ${MSVC_REDIST_DIR} Native_MSVC_REDIST_DIR) + set(Launcher_MSVC_Redist_NSIS_Section "\ +Section \"Visual Studio Runtime\" + SetOutPath \"$INSTDIR\\vc_redist\" + File \"${Native_MSVC_REDIST_DIR}\\vc_redist.x64.exe\" + ExecWait \"$INSTDIR\\vc_redist\\vc_redist.x64.exe /install /passive\" + ; Delete \"$INSTDIR\\vc_redist\\vc_redist.x64.exe\" +SectionEnd\ +") +endif() + configure_file(win_install.nsi.in win_install.nsi @ONLY) if(SCDOC_FOUND) diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in index cc56b9bd5..c75e066bd 100644 --- a/program_info/win_install.nsi.in +++ b/program_info/win_install.nsi.in @@ -396,6 +396,8 @@ Section "@Launcher_DisplayName@" SectionEnd +@Launcher_MSVC_Redist_NSIS_Section@ + Section "Start Menu Shortcut" SM_SHORTCUTS CreateShortcut "$SMPROGRAMS\@Launcher_DisplayName@.lnk" "$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "" "$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" 0 From 37d3b2a4f631d2a8ce3570a9c377576d4f5a3aa1 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:49:00 -0700 Subject: [PATCH 09/33] prevent the unauthorised reditribution of MSVC CRT files Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- program_info/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 90d038f4d..c9a1d597d 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -43,7 +43,7 @@ configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY) configure_file(prismlauncher.ico prismlauncher.ico COPYONLY) if(MSVC) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION vc_redist) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true) include(InstallRequiredSystemLibraries) file(TO_NATIVE_PATH ${MSVC_REDIST_DIR} Native_MSVC_REDIST_DIR) set(Launcher_MSVC_Redist_NSIS_Section "\ From c5daca3b013bd9cc8b17283d2a63e873480c2c16 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:57:28 -0700 Subject: [PATCH 10/33] include vc_redist in portable build Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d70fe79b..49d3f731f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,6 +372,11 @@ endif() if(NOT (UNIX AND APPLE)) # Install "portable.txt" if selected component is "portable" install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${Launcher_Portable_File}" DESTINATION "." COMPONENT portable EXCLUDE_FROM_ALL) + if (MSVC) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true) + include(InstallRequiredSystemLibraries) + install(FILES "${MSVC_REDIST_DIR}/vc_redist.x64.exe" DESTINATION "vc_redist/." COMPONENT portable EXCLUDE_FROM_ALL ) + endif() endif() if(UNIX AND APPLE) From 8fa4467a362a55d10a3491a3b1d2301d3510383a Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:29:00 -0700 Subject: [PATCH 11/33] use `/norestart` with redist install Co-authored-by: seth Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- program_info/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index c9a1d597d..0ce559406 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -50,7 +50,7 @@ if(MSVC) Section \"Visual Studio Runtime\" SetOutPath \"$INSTDIR\\vc_redist\" File \"${Native_MSVC_REDIST_DIR}\\vc_redist.x64.exe\" - ExecWait \"$INSTDIR\\vc_redist\\vc_redist.x64.exe /install /passive\" + ExecWait \"$INSTDIR\\vc_redist\\vc_redist.x64.exe /install /passive /norestart\" ; Delete \"$INSTDIR\\vc_redist\\vc_redist.x64.exe\" SectionEnd\ ") From b9c19fd3f73877f80fb2363617d893f91e5037e2 Mon Sep 17 00:00:00 2001 From: Mason Rocha Date: Fri, 27 Sep 2024 16:42:59 -0500 Subject: [PATCH 12/33] fix: don't annoy when java tmpdir jvmarg is set & /tmp is noexec Signed-off-by: Mason Rocha Got annoyed, didn't want to see it anymore. Java tmpdir noexec warning modified to include information about possible remedies available --- launcher/Application.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 6379678c9..4a66271a3 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1025,7 +1025,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) } // notify user if /tmp is mounted with `noexec` (#1693) - { + QString jvmArgs = m_settings->get("JvmArgs").toString(); + if(jvmArgs.indexOf("java.io.tmpdir") == -1) { /* java.io.tmpdir is a valid workaround, so don't annoy */ bool is_tmp_noexec = false; #if defined(Q_OS_LINUX) @@ -1045,7 +1046,11 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) if (is_tmp_noexec) { auto infoMsg = tr("Your /tmp directory is currently mounted with the 'noexec' flag enabled.\n" - "Some versions of Minecraft may not launch.\n"); + "Some versions of Minecraft may not launch.\n" + "\n" + "You may solve this issue by remounting /tmp as 'exec' or setting " + "the java.io.tmpdir JVM argument to a writeable directory in a " + "filesystem where the 'exec' flag is set (e.g., /home/user/.local/tmp)\n"); auto msgBox = new QMessageBox(QMessageBox::Information, tr("Incompatible system configuration"), infoMsg, QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setAttribute(Qt::WA_DeleteOnClose); From 00f4221a836bc747ec8d220a52e7b96ed24f871a Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 27 Sep 2024 19:16:50 -0700 Subject: [PATCH 13/33] reorg MSVC set(CMAKE_INSTALL_SYSTEM_RUNTIMES_LIBS_SKIP true) call Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- CMakeLists.txt | 6 ++++-- program_info/CMakeLists.txt | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49d3f731f..cea61ddbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,6 +358,10 @@ include(ECMQtDeclareLoggingCategory) ####################################### Program Info ####################################### set(Launcher_APP_BINARY_NAME "prismlauncher" CACHE STRING "Name of the Launcher binary") +if(MSVC) + set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true) + include(InstallRequiredSystemLibraries) +endif() add_subdirectory(program_info) ####################################### Install layout ####################################### @@ -373,8 +377,6 @@ if(NOT (UNIX AND APPLE)) # Install "portable.txt" if selected component is "portable" install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${Launcher_Portable_File}" DESTINATION "." COMPONENT portable EXCLUDE_FROM_ALL) if (MSVC) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true) - include(InstallRequiredSystemLibraries) install(FILES "${MSVC_REDIST_DIR}/vc_redist.x64.exe" DESTINATION "vc_redist/." COMPONENT portable EXCLUDE_FROM_ALL ) endif() endif() diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 0ce559406..8a7d4868f 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -43,7 +43,6 @@ configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY) configure_file(prismlauncher.ico prismlauncher.ico COPYONLY) if(MSVC) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true) include(InstallRequiredSystemLibraries) file(TO_NATIVE_PATH ${MSVC_REDIST_DIR} Native_MSVC_REDIST_DIR) set(Launcher_MSVC_Redist_NSIS_Section "\ From a897b012d988861a47df887f0e8d2cd55d7bd584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgars=20C=C4=ABrulis?= Date: Sat, 28 Sep 2024 12:11:25 +0300 Subject: [PATCH 14/33] chore: update Qt to 6.7.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only bug fixes no new / breaking changes Signed-off-by: Edgars Cīrulis --- .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 ccba62541..a8ee6e6cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ jobs: qt_ver: 6 qt_host: windows qt_arch: "" - qt_version: "6.7.2" + qt_version: "6.7.3" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: windows-2022 @@ -90,7 +90,7 @@ jobs: qt_ver: 6 qt_host: windows qt_arch: "win64_msvc2019_arm64" - qt_version: "6.7.2" + qt_version: "6.7.3" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: macos-14 @@ -99,7 +99,7 @@ jobs: qt_ver: 6 qt_host: mac qt_arch: "" - qt_version: "6.7.2" + qt_version: "6.7.3" qt_modules: "qt5compat qtimageformats qtnetworkauth" - os: macos-14 From ed15a28eb3af1487cff7b81ed06b91afd35de4a0 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sat, 28 Sep 2024 14:58:13 -0700 Subject: [PATCH 15/33] fix : baking the redist into the installer breaks GPL, download at runtime instead Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .github/workflows/build.yml | 3 +++ CMakeLists.txt | 7 ------- program_info/CMakeLists.txt | 25 +++++++++++++++---------- program_info/win_install.nsi.in | 23 +++++++++++++++++++++++ 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccba62541..7345ffe90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -471,6 +471,9 @@ jobs: - name: Package (Windows, installer) if: runner.os == 'Windows' run: | + New-Item -Name NSISPlugins -ItemType Directory + Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip -OutFile NSISPlugins\NScurl.zip + Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NSIScurl cd ${{ env.INSTALL_DIR }} makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi" diff --git a/CMakeLists.txt b/CMakeLists.txt index cea61ddbf..3d70fe79b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,10 +358,6 @@ include(ECMQtDeclareLoggingCategory) ####################################### Program Info ####################################### set(Launcher_APP_BINARY_NAME "prismlauncher" CACHE STRING "Name of the Launcher binary") -if(MSVC) - set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true) - include(InstallRequiredSystemLibraries) -endif() add_subdirectory(program_info) ####################################### Install layout ####################################### @@ -376,9 +372,6 @@ endif() if(NOT (UNIX AND APPLE)) # Install "portable.txt" if selected component is "portable" install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${Launcher_Portable_File}" DESTINATION "." COMPONENT portable EXCLUDE_FROM_ALL) - if (MSVC) - install(FILES "${MSVC_REDIST_DIR}/vc_redist.x64.exe" DESTINATION "vc_redist/." COMPONENT portable EXCLUDE_FROM_ALL ) - endif() endif() if(UNIX AND APPLE) diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 8a7d4868f..30a435866 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -43,16 +43,21 @@ configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY) configure_file(prismlauncher.ico prismlauncher.ico COPYONLY) if(MSVC) - include(InstallRequiredSystemLibraries) - file(TO_NATIVE_PATH ${MSVC_REDIST_DIR} Native_MSVC_REDIST_DIR) - set(Launcher_MSVC_Redist_NSIS_Section "\ -Section \"Visual Studio Runtime\" - SetOutPath \"$INSTDIR\\vc_redist\" - File \"${Native_MSVC_REDIST_DIR}\\vc_redist.x64.exe\" - ExecWait \"$INSTDIR\\vc_redist\\vc_redist.x64.exe /install /passive /norestart\" - ; Delete \"$INSTDIR\\vc_redist\\vc_redist.x64.exe\" -SectionEnd\ -") + set(Launcher_MSVC_Redist_NSIS_Section [=[ +!ifdef haveNSIScurl +Section "Visual Studio Runtime" + DetailPrint 'Downloading Microsoft Visual C++ Redistributable...' + NScurl::http GET "https://aka.ms/vs/17/release/vc_redist.x64.exe" "$INSTDIR\vc_redist\vc_redist.x64.exe" /INSIST /CANCEL /Zone.Identifier /END + Pop $0 + ${If} $0 == "OK" + DetailPrint "Download successful" + ExecWait "$INSTDIR\vc_redist\vc_redist.x64.exe /install /passive /norestart\" + ${Else} + DetailPrint "Download failed with error $0" + ${EndIf} +SectionEnd +!endif +]=]) endif() configure_file(win_install.nsi.in win_install.nsi @ONLY) diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in index c75e066bd..a5c38599d 100644 --- a/program_info/win_install.nsi.in +++ b/program_info/win_install.nsi.in @@ -112,6 +112,16 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "@Launcher_Copyright@" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "@Launcher_VERSION_NAME4@" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@" +;-------------------------------- +; Conditional comp with file exist + +!macro CompileTimeIfFileExist path define +!tempfile tmpinc +!system 'IF EXIST "${path}" echo !define ${define} > "${tmpinc}"' +!include "${tmpinc}" +!delfile "${tmpinc}" +!undef tmpinc +!macroend ;-------------------------------- ; Shell Associate Macros @@ -336,6 +346,19 @@ Section "" UninstallPrevious SectionEnd +;------------------------------------ +; include nice plugins + +; NSIScurl - curl in NSIS +; used for MSVS redist download +; extract to ../NSISPlugins/NSIScurl +; https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip +!insertmacro CompileTimeIfFileExist "../NSISPlugins/NSIScurl/Plugins/" haveNSIScurl +!ifdef haveNSIScurl +!AddPluginDir /x86-unicode "../NSISPlugins/NSIScurl/Plugins/x86-unicode" +!AddPluginDir /x86-ansi "../NSISPlugins/NSIScurl/Plugins/x86-ansi" +!AddPluginDir /amd64-unicode "../NSISPlugins/NSIScurl/Plugins/amd64-unicode" +!endif ;------------------------------------ From c8990438165cce1d303e8754a125758fd69b8ad9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 29 Sep 2024 00:25:33 +0000 Subject: [PATCH 16/33] 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/4f807e8940284ad7925ebd0a0993d2a1791acb2f?narHash=sha256-IiA3jfbR7K/B5%2B9byVi9BZGWTD4VSbWe8VLpp9B/iYk%3D' (2024-09-11) → 'github:NixOS/nixpkgs/1925c603f17fc89f4c8f6bf6f631a802ad85d784?narHash=sha256-J%2BPeFKSDV%2BpHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI%3D' (2024-09-26) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 58bc4e30f..7667a8688 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726062873, - "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=", + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", "type": "github" }, "original": { From 732008db203d1ff6cc7c5d4957cb394d016eaf79 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:27:06 -0400 Subject: [PATCH 17/33] ci: drop garnix Signed-off-by: seth --- garnix.yaml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 garnix.yaml diff --git a/garnix.yaml b/garnix.yaml deleted file mode 100644 index a7c1b48a9..000000000 --- a/garnix.yaml +++ /dev/null @@ -1,10 +0,0 @@ -builds: - exclude: - # Currently broken on Garnix's end - - "*.x86_64-darwin.*" - include: - - "checks.x86_64-linux.*" - - "packages.x86_64-linux.*" - - "packages.aarch64-linux.*" - - "packages.x86_64-darwin.*" - - "packages.aarch64-darwin.*" From 2663ac5405cbfc3c29a38b32a755b7c7ebda0779 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:34:59 -0400 Subject: [PATCH 18/33] build(nix): add debug builds This will lead to build times on par with our other CI jobs, as now we're not always building for release Signed-off-by: seth --- flake.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/flake.nix b/flake.nix index 987fc0eda..d07834b4c 100644 --- a/flake.nix +++ b/flake.nix @@ -118,5 +118,24 @@ # Only output them if they're available on the current system lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages ); + + # We put these under legacyPackages as they are meant for CI, not end user consumption + legacyPackages = forAllSystems ( + system: + let + prismPackages = self.packages.${system}; + legacyPackages = self.legacyPackages.${system}; + in + { + prismlauncher-debug = prismPackages.prismlauncher.override { + prismlauncher-unwrapped = legacyPackages.prismlauncher-unwrapped-debug; + }; + + prismlauncher-unwrapped-debug = prismPackages.prismlauncher-unwrapped.overrideAttrs { + cmakeBuildType = "Debug"; + dontStrip = true; + }; + } + ); }; } From 5adca58337e9fe2a71f7bdd0951494ceddb34659 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:44:19 -0400 Subject: [PATCH 19/33] ci: add nix job Signed-off-by: seth --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++ .github/workflows/trigger_builds.yml | 1 + .github/workflows/trigger_release.yml | 1 + 3 files changed, 55 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccba62541..f26884c2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,9 @@ 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 @@ -631,3 +634,53 @@ jobs: with: bundle: "Prism Launcher.flatpak" manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml + + nix: + name: Nix (${{ matrix.system }}) + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + system: x86_64-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@v27 + + # For PRs + - name: Setup Nix Magic Cache + uses: DeterminateSystems/magic-nix-cache-action@v8 + + # 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/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 9efafc8cc..0b8386d69 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -38,5 +38,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 }} diff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.yml index 134281b2c..e800653e3 100644 --- a/.github/workflows/trigger_release.yml +++ b/.github/workflows/trigger_release.yml @@ -22,6 +22,7 @@ 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 68bf500f7ee48f17abf2a27e942d953a9962ef55 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 19 Sep 2024 16:50:45 -0400 Subject: [PATCH 20/33] chore: add nix reformat to .git-blame-ignore-revs Signed-off-by: seth --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 2163db45b..528b128b1 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -2,3 +2,6 @@ # tabs -> spaces bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 + +# (nix) alejandra -> nixfmt +4c81d8c53d09196426568c4a31a4e752ed05397a From bf432b5514d7c9c90761a285d17afbd736e4a687 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Sep 2024 16:21:07 -0400 Subject: [PATCH 21/33] chore(nix): use cachix for binary cache Signed-off-by: seth --- flake.nix | 6 ++++-- nix/README.md | 20 ++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index d07834b4c..f4ca782ec 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,10 @@ description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)"; nixConfig = { - extra-substituters = [ "https://cache.garnix.io" ]; - extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; + extra-substituters = [ "https://prismlauncher.cachix.org" ]; + extra-trusted-public-keys = [ + "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c=" + ]; }; inputs = { diff --git a/nix/README.md b/nix/README.md index 76cb8bf27..8bb658477 100644 --- a/nix/README.md +++ b/nix/README.md @@ -8,8 +8,8 @@ See [Package variants](#package-variants) for a list of available packages. ## Installing a development release (flake) -We use [garnix](https://garnix.io/) to build and cache our development builds. -If you want to avoid rebuilds you may add the garnix cache to your substitutors, or use `--accept-flake-config` +We use [cachix](https://cachix.org/) to cache our development and release builds. +If you want to avoid rebuilds you may add the Cachix bucket to your substitutors, or use `--accept-flake-config` to temporarily enable it when using `nix` commands. Example (NixOS): @@ -17,12 +17,10 @@ Example (NixOS): ```nix { nix.settings = { - trusted-substituters = [ - "https://cache.garnix.io" - ]; + trusted-substituters = [ "https://prismlauncher.cachix.org" ]; trusted-public-keys = [ - "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c=" ]; }; } @@ -137,20 +135,18 @@ nix profile install github:PrismLauncher/PrismLauncher ## Installing a development release (without flakes) -We use [garnix](https://garnix.io/) to build and cache our development builds. -If you want to avoid rebuilds you may add the garnix cache to your substitutors. +We use [Cachix](https://cachix.org/) to cache our development and release builds. +If you want to avoid rebuilds you may add the Cachix bucket to your substitutors. Example (NixOS): ```nix { nix.settings = { - trusted-substituters = [ - "https://cache.garnix.io" - ]; + trusted-substituters = [ "https://prismlauncher.cachix.org" ]; trusted-public-keys = [ - "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c=" ]; }; } From 988ef320193e5bfb7de600bc38f99f9ba122c379 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Sep 2024 16:30:22 -0400 Subject: [PATCH 22/33] fix(nix): don't write to files in formatting check Signed-off-by: seth --- nix/checks.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/checks.nix b/nix/checks.nix index 40a2e272f..ec219d6f8 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -23,7 +23,7 @@ cd ${self} echo "Running clang-format...." - clang-format -i --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp} + clang-format --dry-run --style='file' --Werror */**.{c,cc,cpp,h,hh,hpp} echo "Running deadnix..." deadnix --fail From 38fa2e0cd494d400110496a35c7f112b2b801d97 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Sep 2024 16:32:35 -0400 Subject: [PATCH 23/33] style: format with clang-format Signed-off-by: seth --- launcher/Application.cpp | 2 +- launcher/ui/MainWindow.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 4a66271a3..b8dcc1099 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1026,7 +1026,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) // notify user if /tmp is mounted with `noexec` (#1693) QString jvmArgs = m_settings->get("JvmArgs").toString(); - if(jvmArgs.indexOf("java.io.tmpdir") == -1) { /* java.io.tmpdir is a valid workaround, so don't annoy */ + if (jvmArgs.indexOf("java.io.tmpdir") == -1) { /* java.io.tmpdir is a valid workaround, so don't annoy */ bool is_tmp_noexec = false; #if defined(Q_OS_LINUX) diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 3f0bb3281..09c47b609 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -235,7 +235,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi } ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED); - } // add the toolbar toggles to the view menu From 79be2fc0622103b2d969044490fa179d31482f50 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 00:32:42 +0000 Subject: [PATCH 24/33] chore(deps): update cachix/install-nix-action action to v29 --- .github/workflows/build.yml | 2 +- .github/workflows/update-flake.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f26884c2c..ad77d282b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -658,7 +658,7 @@ jobs: uses: actions/checkout@v4 - name: Install Nix - uses: cachix/install-nix-action@v27 + uses: cachix/install-nix-action@v29 # For PRs - name: Setup Nix Magic Cache diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml index ecc38ff28..0c8cfde67 100644 --- a/.github/workflows/update-flake.yml +++ b/.github/workflows/update-flake.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 + - uses: cachix/install-nix-action@9f70348d77d0422624097c4b7a75563948901306 # v29 - uses: DeterminateSystems/update-flake-lock@v24 with: From 0eefa52dbcdc595f4b388ae306eae5f556f816e4 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 25 Sep 2024 15:04:31 +0300 Subject: [PATCH 25/33] fix some transtaions warnings Signed-off-by: Trial97 --- launcher/MMCZip.h | 2 ++ launcher/modplatform/flame/FlamePackExportTask.h | 1 + launcher/modplatform/modrinth/ModrinthPackExportTask.h | 1 + launcher/ui/dialogs/InstallLoaderDialog.cpp | 2 ++ launcher/ui/pages/instance/ModFolderPage.h | 2 ++ 5 files changed, 8 insertions(+) diff --git a/launcher/MMCZip.h b/launcher/MMCZip.h index 1635f8b32..d81df9d81 100644 --- a/launcher/MMCZip.h +++ b/launcher/MMCZip.h @@ -153,6 +153,7 @@ bool collectFileListRecursively(const QString& rootDir, const QString& subDir, Q #if defined(LAUNCHER_APPLICATION) class ExportToZipTask : public Task { + Q_OBJECT public: ExportToZipTask(QString outputPath, QDir dir, @@ -207,6 +208,7 @@ class ExportToZipTask : public Task { }; class ExtractZipTask : public Task { + Q_OBJECT public: ExtractZipTask(QString input, QDir outputDir, QString subdirectory = "") : ExtractZipTask(std::make_shared(input), outputDir, subdirectory) diff --git a/launcher/modplatform/flame/FlamePackExportTask.h b/launcher/modplatform/flame/FlamePackExportTask.h index 78b46e91f..b11eb17fa 100644 --- a/launcher/modplatform/flame/FlamePackExportTask.h +++ b/launcher/modplatform/flame/FlamePackExportTask.h @@ -26,6 +26,7 @@ #include "tasks/Task.h" class FlamePackExportTask : public Task { + Q_OBJECT public: FlamePackExportTask(const QString& name, const QString& version, diff --git a/launcher/modplatform/modrinth/ModrinthPackExportTask.h b/launcher/modplatform/modrinth/ModrinthPackExportTask.h index 81c2f25bf..ee740a456 100644 --- a/launcher/modplatform/modrinth/ModrinthPackExportTask.h +++ b/launcher/modplatform/modrinth/ModrinthPackExportTask.h @@ -27,6 +27,7 @@ #include "tasks/Task.h" class ModrinthPackExportTask : public Task { + Q_OBJECT public: ModrinthPackExportTask(const QString& name, const QString& version, diff --git a/launcher/ui/dialogs/InstallLoaderDialog.cpp b/launcher/ui/dialogs/InstallLoaderDialog.cpp index 541119d10..8e5463b31 100644 --- a/launcher/ui/dialogs/InstallLoaderDialog.cpp +++ b/launcher/ui/dialogs/InstallLoaderDialog.cpp @@ -31,6 +31,7 @@ #include "ui/widgets/VersionSelectWidget.h" class InstallLoaderPage : public VersionSelectWidget, public BasePage { + Q_OBJECT public: InstallLoaderPage(const QString& id, const QString& iconName, @@ -164,3 +165,4 @@ void InstallLoaderDialog::done(int result) QDialog::done(result); } +#include "InstallLoaderDialog.moc" \ No newline at end of file diff --git a/launcher/ui/pages/instance/ModFolderPage.h b/launcher/ui/pages/instance/ModFolderPage.h index 2ec2b402d..41b605991 100644 --- a/launcher/ui/pages/instance/ModFolderPage.h +++ b/launcher/ui/pages/instance/ModFolderPage.h @@ -74,6 +74,7 @@ class ModFolderPage : public ExternalResourcesPage { }; class CoreModFolderPage : public ModFolderPage { + Q_OBJECT public: explicit CoreModFolderPage(BaseInstance* inst, std::shared_ptr mods, QWidget* parent = 0); virtual ~CoreModFolderPage() = default; @@ -87,6 +88,7 @@ class CoreModFolderPage : public ModFolderPage { }; class NilModFolderPage : public ModFolderPage { + Q_OBJECT public: explicit NilModFolderPage(BaseInstance* inst, std::shared_ptr mods, QWidget* parent = 0); virtual ~NilModFolderPage() = default; From 5ea2dece54f27c812af3eb5ba697ec7aab07e04b Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 26 Sep 2024 22:59:00 +0300 Subject: [PATCH 26/33] fix search term not remaining the same between providers on resource download Signed-off-by: Trial97 --- launcher/ui/dialogs/ResourceDownloadDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp index 90d3b79a9..02a8454b4 100644 --- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp +++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp @@ -258,7 +258,9 @@ void ResourceDownloadDialog::selectedPageChanged(BasePage* previous, BasePage* s } // Same effect as having a global search bar - selectedPage()->setSearchTerm(prev_page->getSearchTerm()); + ResourcePage* result = dynamic_cast(selected); + Q_ASSERT(result != nullptr); + result->setSearchTerm(prev_page->getSearchTerm()); } ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptr& mods, BaseInstance* instance) From 946e791d39a19f50d7604b1f57714f8f3a7f63cb Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 30 Sep 2024 21:50:07 +0300 Subject: [PATCH 27/33] sync modpack search field Signed-off-by: Trial97 --- launcher/CMakeLists.txt | 3 ++ launcher/ui/dialogs/NewInstanceDialog.cpp | 16 ++++++++++ launcher/ui/dialogs/NewInstanceDialog.h | 3 ++ .../modplatform/ModpackProviderBasePage.h | 29 +++++++++++++++++++ .../pages/modplatform/atlauncher/AtlPage.cpp | 10 +++++++ .../ui/pages/modplatform/atlauncher/AtlPage.h | 10 +++++-- .../ui/pages/modplatform/flame/FlamePage.cpp | 9 ++++++ .../ui/pages/modplatform/flame/FlamePage.h | 9 ++++-- .../modplatform/import_ftb/ImportFTBPage.cpp | 9 ++++++ .../modplatform/import_ftb/ImportFTBPage.h | 9 ++++-- .../ui/pages/modplatform/legacy_ftb/Page.cpp | 9 ++++++ .../ui/pages/modplatform/legacy_ftb/Page.h | 9 ++++-- .../modplatform/modrinth/ModrinthPage.cpp | 10 +++++++ .../pages/modplatform/modrinth/ModrinthPage.h | 9 ++++-- .../pages/modplatform/technic/TechnicPage.cpp | 10 +++++++ .../pages/modplatform/technic/TechnicPage.h | 9 ++++-- 16 files changed, 150 insertions(+), 13 deletions(-) create mode 100644 launcher/ui/pages/modplatform/ModpackProviderBasePage.h diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index bd6dfc5b6..dcbfe8fde 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -965,6 +965,9 @@ SET(LAUNCHER_SOURCES ui/pages/modplatform/ShaderPackPage.cpp ui/pages/modplatform/ShaderPackModel.cpp + + ui/pages/modplatform/ModpackProviderBasePage.h + ui/pages/modplatform/atlauncher/AtlFilterModel.cpp ui/pages/modplatform/atlauncher/AtlFilterModel.h ui/pages/modplatform/atlauncher/AtlListModel.cpp diff --git a/launcher/ui/dialogs/NewInstanceDialog.cpp b/launcher/ui/dialogs/NewInstanceDialog.cpp index 2e799d2a8..f16c50860 100644 --- a/launcher/ui/dialogs/NewInstanceDialog.cpp +++ b/launcher/ui/dialogs/NewInstanceDialog.cpp @@ -36,6 +36,7 @@ #include "NewInstanceDialog.h" #include "Application.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" #include "ui/pages/modplatform/import_ftb/ImportFTBPage.h" #include "ui_NewInstanceDialog.h" @@ -140,6 +141,8 @@ NewInstanceDialog::NewInstanceDialog(const QString& initialGroup, auto geometry = screen->availableSize(); resize(width(), qMin(geometry.height() - 50, 710)); } + + connect(m_container, &PageContainer::selectedPageChanged, this, &NewInstanceDialog::selectedPageChanged); } void NewInstanceDialog::reject() @@ -316,3 +319,16 @@ void NewInstanceDialog::importIconNow() } APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64()); } + +void NewInstanceDialog::selectedPageChanged(BasePage* previous, BasePage* selected) +{ + auto prevPage = dynamic_cast(previous); + if (prevPage) { + m_searchTerm = prevPage->getSerachTerm(); + } + + auto nextPage = dynamic_cast(selected); + if (nextPage) { + nextPage->setSearchTerm(m_searchTerm); + } +} diff --git a/launcher/ui/dialogs/NewInstanceDialog.h b/launcher/ui/dialogs/NewInstanceDialog.h index 923579567..e97c9f543 100644 --- a/launcher/ui/dialogs/NewInstanceDialog.h +++ b/launcher/ui/dialogs/NewInstanceDialog.h @@ -82,6 +82,7 @@ class NewInstanceDialog : public QDialog, public BasePageProvider { private slots: void on_iconButton_clicked(); void on_instNameTextBox_textChanged(const QString& arg1); + void selectedPageChanged(BasePage* previous, BasePage* selected); private: Ui::NewInstanceDialog* ui = nullptr; @@ -98,5 +99,7 @@ class NewInstanceDialog : public QDialog, public BasePageProvider { QString importVersion; + QString m_searchTerm; + void importIconNow(); }; diff --git a/launcher/ui/pages/modplatform/ModpackProviderBasePage.h b/launcher/ui/pages/modplatform/ModpackProviderBasePage.h new file mode 100644 index 000000000..a3daa9a81 --- /dev/null +++ b/launcher/ui/pages/modplatform/ModpackProviderBasePage.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-3.0-only +/* + * Prism Launcher - Minecraft Launcher + * Copyright (c) 2023 Trial97 + * + * 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 "ui/pages/BasePage.h" + +class ModpackProviderBasePage : public BasePage { + public: + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) = 0; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const = 0; +}; \ No newline at end of file diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp b/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp index d79b7621a..7c69b315e 100644 --- a/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp +++ b/launcher/ui/pages/modplatform/atlauncher/AtlPage.cpp @@ -164,3 +164,13 @@ void AtlPage::onVersionSelectionChanged(QString version) selectedVersion = version; suggestCurrent(); } + +void AtlPage::setSearchTerm(QString term) +{ + ui->searchEdit->setText(term); +} + +QString AtlPage::getSerachTerm() const +{ + return ui->searchEdit->text(); +} diff --git a/launcher/ui/pages/modplatform/atlauncher/AtlPage.h b/launcher/ui/pages/modplatform/atlauncher/AtlPage.h index 6bc449649..73460232b 100644 --- a/launcher/ui/pages/modplatform/atlauncher/AtlPage.h +++ b/launcher/ui/pages/modplatform/atlauncher/AtlPage.h @@ -42,8 +42,7 @@ #include #include "Application.h" -#include "tasks/Task.h" -#include "ui/pages/BasePage.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" namespace Ui { class AtlPage; @@ -51,7 +50,7 @@ class AtlPage; class NewInstanceDialog; -class AtlPage : public QWidget, public BasePage { +class AtlPage : public QWidget, public ModpackProviderBasePage { Q_OBJECT public: @@ -66,6 +65,11 @@ class AtlPage : public QWidget, public BasePage { void openedImpl() override; + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) override; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const override; + private: void suggestCurrent(); diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.cpp b/launcher/ui/pages/modplatform/flame/FlamePage.cpp index decb5de3b..4195683e7 100644 --- a/launcher/ui/pages/modplatform/flame/FlamePage.cpp +++ b/launcher/ui/pages/modplatform/flame/FlamePage.cpp @@ -299,3 +299,12 @@ void FlamePage::updateUi() ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description)); ui->packDescription->flush(); } +QString FlamePage::getSerachTerm() const +{ + return ui->searchEdit->text(); +} + +void FlamePage::setSearchTerm(QString term) +{ + ui->searchEdit->setText(term); +} diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.h b/launcher/ui/pages/modplatform/flame/FlamePage.h index 7590e1a95..45a3c6b22 100644 --- a/launcher/ui/pages/modplatform/flame/FlamePage.h +++ b/launcher/ui/pages/modplatform/flame/FlamePage.h @@ -40,7 +40,7 @@ #include #include #include -#include "ui/pages/BasePage.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" #include "ui/widgets/ProgressWidget.h" namespace Ui { @@ -53,7 +53,7 @@ namespace Flame { class ListModel; } -class FlamePage : public QWidget, public BasePage { +class FlamePage : public QWidget, public ModpackProviderBasePage { Q_OBJECT public: @@ -72,6 +72,11 @@ class FlamePage : public QWidget, public BasePage { bool eventFilter(QObject* watched, QEvent* event) override; + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) override; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const override; + private: void suggestCurrent(); diff --git a/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.cpp b/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.cpp index db59fe10a..15303bb22 100644 --- a/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.cpp +++ b/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.cpp @@ -135,4 +135,13 @@ void ImportFTBPage::triggerSearch() currentModel->setSearchTerm(ui->searchEdit->text()); } +void ImportFTBPage::setSearchTerm(QString term) +{ + ui->searchEdit->setText(term); +} + +QString ImportFTBPage::getSerachTerm() const +{ + return ui->searchEdit->text(); +} } // namespace FTBImportAPP diff --git a/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.h b/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.h index 00f013f6f..7afff5a9d 100644 --- a/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.h +++ b/launcher/ui/pages/modplatform/import_ftb/ImportFTBPage.h @@ -25,7 +25,7 @@ #include #include "modplatform/import_ftb/PackHelpers.h" -#include "ui/pages/BasePage.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" #include "ui/pages/modplatform/import_ftb/ListModel.h" class NewInstanceDialog; @@ -35,7 +35,7 @@ namespace Ui { class ImportFTBPage; } -class ImportFTBPage : public QWidget, public BasePage { +class ImportFTBPage : public QWidget, public ModpackProviderBasePage { Q_OBJECT public: @@ -49,6 +49,11 @@ class ImportFTBPage : public QWidget, public BasePage { void openedImpl() override; void retranslate() override; + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) override; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const override; + private: void suggestCurrent(); void onPackSelectionChanged(Modpack* pack = nullptr); diff --git a/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp b/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp index a587b5baf..226a30ee3 100644 --- a/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp +++ b/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp @@ -369,4 +369,13 @@ void Page::triggerSearch() currentModel->setSearchTerm(ui->searchEdit->text()); } +void Page::setSearchTerm(QString term) +{ + ui->searchEdit->setText(term); +} + +QString Page::getSerachTerm() const +{ + return ui->searchEdit->text(); +} } // namespace LegacyFTB diff --git a/launcher/ui/pages/modplatform/legacy_ftb/Page.h b/launcher/ui/pages/modplatform/legacy_ftb/Page.h index daef23342..a2dee24e9 100644 --- a/launcher/ui/pages/modplatform/legacy_ftb/Page.h +++ b/launcher/ui/pages/modplatform/legacy_ftb/Page.h @@ -43,7 +43,7 @@ #include "QObjectPtr.h" #include "modplatform/legacy_ftb/PackFetchTask.h" #include "modplatform/legacy_ftb/PackHelpers.h" -#include "ui/pages/BasePage.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" class NewInstanceDialog; @@ -57,7 +57,7 @@ class ListModel; class FilterModel; class PrivatePackManager; -class Page : public QWidget, public BasePage { +class Page : public QWidget, public ModpackProviderBasePage { Q_OBJECT public: @@ -71,6 +71,11 @@ class Page : public QWidget, public BasePage { void openedImpl() override; void retranslate() override; + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) override; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const override; + private: void suggestCurrent(); void onPackSelectionChanged(Modpack* pack = nullptr); diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp index 03461d85a..a000044fa 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.cpp @@ -351,3 +351,13 @@ void ModrinthPage::onVersionSelectionChanged(int index) selectedVersion = ui->versionSelectionBox->currentData().toString(); suggestCurrent(); } + +void ModrinthPage::setSearchTerm(QString term) +{ + ui->searchEdit->setText(term); +} + +QString ModrinthPage::getSerachTerm() const +{ + return ui->searchEdit->text(); +} diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.h b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.h index dadaeb0a0..dd99e0d29 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthPage.h +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthPage.h @@ -38,9 +38,9 @@ #include "Application.h" #include "ui/dialogs/NewInstanceDialog.h" -#include "ui/pages/BasePage.h" #include "modplatform/modrinth/ModrinthPackManifest.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" #include "ui/widgets/ProgressWidget.h" #include @@ -54,7 +54,7 @@ namespace Modrinth { class ModpackListModel; } -class ModrinthPage : public QWidget, public BasePage { +class ModrinthPage : public QWidget, public ModpackProviderBasePage { Q_OBJECT public: @@ -78,6 +78,11 @@ class ModrinthPage : public QWidget, public BasePage { void openedImpl() override; bool eventFilter(QObject* watched, QEvent* event) override; + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) override; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const override; + private slots: void onSelectionChanged(QModelIndex first, QModelIndex second); void onVersionSelectionChanged(int index); diff --git a/launcher/ui/pages/modplatform/technic/TechnicPage.cpp b/launcher/ui/pages/modplatform/technic/TechnicPage.cpp index a8f06619f..50d267b1f 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicPage.cpp +++ b/launcher/ui/pages/modplatform/technic/TechnicPage.cpp @@ -342,3 +342,13 @@ void TechnicPage::onVersionSelectionChanged(QString version) selectedVersion = version; selectVersion(); } + +void TechnicPage::setSearchTerm(QString term) +{ + ui->searchEdit->setText(term); +} + +QString TechnicPage::getSerachTerm() const +{ + return ui->searchEdit->text(); +} diff --git a/launcher/ui/pages/modplatform/technic/TechnicPage.h b/launcher/ui/pages/modplatform/technic/TechnicPage.h index 01439337d..d1f691b22 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicPage.h +++ b/launcher/ui/pages/modplatform/technic/TechnicPage.h @@ -41,7 +41,7 @@ #include #include "TechnicData.h" #include "net/NetJob.h" -#include "ui/pages/BasePage.h" +#include "ui/pages/modplatform/ModpackProviderBasePage.h" #include "ui/widgets/ProgressWidget.h" namespace Ui { @@ -54,7 +54,7 @@ namespace Technic { class ListModel; } -class TechnicPage : public QWidget, public BasePage { +class TechnicPage : public QWidget, public ModpackProviderBasePage { Q_OBJECT public: @@ -71,6 +71,11 @@ class TechnicPage : public QWidget, public BasePage { bool eventFilter(QObject* watched, QEvent* event) override; + /** Programatically set the term in the search bar. */ + virtual void setSearchTerm(QString) override; + /** Get the current term in the search bar. */ + [[nodiscard]] virtual QString getSerachTerm() const override; + private: void suggestCurrent(); void metadataLoaded(); From bcb1d456d4773f985d3b18d42382400a2c8148e7 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:56:19 -0700 Subject: [PATCH 28/33] fix: version NSCurl plugin in workflow, detect and use arm64 vc_redist for arm64 Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .github/workflows/build.yml | 13 +++++++++++-- program_info/CMakeLists.txt | 12 +++++++++--- program_info/win_install.nsi.in | 14 +++++++------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7345ffe90..16c9290f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,6 +81,8 @@ jobs: qt_arch: "" qt_version: "6.7.2" qt_modules: "qt5compat qtimageformats qtnetworkauth" + nscurl_tag: "v24.9.26.122" + nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" - os: windows-2022 name: "Windows-MSVC-arm64" @@ -92,6 +94,8 @@ jobs: qt_arch: "win64_msvc2019_arm64" qt_version: "6.7.2" qt_modules: "qt5compat qtimageformats qtnetworkauth" + nscurl_tag: "v24.9.26.122" + nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0" - os: macos-14 name: macOS @@ -472,8 +476,13 @@ jobs: if: runner.os == 'Windows' run: | New-Item -Name NSISPlugins -ItemType Directory - Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip -OutFile NSISPlugins\NScurl.zip - Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NSIScurl + Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/download/${{ matrix.nscurl_tag }}/NScurl.zip -OutFile NSISPlugins\NScurl.zip + $nscurl_hash = Get-FileHash NSISPlugins\NScurl.zip -Algorithm Sha256 | Select-Object -ExpandProperty Hash + if ( $nscurl_hash -ne "${{ matrix.nscurl_sha256 }}") { + echo "::error:: NSCurl.zib sha256 mismatch" + exit 1 + } + Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NScurl cd ${{ env.INSTALL_DIR }} makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi" diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 30a435866..8fb6f68aa 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -44,14 +44,20 @@ configure_file(prismlauncher.ico prismlauncher.ico COPYONLY) if(MSVC) set(Launcher_MSVC_Redist_NSIS_Section [=[ -!ifdef haveNSIScurl +!ifdef haveNScurl Section "Visual Studio Runtime" + Var /GLOBAL vc_redist_exe + ${If} ${IsNativeARM64} + StrCpy $vc_redist_exe "vc_redist.arm64.exe" + ${Else} + StrCpy $vc_redist_exe "vc_redist.x64.exe" + ${EndIf} DetailPrint 'Downloading Microsoft Visual C++ Redistributable...' - NScurl::http GET "https://aka.ms/vs/17/release/vc_redist.x64.exe" "$INSTDIR\vc_redist\vc_redist.x64.exe" /INSIST /CANCEL /Zone.Identifier /END + NScurl::http GET "https://aka.ms/vs/17/release/${vc_redist_exe}" "$INSTDIR\vc_redist\${vc_redist_exe}" /INSIST /CANCEL /Zone.Identifier /END Pop $0 ${If} $0 == "OK" DetailPrint "Download successful" - ExecWait "$INSTDIR\vc_redist\vc_redist.x64.exe /install /passive /norestart\" + ExecWait "$INSTDIR\vc_redist\${vc_redist_exe} /install /passive /norestart\" ${Else} DetailPrint "Download failed with error $0" ${EndIf} diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in index a5c38599d..c0e2b892f 100644 --- a/program_info/win_install.nsi.in +++ b/program_info/win_install.nsi.in @@ -349,15 +349,15 @@ SectionEnd ;------------------------------------ ; include nice plugins -; NSIScurl - curl in NSIS +; NScurl - curl in NSIS ; used for MSVS redist download -; extract to ../NSISPlugins/NSIScurl +; extract to ../NSISPlugins/NScurl ; https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip -!insertmacro CompileTimeIfFileExist "../NSISPlugins/NSIScurl/Plugins/" haveNSIScurl -!ifdef haveNSIScurl -!AddPluginDir /x86-unicode "../NSISPlugins/NSIScurl/Plugins/x86-unicode" -!AddPluginDir /x86-ansi "../NSISPlugins/NSIScurl/Plugins/x86-ansi" -!AddPluginDir /amd64-unicode "../NSISPlugins/NSIScurl/Plugins/amd64-unicode" +!insertmacro CompileTimeIfFileExist "../NSISPlugins/NScurl/Plugins/" haveNScurl +!ifdef haveNScurl +!AddPluginDir /x86-unicode "../NSISPlugins/NScurl/Plugins/x86-unicode" +!AddPluginDir /x86-ansi "../NSISPlugins/NScurl/Plugins/x86-ansi" +!AddPluginDir /amd64-unicode "../NSISPlugins/NScurl/Plugins/amd64-unicode" !endif ;------------------------------------ From 63172540fb467386864ae22356999451dd2ebe08 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:38:30 -0700 Subject: [PATCH 29/33] fix: nisi needs `!include` "x64.nsh" now. also, there were some broken varible Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- program_info/CMakeLists.txt | 4 ++-- program_info/win_install.nsi.in | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/program_info/CMakeLists.txt b/program_info/CMakeLists.txt index 8fb6f68aa..ee2e336b1 100644 --- a/program_info/CMakeLists.txt +++ b/program_info/CMakeLists.txt @@ -53,11 +53,11 @@ Section "Visual Studio Runtime" StrCpy $vc_redist_exe "vc_redist.x64.exe" ${EndIf} DetailPrint 'Downloading Microsoft Visual C++ Redistributable...' - NScurl::http GET "https://aka.ms/vs/17/release/${vc_redist_exe}" "$INSTDIR\vc_redist\${vc_redist_exe}" /INSIST /CANCEL /Zone.Identifier /END + NScurl::http GET "https://aka.ms/vs/17/release/$vc_redist_exe" "$INSTDIR\vc_redist\$vc_redist_exe" /INSIST /CANCEL /Zone.Identifier /END Pop $0 ${If} $0 == "OK" DetailPrint "Download successful" - ExecWait "$INSTDIR\vc_redist\${vc_redist_exe} /install /passive /norestart\" + ExecWait "$INSTDIR\vc_redist\$vc_redist_exe /install /passive /norestart\" ${Else} DetailPrint "Download failed with error $0" ${EndIf} diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in index c0e2b892f..24f6ee4e8 100644 --- a/program_info/win_install.nsi.in +++ b/program_info/win_install.nsi.in @@ -2,6 +2,8 @@ !include "LogicLib.nsh" !include "MUI2.nsh" +!include "x64.nsh" + Unicode true Name "@Launcher_DisplayName@" @@ -185,7 +187,7 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@ !macroend -!macro APP_UNASSOCIATE EXT APP_ID +!macro APP_UNASSOCIATE EXT APP_ID APP_EXE # Unregister file type ClearErrors @@ -489,8 +491,8 @@ Section -un.ShellAssoc !insertmacro APP_TEARDOWN_DEFAULT `${APPID}` `${APPNAME}` `${APPEXE}` - !insertmacro APP_UNASSOCIATE ".zip" `${APPID}` - !insertmacro APP_UNASSOCIATE ".mrpack" `${APPID}` + !insertmacro APP_UNASSOCIATE ".zip" `${APPID}` `${APPEXE}` + !insertmacro APP_UNASSOCIATE ".mrpack" `${APPID}` `${APPEXE}` !insertmacro NotifyShell_AssocChanged SectionEnd From 023aa18e852ab1b570b378609edee1e7bbcd1588 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Thu, 3 Oct 2024 23:14:29 -0700 Subject: [PATCH 30/33] ci: NSCurl only needed on MSVC Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .github/workflows/build.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16c9290f2..4063df355 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -475,14 +475,16 @@ jobs: - name: Package (Windows, installer) if: runner.os == 'Windows' run: | - New-Item -Name NSISPlugins -ItemType Directory - Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/download/${{ matrix.nscurl_tag }}/NScurl.zip -OutFile NSISPlugins\NScurl.zip - $nscurl_hash = Get-FileHash NSISPlugins\NScurl.zip -Algorithm Sha256 | Select-Object -ExpandProperty Hash - if ( $nscurl_hash -ne "${{ matrix.nscurl_sha256 }}") { - echo "::error:: NSCurl.zib sha256 mismatch" - exit 1 + if ('${{ matrix.nscurl_tag }}') { + New-Item -Name NSISPlugins -ItemType Directory + Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/download/${{ matrix.nscurl_tag }}/NScurl.zip -OutFile NSISPlugins\NScurl.zip + $nscurl_hash = Get-FileHash NSISPlugins\NScurl.zip -Algorithm Sha256 | Select-Object -ExpandProperty Hash + if ( $nscurl_hash -ne "${{ matrix.nscurl_sha256 }}") { + echo "::error:: NSCurl.zib sha256 mismatch" + exit 1 + } + Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NScurl } - Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NScurl cd ${{ env.INSTALL_DIR }} makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi" From a61c93bedefced10b59c310daa567e31cb30f967 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Fri, 4 Oct 2024 07:06:19 -0700 Subject: [PATCH 31/33] Update .github/workflows/build.yml Co-authored-by: Sefa Eyeoglu Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> --- .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 4063df355..98caa901d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -480,7 +480,7 @@ jobs: Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/download/${{ matrix.nscurl_tag }}/NScurl.zip -OutFile NSISPlugins\NScurl.zip $nscurl_hash = Get-FileHash NSISPlugins\NScurl.zip -Algorithm Sha256 | Select-Object -ExpandProperty Hash if ( $nscurl_hash -ne "${{ matrix.nscurl_sha256 }}") { - echo "::error:: NSCurl.zib sha256 mismatch" + echo "::error:: NSCurl.zip sha256 mismatch" exit 1 } Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NScurl From 03294f0000eba56edc39cbd80cc53418a2429528 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 6 Oct 2024 00:24:57 +0000 Subject: [PATCH 32/33] 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/1925c603f17fc89f4c8f6bf6f631a802ad85d784?narHash=sha256-J%2BPeFKSDV%2BpHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI%3D' (2024-09-26) → 'github:NixOS/nixpkgs/bc947f541ae55e999ffdb4013441347d83b00feb?narHash=sha256-NOiTvBbRLIOe5F6RbHaAh6%2B%2BBNjsb149fGZd1T4%2BKBg%3D' (2024-10-04) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 7667a8688..6897c162d 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727348695, - "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "lastModified": 1728018373, + "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", "type": "github" }, "original": { From d5990cca4318121dea8d6b669abdada64944c88b Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 6 Oct 2024 13:51:36 +0100 Subject: [PATCH 33/33] Disable retry for private pack fetch This is already handled with a dialog asking whether you want it to be removed. Signed-off-by: TheKodeToad --- launcher/modplatform/legacy_ftb/PackFetchTask.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/launcher/modplatform/legacy_ftb/PackFetchTask.cpp b/launcher/modplatform/legacy_ftb/PackFetchTask.cpp index 8f1a6e2ff..a0beeddcc 100644 --- a/launcher/modplatform/legacy_ftb/PackFetchTask.cpp +++ b/launcher/modplatform/legacy_ftb/PackFetchTask.cpp @@ -74,6 +74,7 @@ void PackFetchTask::fetchPrivate(const QStringList& toFetch) auto data = std::make_shared(); NetJob* job = new NetJob("Fetching private pack", m_network); job->addNetAction(Net::ApiDownload::makeByteArray(privatePackBaseUrl.arg(packCode), data)); + job->setAskRetry(false); QObject::connect(job, &NetJob::succeeded, this, [this, job, data, packCode] { ModpackList packs;