Merge remote-tracking branch 'upstream/develop' into resource-meta

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2024-10-08 17:16:10 +01:00
commit 538815e033
No known key found for this signature in database
GPG Key ID: 5E39D70B4C93C38E
49 changed files with 395 additions and 73 deletions

View File

@ -2,3 +2,6 @@
# tabs -> spaces # tabs -> spaces
bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9
# (nix) alejandra -> nixfmt
4c81d8c53d09196426568c4a31a4e752ed05397a

View File

@ -39,6 +39,9 @@ on:
APPLE_NOTARIZE_PASSWORD: APPLE_NOTARIZE_PASSWORD:
description: Password used for notarizing macOS builds description: Password used for notarizing macOS builds
required: false required: false
CACHIX_AUTH_TOKEN:
description: Private token for authenticating against Cachix cache
required: false
GPG_PRIVATE_KEY: GPG_PRIVATE_KEY:
description: Private key for AppImage signing description: Private key for AppImage signing
required: false required: false
@ -79,8 +82,10 @@ jobs:
qt_ver: 6 qt_ver: 6
qt_host: windows qt_host: windows
qt_arch: "" qt_arch: ""
qt_version: "6.7.2" qt_version: "6.7.3"
qt_modules: "qt5compat qtimageformats qtnetworkauth" qt_modules: "qt5compat qtimageformats qtnetworkauth"
nscurl_tag: "v24.9.26.122"
nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0"
- os: windows-2022 - os: windows-2022
name: "Windows-MSVC-arm64" name: "Windows-MSVC-arm64"
@ -90,8 +95,10 @@ jobs:
qt_ver: 6 qt_ver: 6
qt_host: windows qt_host: windows
qt_arch: "win64_msvc2019_arm64" qt_arch: "win64_msvc2019_arm64"
qt_version: "6.7.2" qt_version: "6.7.3"
qt_modules: "qt5compat qtimageformats qtnetworkauth" qt_modules: "qt5compat qtimageformats qtnetworkauth"
nscurl_tag: "v24.9.26.122"
nscurl_sha256: "AEE6C4BE3CB6455858E9C1EE4B3AFE0DB9960FA03FE99CCDEDC28390D57CCBB0"
- os: macos-14 - os: macos-14
name: macOS name: macOS
@ -99,7 +106,7 @@ jobs:
qt_ver: 6 qt_ver: 6
qt_host: mac qt_host: mac
qt_arch: "" qt_arch: ""
qt_version: "6.7.2" qt_version: "6.7.3"
qt_modules: "qt5compat qtimageformats qtnetworkauth" qt_modules: "qt5compat qtimageformats qtnetworkauth"
- os: macos-14 - os: macos-14
@ -471,6 +478,16 @@ jobs:
- name: Package (Windows, installer) - name: Package (Windows, installer)
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: | run: |
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.zip sha256 mismatch"
exit 1
}
Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NScurl
}
cd ${{ env.INSTALL_DIR }} cd ${{ env.INSTALL_DIR }}
makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi" makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi"
@ -631,3 +648,53 @@ jobs:
with: with:
bundle: "Prism Launcher.flatpak" bundle: "Prism Launcher.flatpak"
manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml 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@v29
# 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

View File

@ -38,5 +38,6 @@ jobs:
APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }}
APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }}
APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }}

View File

@ -22,6 +22,7 @@ jobs:
APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }} APPLE_NOTARIZE_APPLE_ID: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }}
APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }} APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }}
APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }} APPLE_NOTARIZE_PASSWORD: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }} GPG_PRIVATE_KEY_ID: ${{ secrets.GPG_PRIVATE_KEY_ID }}

View File

@ -17,7 +17,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 - uses: cachix/install-nix-action@9f70348d77d0422624097c4b7a75563948901306 # v29
- uses: DeterminateSystems/update-flake-lock@v24 - uses: DeterminateSystems/update-flake-lock@v24
with: with:

6
flake.lock generated
View File

@ -49,11 +49,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1726062873, "lastModified": 1728018373,
"narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=", "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f", "rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -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)"; description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)";
nixConfig = { nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ]; extra-substituters = [ "https://prismlauncher.cachix.org" ];
extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; extra-trusted-public-keys = [
"prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c="
];
}; };
inputs = { inputs = {
@ -118,5 +120,24 @@
# Only output them if they're available on the current system # Only output them if they're available on the current system
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages 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;
};
}
);
}; };
} }

