diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp index 0b141a1f..cf782606 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.cpp +++ b/launcher/ui/pages/instance/ManagedPackPage.cpp @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2022 flow +// +// SPDX-License-Identifier: GPL-3.0-only + #include "ManagedPackPage.h" #include "ui_ManagedPackPage.h" @@ -79,6 +83,8 @@ QString ManagedPackPage::displayName() const auto type = m_inst->getManagedPackType(); if (type.isEmpty()) return {}; + if (type == "flame") + type = "CurseForge"; return type.replace(0, 1, type[0].toUpper()); } @@ -159,6 +165,8 @@ ModrinthManagedPackPage::ModrinthManagedPackPage(BaseInstance* inst, InstanceWin connect(ui->updateButton, &QPushButton::pressed, this, &ModrinthManagedPackPage::update); } +// MODRINTH + void ModrinthManagedPackPage::parseManagedPack() { qDebug() << "Parsing Modrinth pack"; @@ -271,6 +279,8 @@ void ModrinthManagedPackPage::update() m_instance_window->close(); } +// FLAME + FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent) : ManagedPackPage(inst, instance_window, parent) { @@ -279,23 +289,23 @@ FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* i connect(ui->updateButton, &QPushButton::pressed, this, &FlameManagedPackPage::update); } -void FlameManagedPackPage::parseManagedPack() { +void FlameManagedPackPage::parseManagedPack() +{ qDebug() << "Parsing Flame pack"; // We need to tell the user to redownload the pack, since we didn't save the required info previously if (m_inst->getManagedPackID().isEmpty()) { setFailState(); - QString message = tr( - "

Hey there!

" - "

" - "It seems like your Pack ID is null. This is because of a bug in older versions of the launcher.
" - "Unfortunately, we can't do the proper API requests without this information.
" - "
" - "So, in order for this feature to work, you will need to re-download the modpack from the built-in downloader.
" - "
" - "Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!" - "

" - ); + QString message = + tr("

Hey there!

" + "

" + "It seems like your Pack ID is null. This is because of a bug in older versions of the launcher.
" + "Unfortunately, we can't do the proper API requests without this information.
" + "
" + "So, in order for this feature to work, you will need to re-download the modpack from the built-in downloader.
" + "
" + "Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!" + "

"); ui->changelogTextBrowser->setHtml(message); return; @@ -327,7 +337,7 @@ void FlameManagedPackPage::parseManagedPack() { Flame::loadIndexedPackVersions(m_pack, data); } catch (const JSONValidationError& e) { qDebug() << *response; - qWarning() << "Error while reading modrinth modpack version: " << e.cause(); + qWarning() << "Error while reading flame modpack version: " << e.cause(); setFailState(); return; @@ -365,6 +375,7 @@ void FlameManagedPackPage::parseManagedPack() { QString FlameManagedPackPage::url() const { + // FIXME: We should display the websiteUrl field, but this requires doing the API request first :( return {}; } diff --git a/launcher/ui/pages/instance/ManagedPackPage.h b/launcher/ui/pages/instance/ManagedPackPage.h index 9ad5e34a..282a8111 100644 --- a/launcher/ui/pages/instance/ManagedPackPage.h +++ b/launcher/ui/pages/instance/ManagedPackPage.h @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2022 flow +// +// SPDX-License-Identifier: GPL-3.0-only + #pragma once #include "BaseInstance.h" @@ -44,7 +48,7 @@ class ManagedPackPage : public QWidget, public BasePage { /** Gets the necessary information about the managed pack, such as * available versions*/ - virtual void parseManagedPack() {}; + virtual void parseManagedPack(){}; /** URL of the managed pack. * Not the version-specific one. @@ -58,7 +62,7 @@ class ManagedPackPage : public QWidget, public BasePage { */ virtual void suggestVersion(); - virtual void update() {}; + virtual void update(){}; protected slots: /** Does the necessary UI changes for when something failed. @@ -94,7 +98,9 @@ class GenericManagedPackPage final : public ManagedPackPage { Q_OBJECT public: - GenericManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent = nullptr) : ManagedPackPage(inst, instance_window, parent) {} + GenericManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent = nullptr) + : ManagedPackPage(inst, instance_window, parent) + {} ~GenericManagedPackPage() override = default; // TODO: We may want to show this page with some useful info at some point.