NOISSUE Some happy little refactors

This commit is contained in:
Petr Mrázek
2021-11-20 16:22:22 +01:00
parent eafeb64dec
commit 0c861db7a2
142 changed files with 812 additions and 694 deletions

View File

@ -1,7 +1,7 @@
#include "ImportPage.h"
#include "ui_ImportPage.h"
#include "Launcher.h"
#include "Application.h"
#include "dialogs/NewInstanceDialog.h"
#include <QFileDialog>
#include <QValidator>

View File

@ -18,7 +18,7 @@
#include <QWidget>
#include "pages/BasePage.h"
#include <Launcher.h>
#include <Application.h>
#include "tasks/Task.h"
namespace Ui
@ -41,7 +41,7 @@ public:
}
virtual QIcon icon() const override
{
return LAUNCHER->getThemedIcon("viewfolder");
return APPLICATION->getThemedIcon("viewfolder");
}
virtual QString id() const override
{

View File

@ -1,7 +1,7 @@
#include "VanillaPage.h"
#include "ui_VanillaPage.h"
#include "Launcher.h"
#include "Application.h"
#include <meta/Index.h>
#include <meta/VersionList.h>
@ -31,7 +31,7 @@ void VanillaPage::openedImpl()
{
if(!initialized)
{
auto vlist = ENV.metadataIndex()->get("net.minecraft");
auto vlist = ENV->metadataIndex()->get("net.minecraft");
ui->versionList->initialize(vlist.get());
initialized = true;
}

View File

@ -18,7 +18,7 @@
#include <QWidget>
#include "pages/BasePage.h"
#include <Launcher.h>
#include <Application.h>
#include "tasks/Task.h"
namespace Ui
@ -41,7 +41,7 @@ public:
}
virtual QIcon icon() const override
{
return LAUNCHER->getThemedIcon("minecraft");
return APPLICATION->getThemedIcon("minecraft");
}
virtual QString id() const override
{

View File

@ -1,7 +1,7 @@
#include "AtlListModel.h"
#include <BuildConfig.h>
#include <Launcher.h>
#include <Application.h>
#include <Env.h>
#include <Json.h>
@ -48,7 +48,7 @@ QVariant ListModel::data(const QModelIndex &index, int role) const
{
return (m_logoMap.value(pack.safeName));
}
auto icon = LAUNCHER->getThemedIcon("atlauncher-placeholder");
auto icon = APPLICATION->getThemedIcon("atlauncher-placeholder");
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(pack.safeName.toLower());
((ListModel *)this)->requestLogo(pack.safeName, url);
@ -134,7 +134,7 @@ void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallbac
{
if(m_logoMap.contains(logo))
{
callback(ENV.metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
callback(ENV->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
}
else
{
@ -167,7 +167,7 @@ void ListModel::requestLogo(QString file, QString url)
return;
}
MetaEntryPtr entry = ENV.metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
MetaEntryPtr entry = ENV->metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
NetJob *job = new NetJob(QString("ATLauncher Icon Download %1").arg(file));
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));

View File

@ -133,7 +133,7 @@ QVector<QString> AtlPage::chooseOptionalMods(QVector<ATLauncher::VersionMod> mod
}
QString AtlPage::chooseVersion(Meta::VersionListPtr vlist, QString minecraftVersion) {
VersionSelectDialog vselect(vlist.get(), "Choose Version", LAUNCHER->activeWindow(), false);
VersionSelectDialog vselect(vlist.get(), "Choose Version", APPLICATION->activeWindow(), false);
if (minecraftVersion != Q_NULLPTR) {
vselect.setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion);
vselect.setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion));

View File

@ -21,7 +21,7 @@
#include <QWidget>
#include <modplatform/atlauncher/ATLPackInstallTask.h>
#include "Launcher.h"
#include "Application.h"
#include "pages/BasePage.h"
#include "tasks/Task.h"
@ -45,7 +45,7 @@ public:
}
virtual QIcon icon() const override
{
return LAUNCHER->getThemedIcon("atlauncher");
return APPLICATION->getThemedIcon("atlauncher");
}
virtual QString id() const override
{

View File

@ -1,5 +1,5 @@
#include "FlameModel.h"
#include "Launcher.h"
#include "Application.h"
#include <Json.h>
#include <MMCStrings.h>
@ -62,7 +62,7 @@ QVariant ListModel::data(const QModelIndex &index, int role) const
{
return (m_logoMap.value(pack.logoName));
}
QIcon icon = LAUNCHER->getThemedIcon("screenshot-placeholder");
QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
((ListModel *)this)->requestLogo(pack.logoName, pack.logoUrl);
return icon;
}
@ -100,7 +100,7 @@ void ListModel::requestLogo(QString logo, QString url)
return;
}
MetaEntryPtr entry = ENV.metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
MetaEntryPtr entry = ENV->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
NetJob *job = new NetJob(QString("Flame Icon Download %1").arg(logo));
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));
@ -128,7 +128,7 @@ void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallbac
{
if(m_logoMap.contains(logo))
{
callback(ENV.metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
callback(ENV->metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
}
else
{

View File

@ -1,7 +1,7 @@
#include "FlamePage.h"
#include "ui_FlamePage.h"
#include "Launcher.h"
#include "Application.h"
#include <Json.h>
#include "dialogs/NewInstanceDialog.h"
#include <InstanceImportTask.h>

View File

@ -18,7 +18,7 @@
#include <QWidget>
#include "pages/BasePage.h"
#include <Launcher.h>
#include <Application.h>
#include "tasks/Task.h"
#include <modplatform/flame/FlamePackIndex.h>
@ -46,7 +46,7 @@ public:
}
virtual QIcon icon() const override
{
return LAUNCHER->getThemedIcon("flame");
return APPLICATION->getThemedIcon("flame");
}
virtual QString id() const override
{

View File

@ -2,7 +2,7 @@
#include "BuildConfig.h"
#include "Env.h"
#include "Launcher.h"
#include "Application.h"
#include "Json.h"
#include <QPainter>
@ -46,7 +46,7 @@ QVariant ListModel::data(const QModelIndex &index, int role) const
}
else if(role == Qt::DecorationRole)
{
QIcon placeholder = LAUNCHER->getThemedIcon("screenshot-placeholder");
QIcon placeholder = APPLICATION->getThemedIcon("screenshot-placeholder");
auto iter = m_logoMap.find(pack.name);
if (iter != m_logoMap.end()) {
@ -78,7 +78,7 @@ void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallbac
{
if(m_logoMap.contains(logo))
{
callback(ENV.metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
callback(ENV->metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
}
else
{
@ -252,7 +252,7 @@ void ListModel::requestLogo(QString logo, QString url)
return;
}
MetaEntryPtr entry = ENV.metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
MetaEntryPtr entry = ENV->metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0)));
bool stale = entry->isStale();

View File

@ -20,7 +20,7 @@
#include <QWidget>
#include "Launcher.h"
#include "Application.h"
#include "pages/BasePage.h"
#include "tasks/Task.h"
@ -44,7 +44,7 @@ public:
}
virtual QIcon icon() const override
{
return LAUNCHER->getThemedIcon("ftb_logo");
return APPLICATION->getThemedIcon("ftb_logo");
}
virtual QString id() const override
{

View File

@ -1,5 +1,5 @@
#include "ListModel.h"
#include "Launcher.h"
#include "Application.h"
#include <MMCStrings.h>
#include <Version.h>
@ -130,7 +130,7 @@ QVariant ListModel::data(const QModelIndex &index, int role) const
{
return (m_logoMap.value(pack.logo));
}
QIcon icon = LAUNCHER->getThemedIcon("screenshot-placeholder");
QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
((ListModel *)this)->requestLogo(pack.logo);
return icon;
}
@ -216,7 +216,7 @@ void ListModel::requestLogo(QString file)
return;
}
MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
MetaEntryPtr entry = ENV->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file));
job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry));
@ -244,7 +244,7 @@ void ListModel::getLogo(const QString &logo, LogoCallback callback)
{
if(m_logoMap.contains(logo))
{
callback(ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
callback(ENV->metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath());
}
else
{

View File

@ -3,7 +3,7 @@
#include <QInputDialog>
#include "Launcher.h"
#include "Application.h"
#include "dialogs/CustomMessageBox.h"
#include "dialogs/NewInstanceDialog.h"
#include "modplatform/legacy_ftb/PackFetchTask.h"

View File

@ -20,7 +20,7 @@
#include <QTextBrowser>
#include "pages/BasePage.h"
#include <Launcher.h>
#include <Application.h>
#include "tasks/Task.h"
#include "modplatform/legacy_ftb/PackHelpers.h"
#include "modplatform/legacy_ftb/PackFetchTask.h"
@ -54,7 +54,7 @@ public:
}
QIcon icon() const override
{
return LAUNCHER->getThemedIcon("ftb_logo");
return APPLICATION->getThemedIcon("ftb_logo");
}
QString id() const override
{

View File

@ -15,7 +15,7 @@
#include "TechnicModel.h"
#include "Env.h"
#include "Launcher.h"
#include "Application.h"
#include "Json.h"
#include <QIcon>
@ -47,7 +47,7 @@ QVariant Technic::ListModel::data(const QModelIndex& index, int role) const
{
return (m_logoMap.value(pack.logoName));
}
QIcon icon = LAUNCHER->getThemedIcon("screenshot-placeholder");
QIcon icon = APPLICATION->getThemedIcon("screenshot-placeholder");
((ListModel *)this)->requestLogo(pack.logoName, pack.logoUrl);
return icon;
}
@ -163,7 +163,7 @@ void Technic::ListModel::getLogo(const QString& logo, const QString& logoUrl, Te
{
if(m_logoMap.contains(logo))
{
callback(ENV.metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo))->getFullPath());
callback(ENV->metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo))->getFullPath());
}
else
{
@ -216,7 +216,7 @@ void Technic::ListModel::requestLogo(QString logo, QString url)
return;
}
MetaEntryPtr entry = ENV.metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo));
MetaEntryPtr entry = ENV->metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo));
NetJob *job = new NetJob(QString("Technic Icon Download %1").arg(logo));
job->addNetAction(Net::Download::makeCached(QUrl(url), entry));

View File

@ -16,7 +16,7 @@
#include "TechnicPage.h"
#include "ui_TechnicPage.h"
#include "Launcher.h"
#include "Application.h"
#include "dialogs/NewInstanceDialog.h"
#include "TechnicModel.h"
#include <QKeyEvent>

View File

@ -18,7 +18,7 @@
#include <QWidget>
#include "pages/BasePage.h"
#include <Launcher.h>
#include <Application.h>
#include "tasks/Task.h"
#include "TechnicData.h"
@ -46,7 +46,7 @@ public:
}
virtual QIcon icon() const override
{
return LAUNCHER->getThemedIcon("technic");
return APPLICATION->getThemedIcon("technic");
}
virtual QString id() const override
{