View File

@ -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.*"

View File

@ -780,6 +780,9 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
// FTBApp instances // FTBApp instances
m_settings->registerSetting("FTBAppInstancesPath", ""); m_settings->registerSetting("FTBAppInstancesPath", "");
// Custom Technic Client ID
m_settings->registerSetting("TechnicClientID", "");
// Init page provider // Init page provider
{ {
m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings"));
@ -1022,7 +1025,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
} }
// notify user if /tmp is mounted with `noexec` (#1693) // 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; bool is_tmp_noexec = false;
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
@ -1042,7 +1046,11 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
if (is_tmp_noexec) { if (is_tmp_noexec) {
auto infoMsg = auto infoMsg =
tr("Your /tmp directory is currently mounted with the 'noexec' flag enabled.\n" 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); auto msgBox = new QMessageBox(QMessageBox::Information, tr("Incompatible system configuration"), infoMsg, QMessageBox::Ok);
msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok);
msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setAttribute(Qt::WA_DeleteOnClose);

View File

@ -964,6 +964,9 @@ SET(LAUNCHER_SOURCES
ui/pages/modplatform/ShaderPackPage.cpp ui/pages/modplatform/ShaderPackPage.cpp
ui/pages/modplatform/ShaderPackModel.cpp ui/pages/modplatform/ShaderPackModel.cpp
ui/pages/modplatform/ModpackProviderBasePage.h
ui/pages/modplatform/atlauncher/AtlFilterModel.cpp ui/pages/modplatform/atlauncher/AtlFilterModel.cpp
ui/pages/modplatform/atlauncher/AtlFilterModel.h ui/pages/modplatform/atlauncher/AtlFilterModel.h
ui/pages/modplatform/atlauncher/AtlListModel.cpp ui/pages/modplatform/atlauncher/AtlListModel.cpp

View File

@ -153,6 +153,7 @@ bool collectFileListRecursively(const QString& rootDir, const QString& subDir, Q
#if defined(LAUNCHER_APPLICATION) #if defined(LAUNCHER_APPLICATION)
class ExportToZipTask : public Task { class ExportToZipTask : public Task {
Q_OBJECT
public: public:
ExportToZipTask(QString outputPath, ExportToZipTask(QString outputPath,
QDir dir, QDir dir,
@ -207,6 +208,7 @@ class ExportToZipTask : public Task {
}; };
class ExtractZipTask : public Task { class ExtractZipTask : public Task {
Q_OBJECT
public: public:
ExtractZipTask(QString input, QDir outputDir, QString subdirectory = "") ExtractZipTask(QString input, QDir outputDir, QString subdirectory = "")
: ExtractZipTask(std::make_shared<QuaZip>(input), outputDir, subdirectory) : ExtractZipTask(std::make_shared<QuaZip>(input), outputDir, subdirectory)

View File

@ -140,9 +140,9 @@ QVariant VersionProxyModel::headerData(int section, Qt::Orientation orientation,
case Path: case Path:
return tr("Filesystem path to this version"); return tr("Filesystem path to this version");
case JavaName: case JavaName:
return tr("The alternative name of the java version"); return tr("The alternative name of the Java version");
case JavaMajor: case JavaMajor:
return tr("The java major version"); return tr("The Java major version");
case Time: case Time:
return tr("Release date of this version"); return tr("Release date of this version");
} }

View File

@ -65,7 +65,7 @@ void ArchiveDownloadTask::executeTask()
void ArchiveDownloadTask::extractJava(QString input) void ArchiveDownloadTask::extractJava(QString input)
{ {
setStatus(tr("Extracting java")); setStatus(tr("Extracting Java"));
if (input.endsWith("tar")) { if (input.endsWith("tar")) {
setStatus(tr("Extracting Java (Progress is not reported for tar archives)")); setStatus(tr("Extracting Java (Progress is not reported for tar archives)"));
QFile in(input); QFile in(input);

View File

@ -26,6 +26,7 @@
#include "tasks/Task.h" #include "tasks/Task.h"
class FlamePackExportTask : public Task { class FlamePackExportTask : public Task {
Q_OBJECT
public: public:
FlamePackExportTask(const QString& name, FlamePackExportTask(const QString& name,
const QString& version, const QString& version,

View File

@ -74,6 +74,7 @@ void PackFetchTask::fetchPrivate(const QStringList& toFetch)
auto data = std::make_shared<QByteArray>(); auto data = std::make_shared<QByteArray>();
NetJob* job = new NetJob("Fetching private pack", m_network); NetJob* job = new NetJob("Fetching private pack", m_network);
job->addNetAction(Net::ApiDownload::makeByteArray(privatePackBaseUrl.arg(packCode), data)); job->addNetAction(Net::ApiDownload::makeByteArray(privatePackBaseUrl.arg(packCode), data));
job->setAskRetry(false);
QObject::connect(job, &NetJob::succeeded, this, [this, job, data, packCode] { QObject::connect(job, &NetJob::succeeded, this, [this, job, data, packCode] {
ModpackList packs; ModpackList packs;

View File

@ -27,6 +27,7 @@
#include "tasks/Task.h" #include "tasks/Task.h"
class ModrinthPackExportTask : public Task { class ModrinthPackExportTask : public Task {
Q_OBJECT
public: public:
ModrinthPackExportTask(const QString& name, ModrinthPackExportTask(const QString& name,
const QString& version, const QString& version,

View File

@ -212,9 +212,9 @@ void V1::updateModIndex(const QDir& index_dir, Mod& mod)
auto tbl = toml::table{ { "name", mod.name.toStdString() }, auto tbl = toml::table{ { "name", mod.name.toStdString() },
{ "filename", mod.filename.toStdString() }, { "filename", mod.filename.toStdString() },
{ "side", sideToString(mod.side).toStdString() }, { "side", sideToString(mod.side).toStdString() },
{ "loaders", loaders }, { "x-prismlauncher-loaders", loaders },
{ "mcVersions", mcVersions }, { "x-prismlauncher-mc-versions", mcVersions },
{ "releaseType", mod.releaseType.toString().toStdString() }, { "x-prismlauncher-release-type", mod.releaseType.toString().toStdString() },
{ "download", { "download",
toml::table{ toml::table{
{ "mode", mod.mode.toStdString() }, { "mode", mod.mode.toStdString() },
@ -299,15 +299,15 @@ auto V1::getIndexForMod(const QDir& index_dir, QString slug) -> Mod
mod.name = stringEntry(table, "name"); mod.name = stringEntry(table, "name");
mod.filename = stringEntry(table, "filename"); mod.filename = stringEntry(table, "filename");
mod.side = stringToSide(stringEntry(table, "side")); mod.side = stringToSide(stringEntry(table, "side"));
mod.releaseType = ModPlatform::IndexedVersionType(stringEntry(table, "releaseType")); mod.releaseType = ModPlatform::IndexedVersionType(stringEntry(table, "x-prismlauncher-release-type"));
if (auto loaders = table["loaders"]; loaders && loaders.is_array()) { if (auto loaders = table["x-prismlauncher-loaders"]; loaders && loaders.is_array()) {
for (auto&& loader : *loaders.as_array()) { for (auto&& loader : *loaders.as_array()) {
if (loader.is_string()) { if (loader.is_string()) {
mod.loaders |= ModPlatform::getModLoaderFromString(QString::fromStdString(loader.as_string()->value_or(""))); 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()) { for (auto&& version : *versions.as_array()) {
if (version.is_string()) { if (version.is_string()) {
auto ver = QString::fromStdString(version.as_string()->value_or("")); auto ver = QString::fromStdString(version.as_string()->value_or(""));

View File

@ -235,7 +235,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
} }
ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED); ui->actionViewJavaFolder->setEnabled(BuildConfig.JAVA_DOWNLOADER_ENABLED);
} }
// add the toolbar toggles to the view menu // add the toolbar toggles to the view menu

View File

@ -798,7 +798,7 @@
<string>Java</string> <string>Java</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Open the java folder in a file browser. Only available if the built-in Java downloader is used.</string> <string>Open the Java folder in a file browser. Only available if the built-in Java downloader is used.</string>
</property> </property>
</action> </action>
</widget> </widget>

View File

@ -31,6 +31,7 @@
#include "ui/widgets/VersionSelectWidget.h" #include "ui/widgets/VersionSelectWidget.h"
class InstallLoaderPage : public VersionSelectWidget, public BasePage { class InstallLoaderPage : public VersionSelectWidget, public BasePage {
Q_OBJECT
public: public:
InstallLoaderPage(const QString& id, InstallLoaderPage(const QString& id,
const QString& iconName, const QString& iconName,
@ -164,3 +165,4 @@ void InstallLoaderDialog::done(int result)
QDialog::done(result); QDialog::done(result);
} }
#include "InstallLoaderDialog.moc"

View File

@ -36,6 +36,7 @@
#include "NewInstanceDialog.h" #include "NewInstanceDialog.h"
#include "Application.h" #include "Application.h"
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
#include "ui/pages/modplatform/import_ftb/ImportFTBPage.h" #include "ui/pages/modplatform/import_ftb/ImportFTBPage.h"
#include "ui_NewInstanceDialog.h" #include "ui_NewInstanceDialog.h"
@ -140,6 +141,8 @@ NewInstanceDialog::NewInstanceDialog(const QString& initialGroup,
auto geometry = screen->availableSize(); auto geometry = screen->availableSize();
resize(width(), qMin(geometry.height() - 50, 710)); resize(width(), qMin(geometry.height() - 50, 710));
} }
connect(m_container, &PageContainer::selectedPageChanged, this, &NewInstanceDialog::selectedPageChanged);
} }
void NewInstanceDialog::reject() void NewInstanceDialog::reject()
@ -316,3 +319,16 @@ void NewInstanceDialog::importIconNow()
} }
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64()); APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
} }
void NewInstanceDialog::selectedPageChanged(BasePage* previous, BasePage* selected)
{
auto prevPage = dynamic_cast<ModpackProviderBasePage*>(previous);
if (prevPage) {
m_searchTerm = prevPage->getSerachTerm();
}
auto nextPage = dynamic_cast<ModpackProviderBasePage*>(selected);
if (nextPage) {
nextPage->setSearchTerm(m_searchTerm);
}
}

View File

@ -82,6 +82,7 @@ class NewInstanceDialog : public QDialog, public BasePageProvider {
private slots: private slots:
void on_iconButton_clicked(); void on_iconButton_clicked();
void on_instNameTextBox_textChanged(const QString& arg1); void on_instNameTextBox_textChanged(const QString& arg1);
void selectedPageChanged(BasePage* previous, BasePage* selected);
private: private:
Ui::NewInstanceDialog* ui = nullptr; Ui::NewInstanceDialog* ui = nullptr;
@ -98,5 +99,7 @@ class NewInstanceDialog : public QDialog, public BasePageProvider {
QString importVersion; QString importVersion;
QString m_searchTerm;
void importIconNow(); void importIconNow();
}; };

View File

@ -258,7 +258,9 @@ void ResourceDownloadDialog::selectedPageChanged(BasePage* previous, BasePage* s
} }
// Same effect as having a global search bar // Same effect as having a global search bar
selectedPage()->setSearchTerm(prev_page->getSearchTerm()); ResourcePage* result = dynamic_cast<ResourcePage*>(selected);
Q_ASSERT(result != nullptr);
result->setSearchTerm(prev_page->getSearchTerm());
} }
ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptr<ModFolderModel>& mods, BaseInstance* instance) ModDownloadDialog::ModDownloadDialog(QWidget* parent, const std::shared_ptr<ModFolderModel>& mods, BaseInstance* instance)

View File

@ -57,13 +57,13 @@ class InstallJavaPage : public QWidget, public BasePage {
majorVersionSelect = new VersionSelectWidget(this); majorVersionSelect = new VersionSelectWidget(this);
majorVersionSelect->selectCurrent(); majorVersionSelect->selectCurrent();
majorVersionSelect->setEmptyString(tr("No java versions are currently available in the meta.")); 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->setEmptyErrorString(tr("Couldn't load or download the Java version lists!"));
horizontalLayout->addWidget(majorVersionSelect, 1); horizontalLayout->addWidget(majorVersionSelect, 1);
javaVersionSelect = new VersionSelectWidget(this); javaVersionSelect = new VersionSelectWidget(this);
javaVersionSelect->setEmptyString(tr("No java versions are currently available for your OS.")); 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->setEmptyErrorString(tr("Couldn't load or download the Java version lists!"));
horizontalLayout->addWidget(javaVersionSelect, 4); horizontalLayout->addWidget(javaVersionSelect, 4);
connect(majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &InstallJavaPage::setSelectedVersion); connect(majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &InstallJavaPage::setSelectedVersion);
connect(majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &InstallJavaPage::selectionChanged); connect(majorVersionSelect, &VersionSelectWidget::selectedVersionChanged, this, &InstallJavaPage::selectionChanged);

View File

@ -143,6 +143,7 @@ void APIPage::loadSettings()
ui->modrinthToken->setText(modrinthToken); ui->modrinthToken->setText(modrinthToken);
QString customUserAgent = s->get("UserAgentOverride").toString(); QString customUserAgent = s->get("UserAgentOverride").toString();
ui->userAgentLineEdit->setText(customUserAgent); ui->userAgentLineEdit->setText(customUserAgent);
ui->technicClientID->setText(s->get("TechnicClientID").toString());
} }
void APIPage::applySettings() void APIPage::applySettings()
@ -172,6 +173,7 @@ void APIPage::applySettings()
QString modrinthToken = ui->modrinthToken->text(); QString modrinthToken = ui->modrinthToken->text();
s->set("ModrinthToken", modrinthToken); s->set("ModrinthToken", modrinthToken);
s->set("UserAgentOverride", ui->userAgentLineEdit->text()); s->set("UserAgentOverride", ui->userAgentLineEdit->text());
s->set("TechnicClientID", ui->technicClientID->text());
} }
bool APIPage::apply() bool APIPage::apply()

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>841</width>
<height>600</height> <height>620</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -288,6 +288,36 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Technic Client ID</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Note: you only need to set this to access private data.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="technicClientID">
<property name="placeholderText">
<string>(None)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Enter a custom GUID client ID for Technic here.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -67,8 +67,8 @@ JavaPage::JavaPage(QWidget* parent) : QWidget(parent), ui(new Ui::JavaPage)
ui->managedJavaList->initialize(new JavaInstallList(this, true)); ui->managedJavaList->initialize(new JavaInstallList(this, true));
ui->managedJavaList->setResizeOn(2); ui->managedJavaList->setResizeOn(2);
ui->managedJavaList->selectCurrent(); ui->managedJavaList->selectCurrent();
ui->managedJavaList->setEmptyString(tr("No managed java versions are installed")); ui->managedJavaList->setEmptyString(tr("No managed Java versions are installed"));
ui->managedJavaList->setEmptyErrorString(tr("Couldn't load the managed java list!")); ui->managedJavaList->setEmptyErrorString(tr("Couldn't load the managed Java list!"));
connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] { connect(ui->autodetectJavaCheckBox, &QCheckBox::stateChanged, this, [this] {
ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked()); ui->autodownloadCheckBox->setEnabled(ui->autodetectJavaCheckBox->isChecked());
if (!ui->autodetectJavaCheckBox->isChecked()) if (!ui->autodetectJavaCheckBox->isChecked())

View File

@ -234,7 +234,7 @@ bool LogPage::apply()
bool LogPage::shouldDisplay() const bool LogPage::shouldDisplay() const
{ {
return m_instance->isRunning() || m_proxy->rowCount() > 0; return true;
} }
void LogPage::on_btnPaste_clicked() void LogPage::on_btnPaste_clicked()

View File

@ -73,6 +73,7 @@ class ModFolderPage : public ExternalResourcesPage {
}; };
class CoreModFolderPage : public ModFolderPage { class CoreModFolderPage : public ModFolderPage {
Q_OBJECT
public: public:
explicit CoreModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0); explicit CoreModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0);
virtual ~CoreModFolderPage() = default; virtual ~CoreModFolderPage() = default;
@ -86,6 +87,7 @@ class CoreModFolderPage : public ModFolderPage {
}; };
class NilModFolderPage : public ModFolderPage { class NilModFolderPage : public ModFolderPage {
Q_OBJECT
public: public:
explicit NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0); explicit NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0);
virtual ~NilModFolderPage() = default; virtual ~NilModFolderPage() = default;

View File

@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
* Prism Launcher - Minecraft Launcher
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#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;
};

View File

@ -164,3 +164,13 @@ void AtlPage::onVersionSelectionChanged(QString version)
selectedVersion = version; selectedVersion = version;
suggestCurrent(); suggestCurrent();
} }
void AtlPage::setSearchTerm(QString term)
{
ui->searchEdit->setText(term);
}
QString AtlPage::getSerachTerm() const
{
return ui->searchEdit->text();
}

View File

@ -42,8 +42,7 @@
#include <QWidget> #include <QWidget>
#include "Application.h" #include "Application.h"
#include "tasks/Task.h" #include "ui/pages/modplatform/ModpackProviderBasePage.h"
#include "ui/pages/BasePage.h"
namespace Ui { namespace Ui {
class AtlPage; class AtlPage;
@ -51,7 +50,7 @@ class AtlPage;
class NewInstanceDialog; class NewInstanceDialog;
class AtlPage : public QWidget, public BasePage { class AtlPage : public QWidget, public ModpackProviderBasePage {
Q_OBJECT Q_OBJECT
public: public:
@ -66,6 +65,11 @@ class AtlPage : public QWidget, public BasePage {
void openedImpl() override; 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: private:
void suggestCurrent(); void suggestCurrent();

View File

@ -299,3 +299,12 @@ void FlamePage::updateUi()
ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description)); ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description));
ui->packDescription->flush(); ui->packDescription->flush();
} }
QString FlamePage::getSerachTerm() const
{
return ui->searchEdit->text();
}
void FlamePage::setSearchTerm(QString term)
{
ui->searchEdit->setText(term);
}

View File

@ -40,7 +40,7 @@
#include <Application.h> #include <Application.h>
#include <modplatform/flame/FlamePackIndex.h> #include <modplatform/flame/FlamePackIndex.h>
#include <QTimer> #include <QTimer>
#include "ui/pages/BasePage.h" #include "ui/pages/modplatform/ModpackProviderBasePage.h"
#include "ui/widgets/ProgressWidget.h" #include "ui/widgets/ProgressWidget.h"
namespace Ui { namespace Ui {
@ -53,7 +53,7 @@ namespace Flame {
class ListModel; class ListModel;
} }
class FlamePage : public QWidget, public BasePage { class FlamePage : public QWidget, public ModpackProviderBasePage {
Q_OBJECT Q_OBJECT
public: public:
@ -72,6 +72,11 @@ class FlamePage : public QWidget, public BasePage {
bool eventFilter(QObject* watched, QEvent* event) 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: private:
void suggestCurrent(); void suggestCurrent();

View File

@ -135,4 +135,13 @@ void ImportFTBPage::triggerSearch()
currentModel->setSearchTerm(ui->searchEdit->text()); currentModel->setSearchTerm(ui->searchEdit->text());
} }
void ImportFTBPage::setSearchTerm(QString term)
{
ui->searchEdit->setText(term);
}
QString ImportFTBPage::getSerachTerm() const
{
return ui->searchEdit->text();
}
} // namespace FTBImportAPP } // namespace FTBImportAPP

View File

@ -25,7 +25,7 @@
#include <Application.h> #include <Application.h>
#include "modplatform/import_ftb/PackHelpers.h" #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" #include "ui/pages/modplatform/import_ftb/ListModel.h"
class NewInstanceDialog; class NewInstanceDialog;
@ -35,7 +35,7 @@ namespace Ui {
class ImportFTBPage; class ImportFTBPage;
} }
class ImportFTBPage : public QWidget, public BasePage { class ImportFTBPage : public QWidget, public ModpackProviderBasePage {
Q_OBJECT Q_OBJECT
public: public:
@ -49,6 +49,11 @@ class ImportFTBPage : public QWidget, public BasePage {
void openedImpl() override; void openedImpl() override;
void retranslate() 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: private:
void suggestCurrent(); void suggestCurrent();
void onPackSelectionChanged(Modpack* pack = nullptr); void onPackSelectionChanged(Modpack* pack = nullptr);

View File

@ -369,4 +369,13 @@ void Page::triggerSearch()
currentModel->setSearchTerm(ui->searchEdit->text()); currentModel->setSearchTerm(ui->searchEdit->text());
} }
void Page::setSearchTerm(QString term)
{
ui->searchEdit->setText(term);
}
QString Page::getSerachTerm() const
{
return ui->searchEdit->text();
}
} // namespace LegacyFTB } // namespace LegacyFTB

View File

@ -43,7 +43,7 @@
#include "QObjectPtr.h" #include "QObjectPtr.h"
#include "modplatform/legacy_ftb/PackFetchTask.h" #include "modplatform/legacy_ftb/PackFetchTask.h"
#include "modplatform/legacy_ftb/PackHelpers.h" #include "modplatform/legacy_ftb/PackHelpers.h"
#include "ui/pages/BasePage.h" #include "ui/pages/modplatform/ModpackProviderBasePage.h"
class NewInstanceDialog; class NewInstanceDialog;
@ -57,7 +57,7 @@ class ListModel;
class FilterModel; class FilterModel;
class PrivatePackManager; class PrivatePackManager;
class Page : public QWidget, public BasePage { class Page : public QWidget, public ModpackProviderBasePage {
Q_OBJECT Q_OBJECT
public: public:
@ -71,6 +71,11 @@ class Page : public QWidget, public BasePage {
void openedImpl() override; void openedImpl() override;
void retranslate() 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: private:
void suggestCurrent(); void suggestCurrent();
void onPackSelectionChanged(Modpack* pack = nullptr); void onPackSelectionChanged(Modpack* pack = nullptr);

View File

@ -351,3 +351,13 @@ void ModrinthPage::onVersionSelectionChanged(int index)
selectedVersion = ui->versionSelectionBox->currentData().toString(); selectedVersion = ui->versionSelectionBox->currentData().toString();
suggestCurrent(); suggestCurrent();
} }
void ModrinthPage::setSearchTerm(QString term)
{
ui->searchEdit->setText(term);
}
QString ModrinthPage::getSerachTerm() const
{
return ui->searchEdit->text();
}

View File

@ -38,9 +38,9 @@
#include "Application.h" #include "Application.h"
#include "ui/dialogs/NewInstanceDialog.h" #include "ui/dialogs/NewInstanceDialog.h"
#include "ui/pages/BasePage.h"
#include "modplatform/modrinth/ModrinthPackManifest.h" #include "modplatform/modrinth/ModrinthPackManifest.h"
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
#include "ui/widgets/ProgressWidget.h" #include "ui/widgets/ProgressWidget.h"
#include <QTimer> #include <QTimer>
@ -54,7 +54,7 @@ namespace Modrinth {
class ModpackListModel; class ModpackListModel;
} }
class ModrinthPage : public QWidget, public BasePage { class ModrinthPage : public QWidget, public ModpackProviderBasePage {
Q_OBJECT Q_OBJECT
public: public:
@ -78,6 +78,11 @@ class ModrinthPage : public QWidget, public BasePage {
void openedImpl() override; void openedImpl() override;
bool eventFilter(QObject* watched, QEvent* event) 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: private slots:
void onSelectionChanged(QModelIndex first, QModelIndex second); void onSelectionChanged(QModelIndex first, QModelIndex second);
void onVersionSelectionChanged(int index); void onVersionSelectionChanged(int index);

View File

@ -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); QString("%1search?build=%2&q=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm);
searchMode = List; searchMode = List;
} }
auto clientId = APPLICATION->settings()->get("TechnicClientID").toString();
if (!clientId.isEmpty()) {
searchUrl += "?cid=" + clientId;
}
netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl), response)); netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl), response));
jobPtr = netJob; jobPtr = netJob;
jobPtr->start(); jobPtr->start();

View File

@ -342,3 +342,13 @@ void TechnicPage::onVersionSelectionChanged(QString version)
selectedVersion = version; selectedVersion = version;
selectVersion(); selectVersion();
} }
void TechnicPage::setSearchTerm(QString term)
{
ui->searchEdit->setText(term);
}
QString TechnicPage::getSerachTerm() const
{
return ui->searchEdit->text();
}

View File

@ -41,7 +41,7 @@
#include <Application.h> #include <Application.h>
#include "TechnicData.h" #include "TechnicData.h"
#include "net/NetJob.h" #include "net/NetJob.h"
#include "ui/pages/BasePage.h" #include "ui/pages/modplatform/ModpackProviderBasePage.h"
#include "ui/widgets/ProgressWidget.h" #include "ui/widgets/ProgressWidget.h"
namespace Ui { namespace Ui {
@ -54,7 +54,7 @@ namespace Technic {
class ListModel; class ListModel;
} }
class TechnicPage : public QWidget, public BasePage { class TechnicPage : public QWidget, public ModpackProviderBasePage {
Q_OBJECT Q_OBJECT
public: public:
@ -71,6 +71,11 @@ class TechnicPage : public QWidget, public BasePage {
bool eventFilter(QObject* watched, QEvent* event) 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: private:
void suggestCurrent(); void suggestCurrent();
void metadataLoaded(); void metadataLoaded();

View File

@ -30,7 +30,7 @@
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>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?</string> <string>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?</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>

View File

@ -83,6 +83,6 @@ void JavaWizardPage::retranslate()
{ {
setTitle(tr("Java")); setTitle(tr("Java"));
setSubTitle( 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(); m_java_widget->retranslate();
} }

View File

@ -8,8 +8,8 @@ See [Package variants](#package-variants) for a list of available packages.
## Installing a development release (flake) ## Installing a development release (flake)
We use [garnix](https://garnix.io/) to build and cache our development builds. We use [cachix](https://cachix.org/) to cache our development and release builds.
If you want to avoid rebuilds you may add the garnix cache to your substitutors, or use `--accept-flake-config` 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. to temporarily enable it when using `nix` commands.
Example (NixOS): Example (NixOS):
@ -17,12 +17,10 @@ Example (NixOS):
```nix ```nix
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [ "https://prismlauncher.cachix.org" ];
"https://cache.garnix.io"
];
trusted-public-keys = [ 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) ## Installing a development release (without flakes)
We use [garnix](https://garnix.io/) to build and cache our development builds. We use [Cachix](https://cachix.org/) to cache our development and release builds.
If you want to avoid rebuilds you may add the garnix cache to your substitutors. If you want to avoid rebuilds you may add the Cachix bucket to your substitutors.
Example (NixOS): Example (NixOS):
```nix ```nix
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ trusted-substituters = [ "https://prismlauncher.cachix.org" ];
"https://cache.garnix.io"
];
trusted-public-keys = [ trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" "prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c="
]; ];
}; };
} }

View File

@ -23,7 +23,7 @@
cd ${self} cd ${self}
echo "Running clang-format...." 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..." echo "Running deadnix..."
deadnix --fail deadnix --fail

View File

@ -41,6 +41,31 @@ configure_file(org.prismlauncher.PrismLauncher.metainfo.xml.in org.prismlauncher
configure_file(prismlauncher.rc.in prismlauncher.rc @ONLY) configure_file(prismlauncher.rc.in prismlauncher.rc @ONLY)
configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY) configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY)
configure_file(prismlauncher.ico prismlauncher.ico COPYONLY) configure_file(prismlauncher.ico prismlauncher.ico COPYONLY)
if(MSVC)
set(Launcher_MSVC_Redist_NSIS_Section [=[
!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_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\"
${Else}
DetailPrint "Download failed with error $0"
${EndIf}
SectionEnd
!endif
]=])
endif()
configure_file(win_install.nsi.in win_install.nsi @ONLY) configure_file(win_install.nsi.in win_install.nsi @ONLY)
if(SCDOC_FOUND) if(SCDOC_FOUND)

View File

@ -2,6 +2,8 @@
!include "LogicLib.nsh" !include "LogicLib.nsh"
!include "MUI2.nsh" !include "MUI2.nsh"
!include "x64.nsh"
Unicode true Unicode true
Name "@Launcher_DisplayName@" Name "@Launcher_DisplayName@"
@ -112,6 +114,16 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "@Launcher_Copyright@"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "@Launcher_VERSION_NAME4@" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "@Launcher_VERSION_NAME4@"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@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 ; Shell Associate Macros
@ -175,7 +187,7 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@
!macroend !macroend
!macro APP_UNASSOCIATE EXT APP_ID !macro APP_UNASSOCIATE EXT APP_ID APP_EXE
# Unregister file type # Unregister file type
ClearErrors ClearErrors
@ -336,6 +348,19 @@ Section "" UninstallPrevious
SectionEnd SectionEnd
;------------------------------------
; include nice plugins
; NScurl - curl in NSIS
; used for MSVS redist download
; extract to ../NSISPlugins/NScurl
; https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip
!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
;------------------------------------ ;------------------------------------
@ -396,6 +421,8 @@ Section "@Launcher_DisplayName@"
SectionEnd SectionEnd
@Launcher_MSVC_Redist_NSIS_Section@
Section "Start Menu Shortcut" SM_SHORTCUTS Section "Start Menu Shortcut" SM_SHORTCUTS
CreateShortcut "$SMPROGRAMS\@Launcher_DisplayName@.lnk" "$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "" "$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" 0 CreateShortcut "$SMPROGRAMS\@Launcher_DisplayName@.lnk" "$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "" "$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" 0
@ -464,8 +491,8 @@ Section -un.ShellAssoc
!insertmacro APP_TEARDOWN_DEFAULT `${APPID}` `${APPNAME}` `${APPEXE}` !insertmacro APP_TEARDOWN_DEFAULT `${APPID}` `${APPNAME}` `${APPEXE}`
!insertmacro APP_UNASSOCIATE ".zip" `${APPID}` !insertmacro APP_UNASSOCIATE ".zip" `${APPID}` `${APPEXE}`
!insertmacro APP_UNASSOCIATE ".mrpack" `${APPID}` !insertmacro APP_UNASSOCIATE ".mrpack" `${APPID}` `${APPEXE}`
!insertmacro NotifyShell_AssocChanged !insertmacro NotifyShell_AssocChanged
SectionEnd SectionEnd