aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-11-12 13:27:09 -0300
committerflow <flowlnlnln@gmail.com>2022-12-06 17:00:33 -0300
commitc5c426ecbc5811fb2a5c0ea8d22e65c43d7b9ff2 (patch)
tree7d5d49709255d77047d83f027c5de1e665e0f089
parent74f7039abfad08c79e860a1922efa29912e04e1c (diff)
downloadPrismLauncher-c5c426ecbc5811fb2a5c0ea8d22e65c43d7b9ff2.tar.gz
PrismLauncher-c5c426ecbc5811fb2a5c0ea8d22e65c43d7b9ff2.tar.bz2
PrismLauncher-c5c426ecbc5811fb2a5c0ea8d22e65c43d7b9ff2.zip
chore(ManagedPackPage): format and add headers
Signed-off-by: flow <flowlnlnln@gmail.com>
-rw-r--r--launcher/ui/pages/instance/ManagedPackPage.cpp37
-rw-r--r--launcher/ui/pages/instance/ManagedPackPage.h12
2 files changed, 33 insertions, 16 deletions
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 <flowlnlnln@gmail.com>
+//
+// 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(
- "<h1>Hey there!</h1>"
- "<h4>"
- "It seems like your Pack ID is null. This is because of a bug in older versions of the launcher.<br/>"
- "Unfortunately, we can't do the proper API requests without this information.<br/>"
- "<br/>"
- "So, in order for this feature to work, you will need to re-download the modpack from the built-in downloader.<br/>"
- "<br/>"
- "Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!"
- "</h4>"
- );
+ QString message =
+ tr("<h1>Hey there!</h1>"
+ "<h4>"
+ "It seems like your Pack ID is null. This is because of a bug in older versions of the launcher.<br/>"
+ "Unfortunately, we can't do the proper API requests without this information.<br/>"
+ "<br/>"
+ "So, in order for this feature to work, you will need to re-download the modpack from the built-in downloader.<br/>"
+ "<br/>"
+ "Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!"
+ "</h4>");
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 <flowlnlnln@gmail.com>
+//
+// 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.