chore(ManagedPackPage): format and add headers
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
74f7039abf
commit
c5c426ecbc
@ -1,3 +1,7 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2022 flow <flowlnlnln@gmail.com>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
#include "ManagedPackPage.h"
|
#include "ManagedPackPage.h"
|
||||||
#include "ui_ManagedPackPage.h"
|
#include "ui_ManagedPackPage.h"
|
||||||
|
|
||||||
@ -79,6 +83,8 @@ QString ManagedPackPage::displayName() const
|
|||||||
auto type = m_inst->getManagedPackType();
|
auto type = m_inst->getManagedPackType();
|
||||||
if (type.isEmpty())
|
if (type.isEmpty())
|
||||||
return {};
|
return {};
|
||||||
|
if (type == "flame")
|
||||||
|
type = "CurseForge";
|
||||||
return type.replace(0, 1, type[0].toUpper());
|
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);
|
connect(ui->updateButton, &QPushButton::pressed, this, &ModrinthManagedPackPage::update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MODRINTH
|
||||||
|
|
||||||
void ModrinthManagedPackPage::parseManagedPack()
|
void ModrinthManagedPackPage::parseManagedPack()
|
||||||
{
|
{
|
||||||
qDebug() << "Parsing Modrinth pack";
|
qDebug() << "Parsing Modrinth pack";
|
||||||
@ -271,6 +279,8 @@ void ModrinthManagedPackPage::update()
|
|||||||
m_instance_window->close();
|
m_instance_window->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FLAME
|
||||||
|
|
||||||
FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent)
|
FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* instance_window, QWidget* parent)
|
||||||
: ManagedPackPage(inst, instance_window, parent)
|
: ManagedPackPage(inst, instance_window, parent)
|
||||||
{
|
{
|
||||||
@ -279,23 +289,23 @@ FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* i
|
|||||||
connect(ui->updateButton, &QPushButton::pressed, this, &FlameManagedPackPage::update);
|
connect(ui->updateButton, &QPushButton::pressed, this, &FlameManagedPackPage::update);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlameManagedPackPage::parseManagedPack() {
|
void FlameManagedPackPage::parseManagedPack()
|
||||||
|
{
|
||||||
qDebug() << "Parsing Flame pack";
|
qDebug() << "Parsing Flame pack";
|
||||||
|
|
||||||
// We need to tell the user to redownload the pack, since we didn't save the required info previously
|
// We need to tell the user to redownload the pack, since we didn't save the required info previously
|
||||||
if (m_inst->getManagedPackID().isEmpty()) {
|
if (m_inst->getManagedPackID().isEmpty()) {
|
||||||
setFailState();
|
setFailState();
|
||||||
QString message = tr(
|
QString message =
|
||||||
"<h1>Hey there!</h1>"
|
tr("<h1>Hey there!</h1>"
|
||||||
"<h4>"
|
"<h4>"
|
||||||
"It seems like your Pack ID is null. This is because of a bug in older versions of the launcher.<br/>"
|
"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/>"
|
"Unfortunately, we can't do the proper API requests without this information.<br/>"
|
||||||
"<br/>"
|
"<br/>"
|
||||||
"So, in order for this feature to work, you will need to re-download the modpack from the built-in downloader.<br/>"
|
"So, in order for this feature to work, you will need to re-download the modpack from the built-in downloader.<br/>"
|
||||||
"<br/>"
|
"<br/>"
|
||||||
"Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!"
|
"Don't worry though, it will ask you to update this instance instead, so you'll not lose this instance!"
|
||||||
"</h4>"
|
"</h4>");
|
||||||
);
|
|
||||||
|
|
||||||
ui->changelogTextBrowser->setHtml(message);
|
ui->changelogTextBrowser->setHtml(message);
|
||||||
return;
|
return;
|
||||||
@ -327,7 +337,7 @@ void FlameManagedPackPage::parseManagedPack() {
|
|||||||
Flame::loadIndexedPackVersions(m_pack, data);
|
Flame::loadIndexedPackVersions(m_pack, data);
|
||||||
} catch (const JSONValidationError& e) {
|
} catch (const JSONValidationError& e) {
|
||||||
qDebug() << *response;
|
qDebug() << *response;
|
||||||
qWarning() << "Error while reading modrinth modpack version: " << e.cause();
|
qWarning() << "Error while reading flame modpack version: " << e.cause();
|
||||||
|
|
||||||
setFailState();
|
setFailState();
|
||||||
return;
|
return;
|
||||||
@ -365,6 +375,7 @@ void FlameManagedPackPage::parseManagedPack() {
|
|||||||
|
|
||||||
QString FlameManagedPackPage::url() const
|
QString FlameManagedPackPage::url() const
|
||||||
{
|
{
|
||||||
|
// FIXME: We should display the websiteUrl field, but this requires doing the API request first :(
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2022 flow <flowlnlnln@gmail.com>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "BaseInstance.h"
|
#include "BaseInstance.h"
|
||||||
@ -44,7 +48,7 @@ class ManagedPackPage : public QWidget, public BasePage {
|
|||||||
|
|
||||||
/** Gets the necessary information about the managed pack, such as
|
/** Gets the necessary information about the managed pack, such as
|
||||||
* available versions*/
|
* available versions*/
|
||||||
virtual void parseManagedPack() {};
|
virtual void parseManagedPack(){};
|
||||||
|
|
||||||
/** URL of the managed pack.
|
/** URL of the managed pack.
|
||||||
* Not the version-specific one.
|
* Not the version-specific one.
|
||||||
@ -58,7 +62,7 @@ class ManagedPackPage : public QWidget, public BasePage {
|
|||||||
*/
|
*/
|
||||||
virtual void suggestVersion();
|
virtual void suggestVersion();
|
||||||
|
|
||||||
virtual void update() {};
|
virtual void update(){};
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
/** Does the necessary UI changes for when something failed.
|
/** Does the necessary UI changes for when something failed.
|
||||||
@ -94,7 +98,9 @@ class GenericManagedPackPage final : public ManagedPackPage {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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;
|
~GenericManagedPackPage() override = default;
|
||||||
|
|
||||||
// TODO: We may want to show this page with some useful info at some point.
|
// TODO: We may want to show this page with some useful info at some point.
|
||||||
|
Loading…
Reference in New Issue
Block a user