feat: track capabilities of application

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2022-05-29 21:18:34 +02:00
parent 906f26698b
commit 4103948132
9 changed files with 47 additions and 27 deletions

View File

@ -4,6 +4,7 @@
#include <icons/IconList.h>
#include <InstanceList.h>
#include "Application.h"
#include "ProgressDialog.h"
#include "ReviewMessageBox.h"
@ -100,13 +101,13 @@ void ModDownloadDialog::accept()
QList<BasePage *> ModDownloadDialog::getPages()
{
modrinthPage = new ModrinthModPage(this, m_instance);
flameModPage = new FlameModPage(this, m_instance);
return
{
modrinthPage,
flameModPage
};
QList<BasePage *> pages;
pages.append(new ModrinthModPage(this, m_instance));
if (APPLICATION->currentCapabilities() & Application::SupportsFlame)
pages.append(new FlameModPage(this, m_instance));
return pages;
}
void ModDownloadDialog::addSelectedMod(const QString& name, ModDownloadTask* task)

View File

@ -48,9 +48,6 @@ private:
QDialogButtonBox * m_buttons = nullptr;
QVBoxLayout *m_verticalLayout = nullptr;
ModrinthModPage *modrinthPage = nullptr;
FlameModPage *flameModPage = nullptr;
QHash<QString, ModDownloadTask*> modTask;
BaseInstance *m_instance;
};

View File

@ -124,20 +124,21 @@ void NewInstanceDialog::accept()
QList<BasePage *> NewInstanceDialog::getPages()
{
QList<BasePage *> pages;
importPage = new ImportPage(this);
flamePage = new FlamePage(this);
auto technicPage = new TechnicPage(this);
return
{
new VanillaPage(this),
importPage,
new AtlPage(this),
flamePage,
new FtbPage(this),
new LegacyFTB::Page(this),
new ModrinthPage(this),
technicPage
};
pages.append(new VanillaPage(this));
pages.append(importPage);
pages.append(new AtlPage(this));
if (APPLICATION->currentCapabilities() & Application::SupportsFlame)
pages.append(new FlamePage(this));
pages.append(new FtbPage(this));
pages.append(new LegacyFTB::Page(this));
pages.append(new ModrinthPage(this));
pages.append(new TechnicPage(this));
return pages;
}
QString NewInstanceDialog::dialogTitle()

View File

@ -69,7 +69,6 @@ private:
QString InstIconKey;
ImportPage *importPage = nullptr;
FlamePage *flamePage = nullptr;
std::unique_ptr<InstanceTask> creationTask;
bool importIcon = false;

View File

@ -96,7 +96,7 @@ AccountListPage::AccountListPage(QWidget *parent)
updateButtonStates();
// Xbox authentication won't work without a client identifier, so disable the button if it is missing
if (APPLICATION->getMSAClientID().isEmpty()) {
if (APPLICATION->currentCapabilities() & Application::SupportsMSA) {
ui->actionAddMicrosoft->setVisible(false);
ui->actionAddMicrosoft->setToolTip(tr("No Microsoft Authentication client ID was set."));
}