diff options
Diffstat (limited to 'launcher/ui/pages')
19 files changed, 52 insertions, 16 deletions
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp index a4f4dfb9..278f45c4 100644 --- a/launcher/ui/pages/global/AccountListPage.cpp +++ b/launcher/ui/pages/global/AccountListPage.cpp @@ -167,7 +167,7 @@ void AccountListPage::on_actionAddMicrosoft_triggered() tr( "Microsoft accounts are only usable on macOS 10.13 or newer, with fully updated %1.\n\n" "Please update both your operating system and %1." - ).arg(BuildConfig.LAUNCHER_NAME), + ).arg(BuildConfig.LAUNCHER_DISPLAYNAME), QMessageBox::Warning )->exec(); return; diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 73ef0024..1e5df5b2 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -151,7 +151,7 @@ void LauncherPage::on_instDirBrowseBtn_clicked() "This is known to cause problems. " "After a restart the launcher might break, " "because it will no longer have access to that directory.\n\n" - "Granting PolyMC access to it via Flatseal is recommended.")); + "Granting %1 access to it via Flatseal is recommended.").arg(BuildConfig.LAUNCHER_DISPLAYNAME)); warning.setInformativeText( tr("Do you want to proceed anyway?")); warning.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 645f7ef6..0d14f147 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -176,7 +176,7 @@ <item> <widget class="QLabel" name="metadataWarningLabel"> <property name="text"> - <string><html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: Disabling mod metadata may also disable some upcoming QoL features, such as mod updating!</span></p></body></html></string> + <string><html><head/><body><p><span style=" font-weight:600; color:#f5c211;">Warning</span><span style=" color:#f5c211;">: Disabling mod metadata may also disable some QoL features, such as mod updating!</span></p></body></html></string> </property> <property name="wordWrap"> <bool>true</bool> diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp index f31e8325..b6c873cc 100644 --- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp +++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp @@ -103,10 +103,6 @@ void ExternalResourcesPage::runningStateChanged(bool running) return; m_controlsEnabled = !running; - ui->actionAddItem->setEnabled(m_controlsEnabled); - ui->actionDisableItem->setEnabled(m_controlsEnabled); - ui->actionEnableItem->setEnabled(m_controlsEnabled); - ui->actionRemoveItem->setEnabled(m_controlsEnabled); } bool ExternalResourcesPage::shouldDisplay() const diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp index 03910745..5da7f19f 100644 --- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp +++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp @@ -274,6 +274,9 @@ void InstanceSettingsPage::applySettings() { m_settings->reset("JoinServerOnLaunchAddress"); } + + // FIXME: This should probably be called by a signal instead + m_instance->updateRuntimeContext(); } void InstanceSettingsPage::loadSettings() diff --git a/launcher/ui/pages/instance/LogPage.cpp b/launcher/ui/pages/instance/LogPage.cpp index 3d9fb025..31c3e925 100644 --- a/launcher/ui/pages/instance/LogPage.cpp +++ b/launcher/ui/pages/instance/LogPage.cpp @@ -279,7 +279,7 @@ void LogPage::on_btnPaste_clicked() MessageLevel::Launcher, QString("%2: Log upload triggered at: %1").arg( QDateTime::currentDateTime().toString(Qt::RFC2822Date), - BuildConfig.LAUNCHER_NAME + BuildConfig.LAUNCHER_DISPLAYNAME ) ); auto url = GuiUtil::uploadPaste(m_model->toPlainText(), this); @@ -289,7 +289,7 @@ void LogPage::on_btnPaste_clicked() MessageLevel::Launcher, QString("%2: Log uploaded to: %1").arg( url, - BuildConfig.LAUNCHER_NAME + BuildConfig.LAUNCHER_DISPLAYNAME ) ); } @@ -297,7 +297,7 @@ void LogPage::on_btnPaste_clicked() { m_model->append( MessageLevel::Error, - QString("%1: Log upload failed!").arg(BuildConfig.LAUNCHER_NAME) + QString("%1: Log upload failed!").arg(BuildConfig.LAUNCHER_DISPLAYNAME) ); } } diff --git a/launcher/ui/pages/instance/ModFolderPage.cpp b/launcher/ui/pages/instance/ModFolderPage.cpp index 28a874c2..f0106066 100644 --- a/launcher/ui/pages/instance/ModFolderPage.cpp +++ b/launcher/ui/pages/instance/ModFolderPage.cpp @@ -117,6 +117,10 @@ void ModFolderPage::runningStateChanged(bool running) ExternalResourcesPage::runningStateChanged(running); ui->actionDownloadItem->setEnabled(!running); ui->actionUpdateItem->setEnabled(!running); + ui->actionAddItem->setEnabled(!running); + ui->actionEnableItem->setEnabled(!running); + ui->actionDisableItem->setEnabled(!running); + ui->actionRemoveItem->setEnabled(!running); } bool ModFolderPage::shouldDisplay() const diff --git a/launcher/ui/pages/modplatform/ImportPage.ui b/launcher/ui/pages/modplatform/ImportPage.ui index 0a50e871..3583cf90 100644 --- a/launcher/ui/pages/modplatform/ImportPage.ui +++ b/launcher/ui/pages/modplatform/ImportPage.ui @@ -60,7 +60,7 @@ <item> <widget class="QLabel" name="label_2"> <property name="text"> - <string>- PolyMC / MultiMC exported instances (ZIP)</string> + <string>- Prism Launcher, PolyMC or MultiMC exported instances (ZIP)</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp index 8961fadd..49766fa6 100644 --- a/launcher/ui/pages/modplatform/ModModel.cpp +++ b/launcher/ui/pages/modplatform/ModModel.cpp @@ -265,7 +265,7 @@ void ListModel::searchRequestFailed(QString reason) //: %1 refers to the launcher itself QString("%1 %2") .arg(m_parent->displayName()) - .arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_NAME))); + .arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_DISPLAYNAME))); } jobPtr.reset(); diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 153bb049..f2c1746f 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -265,7 +265,9 @@ void ModPage::updateModVersions(int prev_count) break; } } - if(valid || m_filter->versions.size() == 0) + + // Only add the version if it's valid or using the 'Any' filter, but never if the version is opted out + if ((valid || m_filter->versions.empty()) && !optedOut(version)) ui->versionSelectionBox->addItem(version.version, QVariant(i)); } if (ui->versionSelectionBox->count() == 0 && prev_count != 0) { diff --git a/launcher/ui/pages/modplatform/ModPage.h b/launcher/ui/pages/modplatform/ModPage.h index 3f31651c..ae3d7e77 100644 --- a/launcher/ui/pages/modplatform/ModPage.h +++ b/launcher/ui/pages/modplatform/ModPage.h @@ -51,6 +51,7 @@ class ModPage : public QWidget, public BasePage { auto shouldDisplay() const -> bool override = 0; virtual auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool = 0; + virtual bool optedOut(ModPlatform::IndexedVersion& ver) const { return false; }; auto apiProvider() -> ModAPI* { return api.get(); }; auto getFilter() const -> const std::shared_ptr<ModFilterWidget::Filter> { return m_filter; } diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp index b497d1fe..fd6e32ff 100644 --- a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp +++ b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp @@ -69,6 +69,11 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString min return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty(); } +bool FlameModPage::optedOut(ModPlatform::IndexedVersion& ver) const +{ + return ver.downloadUrl.isEmpty(); +} + // I don't know why, but doing this on the parent class makes it so that // other mod providers start loading before being selected, at least with // my Qt, so we need to implement this in every derived class... diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.h b/launcher/ui/pages/modplatform/flame/FlameModPage.h index 2cd484cb..50dedd6f 100644 --- a/launcher/ui/pages/modplatform/flame/FlameModPage.h +++ b/launcher/ui/pages/modplatform/flame/FlameModPage.h @@ -61,6 +61,7 @@ class FlameModPage : public ModPage { inline auto metaEntryBase() const -> QString override { return "FlameMods"; }; auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool override; + bool optedOut(ModPlatform::IndexedVersion& ver) const override; auto shouldDisplay() const -> bool override; }; diff --git a/launcher/ui/pages/modplatform/flame/FlamePage.ui b/launcher/ui/pages/modplatform/flame/FlamePage.ui index aab16421..1a3d0225 100644 --- a/launcher/ui/pages/modplatform/flame/FlamePage.ui +++ b/launcher/ui/pages/modplatform/flame/FlamePage.ui @@ -19,7 +19,7 @@ </font> </property> <property name="text"> - <string>Note: CurseForge allows creators to block access to third-party tools like PolyMC. As such, you may need to manually download some mods to be able to install a modpack.</string> + <string>Note: CurseForge allows creators to block access to third-party tools like Prism Launcher. As such, you may need to manually download some mods to be able to install a modpack.</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> diff --git a/launcher/ui/pages/modplatform/ftb/FtbListModel.cpp b/launcher/ui/pages/modplatform/ftb/FtbListModel.cpp index ad15b6e6..3a149944 100644 --- a/launcher/ui/pages/modplatform/ftb/FtbListModel.cpp +++ b/launcher/ui/pages/modplatform/ftb/FtbListModel.cpp @@ -103,6 +103,8 @@ void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallbac void ListModel::request() { + m_aborted = false; + beginResetModel(); modpacks.clear(); endResetModel(); @@ -117,6 +119,12 @@ void ListModel::request() QObject::connect(netJob, &NetJob::failed, this, &ListModel::requestFailed); } +void ListModel::abortRequest() +{ + m_aborted = jobPtr->abort(); + jobPtr.reset(); +} + void ListModel::requestFinished() { jobPtr.reset(); @@ -162,6 +170,9 @@ void ListModel::requestPack() void ListModel::packRequestFinished() { + if (!jobPtr || m_aborted) + return; + jobPtr.reset(); remainingPacks.removeOne(currentPack); diff --git a/launcher/ui/pages/modplatform/ftb/FtbListModel.h b/launcher/ui/pages/modplatform/ftb/FtbListModel.h index 314cb789..d7a120f0 100644 --- a/launcher/ui/pages/modplatform/ftb/FtbListModel.h +++ b/launcher/ui/pages/modplatform/ftb/FtbListModel.h @@ -47,9 +47,13 @@ public: QVariant data(const QModelIndex &index, int role) const override; void request(); + void abortRequest(); void getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback); + [[nodiscard]] bool isMakingRequest() const { return jobPtr.get(); } + [[nodiscard]] bool wasAborted() const { return m_aborted; } + private slots: void requestFinished(); void requestFailed(QString reason); @@ -65,6 +69,8 @@ private: void requestLogo(QString file, QString url); private: + bool m_aborted = false; + QList<ModpacksCH::Modpack> modpacks; LogoMap m_logoMap; diff --git a/launcher/ui/pages/modplatform/ftb/FtbPage.cpp b/launcher/ui/pages/modplatform/ftb/FtbPage.cpp index 34734eaf..b08f3bc4 100644 --- a/launcher/ui/pages/modplatform/ftb/FtbPage.cpp +++ b/launcher/ui/pages/modplatform/ftb/FtbPage.cpp @@ -107,7 +107,7 @@ void FtbPage::retranslate() void FtbPage::openedImpl() { - if(!initialised) + if(!initialised || listModel->wasAborted()) { listModel->request(); initialised = true; @@ -116,6 +116,12 @@ void FtbPage::openedImpl() suggestCurrent(); } +void FtbPage::closedImpl() +{ + if (listModel->isMakingRequest()) + listModel->abortRequest(); +} + void FtbPage::suggestCurrent() { if(!isOpened) diff --git a/launcher/ui/pages/modplatform/ftb/FtbPage.h b/launcher/ui/pages/modplatform/ftb/FtbPage.h index 90c8e7fd..631ae7f5 100644 --- a/launcher/ui/pages/modplatform/ftb/FtbPage.h +++ b/launcher/ui/pages/modplatform/ftb/FtbPage.h @@ -78,6 +78,7 @@ public: void retranslate() override; void openedImpl() override; + void closedImpl() override; bool eventFilter(QObject * watched, QEvent * event) override; diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp index a0e9ab19..e6704eef 100644 --- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp +++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp @@ -321,7 +321,7 @@ void ModpackListModel::searchRequestFailed(QString reason) //: %1 refers to the launcher itself QString("%1 %2") .arg(m_parent->displayName()) - .arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_NAME))); + .arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_DISPLAYNAME))); } jobPtr.reset(); |