Merge branch 'PrismLauncher:develop' into mrpack-export
This commit is contained in:
@ -184,7 +184,7 @@ void BlockedModsDialog::directoryChanged(QString path)
|
||||
/// @brief add the user downloads folder and the global mods folder to the filesystem watcher
|
||||
void BlockedModsDialog::setupWatch()
|
||||
{
|
||||
const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||
const QString downloadsFolder = APPLICATION->settings()->get("DownloadsDir").toString();
|
||||
const QString modsFolder = APPLICATION->settings()->get("CentralModsDir").toString();
|
||||
m_watcher.addPath(downloadsFolder);
|
||||
m_watcher.addPath(modsFolder);
|
||||
|
@ -1,9 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* PolyMC - Minecraft Launcher
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2022 Lenny McLennington <lenny@sneed.church>
|
||||
* Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me>
|
||||
*
|
||||
* 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
|
||||
@ -147,6 +148,8 @@ void APIPage::loadSettings()
|
||||
ui->metaURL->setText(metaURL);
|
||||
QString flameKey = s->get("FlameKeyOverride").toString();
|
||||
ui->flameKey->setText(flameKey);
|
||||
QString modrinthToken = s->get("ModrinthToken").toString();
|
||||
ui->modrinthToken->setText(modrinthToken);
|
||||
QString customUserAgent = s->get("UserAgentOverride").toString();
|
||||
ui->userAgentLineEdit->setText(customUserAgent);
|
||||
}
|
||||
@ -177,6 +180,8 @@ void APIPage::applySettings()
|
||||
s->set("MetaURLOverride", metaURL);
|
||||
QString flameKey = ui->flameKey->text();
|
||||
s->set("FlameKeyOverride", flameKey);
|
||||
QString modrinthToken = ui->modrinthToken->text();
|
||||
s->set("ModrinthToken", modrinthToken);
|
||||
s->set("UserAgentOverride", ui->userAgentLineEdit->text());
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,51 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_modrinth">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Modrinth API</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api-spec/#section/Authentication">documentation</a> for more information.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Enter a custom API token for Modrinth here.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="modrinthToken">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>(None)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_flame">
|
||||
<property name="enabled">
|
||||
@ -203,16 +248,16 @@
|
||||
<property name="title">
|
||||
<string>&CurseForge Core API</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Note: you probably don't need to set this if CurseForge already works.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Enter a custom API Key for CurseForge here.</string>
|
||||
</property>
|
||||
|
@ -140,8 +140,8 @@ void LauncherPage::on_instDirBrowseBtn_clicked()
|
||||
if (result == QMessageBox::Ok)
|
||||
{
|
||||
ui->instDirTextBox->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->instDirTextBox->setText(cooked_dir);
|
||||
@ -160,6 +160,7 @@ void LauncherPage::on_iconsDirBrowseBtn_clicked()
|
||||
ui->iconsDirTextBox->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherPage::on_modsDirBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"), ui->modsDirTextBox->text());
|
||||
@ -172,6 +173,17 @@ void LauncherPage::on_modsDirBrowseBtn_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherPage::on_downloadsDirBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Downloads Folder"), ui->downloadsDirTextBox->text());
|
||||
|
||||
if (!raw_dir.isEmpty() && QDir(raw_dir).exists())
|
||||
{
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
ui->downloadsDirTextBox->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
|
||||
void LauncherPage::on_metadataDisableBtn_clicked()
|
||||
{
|
||||
ui->metadataWarningLabel->setHidden(!ui->metadataDisableBtn->isChecked());
|
||||
@ -204,6 +216,7 @@ void LauncherPage::applySettings()
|
||||
s->set("InstanceDir", ui->instDirTextBox->text());
|
||||
s->set("CentralModsDir", ui->modsDirTextBox->text());
|
||||
s->set("IconsDir", ui->iconsDirTextBox->text());
|
||||
s->set("DownloadsDir", ui->downloadsDirTextBox->text());
|
||||
|
||||
auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId();
|
||||
switch (sortMode)
|
||||
@ -260,6 +273,7 @@ void LauncherPage::loadSettings()
|
||||
ui->instDirTextBox->setText(s->get("InstanceDir").toString());
|
||||
ui->modsDirTextBox->setText(s->get("CentralModsDir").toString());
|
||||
ui->iconsDirTextBox->setText(s->get("IconsDir").toString());
|
||||
ui->downloadsDirTextBox->setText(s->get("DownloadsDir").toString());
|
||||
|
||||
QString sortMode = s->get("InstSortMode").toString();
|
||||
|
||||
|
@ -88,6 +88,7 @@ slots:
|
||||
void on_instDirBrowseBtn_clicked();
|
||||
void on_modsDirBrowseBtn_clicked();
|
||||
void on_iconsDirBrowseBtn_clicked();
|
||||
void on_downloadsDirBrowseBtn_clicked();
|
||||
void on_metadataDisableBtn_clicked();
|
||||
|
||||
/*!
|
||||
|
@ -38,7 +38,7 @@
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="featuresTab">
|
||||
<attribute name="title">
|
||||
@ -67,13 +67,6 @@
|
||||
<string>Folders</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="foldersBoxLayout">
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="modsDirBrowseBtn">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="instDirBrowseBtn">
|
||||
<property name="text">
|
||||
@ -81,29 +74,12 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="iconsDirBrowseBtn">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="modsDirTextBox"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="instDirTextBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelIconsDir">
|
||||
<property name="text">
|
||||
<string>&Icons:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>iconsDirTextBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="modsDirTextBox"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelInstDir">
|
||||
<property name="text">
|
||||
@ -117,6 +93,20 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="iconsDirTextBox"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="iconsDirBrowseBtn">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="modsDirBrowseBtn">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelModsDir">
|
||||
<property name="text">
|
||||
@ -127,6 +117,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelIconsDir">
|
||||
<property name="text">
|
||||
<string>&Icons:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>iconsDirTextBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelDownloadsDir">
|
||||
<property name="text">
|
||||
<string>&Downloads:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>downloadsDirTextBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="downloadsDirTextBox"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="downloadsDirBrowseBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -273,3 +273,12 @@ bool CoreModFolderPage::shouldDisplay() const
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NilModFolderPage::NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent)
|
||||
: ModFolderPage(inst, mods, parent)
|
||||
{}
|
||||
|
||||
bool NilModFolderPage::shouldDisplay() const
|
||||
{
|
||||
return m_model->dir().exists();
|
||||
}
|
||||
|
@ -81,3 +81,16 @@ class CoreModFolderPage : public ModFolderPage {
|
||||
|
||||
virtual bool shouldDisplay() const override;
|
||||
};
|
||||
|
||||
class NilModFolderPage : public ModFolderPage {
|
||||
public:
|
||||
explicit NilModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> mods, QWidget* parent = 0);
|
||||
virtual ~NilModFolderPage() = default;
|
||||
|
||||
virtual QString displayName() const override { return tr("Nilmods"); }
|
||||
virtual QIcon icon() const override { return APPLICATION->getThemedIcon("coremods"); }
|
||||
virtual QString id() const override { return "nilmods"; }
|
||||
virtual QString helpPage() const override { return "Nilmods"; }
|
||||
|
||||
virtual bool shouldDisplay() const override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user