diff options
Diffstat (limited to 'launcher/pages')
55 files changed, 184 insertions, 177 deletions
diff --git a/launcher/pages/global/AccountListPage.cpp b/launcher/pages/global/AccountListPage.cpp index bf5ab633..d0138dcc 100644 --- a/launcher/pages/global/AccountListPage.cpp +++ b/launcher/pages/global/AccountListPage.cpp @@ -32,7 +32,7 @@ #include "minecraft/auth/AccountTask.h" #include "minecraft/services/SkinDelete.h" -#include "Launcher.h" +#include "Application.h" #include "BuildConfig.h" #include <dialogs/MSALoginDialog.h> @@ -50,7 +50,7 @@ AccountListPage::AccountListPage(QWidget *parent) ui->listView->setEmptyMode(VersionListView::String); ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); - m_accounts = LAUNCHER->accounts(); + m_accounts = APPLICATION->accounts(); ui->listView->setModel(m_accounts.get()); ui->listView->header()->setSectionResizeMode(0, QHeaderView::Stretch); @@ -68,7 +68,8 @@ AccountListPage::AccountListPage(QWidget *parent) connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu); connect(m_accounts.get(), &AccountList::listChanged, this, &AccountListPage::listChanged); - connect(m_accounts.get(), &AccountList::activeAccountChanged, this, &AccountListPage::listChanged); + connect(m_accounts.get(), &AccountList::listActivityChanged, this, &AccountListPage::listChanged); + connect(m_accounts.get(), &AccountList::defaultAccountChanged, this, &AccountListPage::listChanged); updateButtonStates(); @@ -117,11 +118,11 @@ void AccountListPage::on_actionAddMojang_triggered() tr("Please enter your Mojang account email and password to add your account.") ); - if (account != nullptr) + if (account) { m_accounts->addAccount(account); if (m_accounts->count() == 1) { - m_accounts->setActiveAccount(account); + m_accounts->setDefaultAccount(account); } } } @@ -145,11 +146,11 @@ void AccountListPage::on_actionAddMicrosoft_triggered() tr("Please enter your Mojang account email and password to add your account.") ); - if (account != nullptr) + if (account) { m_accounts->addAccount(account); if (m_accounts->count() == 1) { - m_accounts->setActiveAccount(account); + m_accounts->setDefaultAccount(account); } } } @@ -187,27 +188,34 @@ void AccountListPage::on_actionSetDefault_triggered() { QModelIndex selected = selection.first(); MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>(); - m_accounts->setActiveAccount(account); + m_accounts->setDefaultAccount(account); } } void AccountListPage::on_actionNoDefault_triggered() { - m_accounts->setActiveAccount(nullptr); + m_accounts->setDefaultAccount(nullptr); } void AccountListPage::updateButtonStates() { // If there is no selection, disable buttons that require something selected. QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + bool hasSelection = selection.size() > 0; + bool accountIsReady = false; + if (hasSelection) + { + QModelIndex selected = selection.first(); + MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>(); + accountIsReady = !account->isActive(); + } + ui->actionRemove->setEnabled(accountIsReady); + ui->actionSetDefault->setEnabled(accountIsReady); + ui->actionUploadSkin->setEnabled(accountIsReady); + ui->actionDeleteSkin->setEnabled(accountIsReady); + ui->actionRefresh->setEnabled(accountIsReady); - ui->actionRemove->setEnabled(selection.size() > 0); - ui->actionSetDefault->setEnabled(selection.size() > 0); - ui->actionUploadSkin->setEnabled(selection.size() > 0); - ui->actionDeleteSkin->setEnabled(selection.size() > 0); - ui->actionRefresh->setEnabled(selection.size() > 0); - - if(m_accounts->activeAccount().get() == nullptr) { + if(m_accounts->defaultAccount().get() == nullptr) { ui->actionNoDefault->setEnabled(false); ui->actionNoDefault->setChecked(true); } @@ -215,7 +223,6 @@ void AccountListPage::updateButtonStates() ui->actionNoDefault->setEnabled(true); ui->actionNoDefault->setChecked(false); } - } void AccountListPage::on_actionUploadSkin_triggered() diff --git a/launcher/pages/global/AccountListPage.h b/launcher/pages/global/AccountListPage.h index ee81acd1..eb131ea8 100644 --- a/launcher/pages/global/AccountListPage.h +++ b/launcher/pages/global/AccountListPage.h @@ -21,7 +21,7 @@ #include "pages/BasePage.h" #include "minecraft/auth/AccountList.h" -#include "Launcher.h" +#include "Application.h" namespace Ui { @@ -43,10 +43,10 @@ public: } QIcon icon() const override { - auto icon = LAUNCHER->getThemedIcon("accounts"); + auto icon = APPLICATION->getThemedIcon("accounts"); if(icon.isNull()) { - icon = LAUNCHER->getThemedIcon("noaccount"); + icon = APPLICATION->getThemedIcon("noaccount"); } return icon; } @@ -80,6 +80,6 @@ protected slots: private: void changeEvent(QEvent * event) override; QMenu * createPopupMenu() override; - std::shared_ptr<AccountList> m_accounts; + shared_qobject_ptr<AccountList> m_accounts; Ui::AccountListPage *ui; }; diff --git a/launcher/pages/global/CustomCommandsPage.cpp b/launcher/pages/global/CustomCommandsPage.cpp index 8a5c3445..8541e3c1 100644 --- a/launcher/pages/global/CustomCommandsPage.cpp +++ b/launcher/pages/global/CustomCommandsPage.cpp @@ -32,7 +32,7 @@ bool CustomCommandsPage::apply() void CustomCommandsPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); s->set("PreLaunchCommand", commands->prelaunchCommand()); s->set("WrapperCommand", commands->wrapperCommand()); s->set("PostExitCommand", commands->postexitCommand()); @@ -40,7 +40,7 @@ void CustomCommandsPage::applySettings() void CustomCommandsPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); commands->initialize( false, true, diff --git a/launcher/pages/global/CustomCommandsPage.h b/launcher/pages/global/CustomCommandsPage.h index ac69a997..f81b192a 100644 --- a/launcher/pages/global/CustomCommandsPage.h +++ b/launcher/pages/global/CustomCommandsPage.h @@ -19,7 +19,7 @@ #include <QDialog> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> #include "widgets/CustomCommands.h" class CustomCommandsPage : public QWidget, public BasePage @@ -36,7 +36,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("custom-commands"); + return APPLICATION->getThemedIcon("custom-commands"); } QString id() const override { diff --git a/launcher/pages/global/ExternalToolsPage.cpp b/launcher/pages/global/ExternalToolsPage.cpp index 7e1a915f..41d900aa 100644 --- a/launcher/pages/global/ExternalToolsPage.cpp +++ b/launcher/pages/global/ExternalToolsPage.cpp @@ -24,7 +24,7 @@ #include "settings/SettingsObject.h" #include "tools/BaseProfiler.h" #include <FileSystem.h> -#include "Launcher.h" +#include "Application.h" #include <tools/MCEditTool.h> ExternalToolsPage::ExternalToolsPage(QWidget *parent) : @@ -51,7 +51,7 @@ ExternalToolsPage::~ExternalToolsPage() void ExternalToolsPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString()); ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString()); ui->mceditPathEdit->setText(s->get("MCEditPath").toString()); @@ -61,7 +61,7 @@ void ExternalToolsPage::loadSettings() } void ExternalToolsPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); s->set("JProfilerPath", ui->jprofilerPathEdit->text()); s->set("JVisualVMPath", ui->jvisualvmPathEdit->text()); @@ -93,7 +93,7 @@ void ExternalToolsPage::on_jprofilerPathBtn_clicked() break; } QString cooked_dir = FS::NormalizePath(raw_dir); - if (!LAUNCHER->profilers()["jprofiler"]->check(cooked_dir, &error)) + if (!APPLICATION->profilers()["jprofiler"]->check(cooked_dir, &error)) { QMessageBox::critical(this, tr("Error"), tr("Error while checking JProfiler install:\n%1").arg(error)); continue; @@ -108,7 +108,7 @@ void ExternalToolsPage::on_jprofilerPathBtn_clicked() void ExternalToolsPage::on_jprofilerCheckBtn_clicked() { QString error; - if (!LAUNCHER->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error)) + if (!APPLICATION->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error)) { QMessageBox::critical(this, tr("Error"), tr("Error while checking JProfiler install:\n%1").arg(error)); } @@ -130,7 +130,7 @@ void ExternalToolsPage::on_jvisualvmPathBtn_clicked() break; } QString cooked_dir = FS::NormalizePath(raw_dir); - if (!LAUNCHER->profilers()["jvisualvm"]->check(cooked_dir, &error)) + if (!APPLICATION->profilers()["jvisualvm"]->check(cooked_dir, &error)) { QMessageBox::critical(this, tr("Error"), tr("Error while checking JVisualVM install:\n%1").arg(error)); continue; @@ -145,7 +145,7 @@ void ExternalToolsPage::on_jvisualvmPathBtn_clicked() void ExternalToolsPage::on_jvisualvmCheckBtn_clicked() { QString error; - if (!LAUNCHER->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error)) + if (!APPLICATION->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error)) { QMessageBox::critical(this, tr("Error"), tr("Error while checking JVisualVM install:\n%1").arg(error)); } @@ -171,7 +171,7 @@ void ExternalToolsPage::on_mceditPathBtn_clicked() break; } QString cooked_dir = FS::NormalizePath(raw_dir); - if (!LAUNCHER->mcedit()->check(cooked_dir, error)) + if (!APPLICATION->mcedit()->check(cooked_dir, error)) { QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error)); continue; @@ -186,7 +186,7 @@ void ExternalToolsPage::on_mceditPathBtn_clicked() void ExternalToolsPage::on_mceditCheckBtn_clicked() { QString error; - if (!LAUNCHER->mcedit()->check(ui->mceditPathEdit->text(), error)) + if (!APPLICATION->mcedit()->check(ui->mceditPathEdit->text(), error)) { QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error)); } diff --git a/launcher/pages/global/ExternalToolsPage.h b/launcher/pages/global/ExternalToolsPage.h index 1d99273a..9571ce75 100644 --- a/launcher/pages/global/ExternalToolsPage.h +++ b/launcher/pages/global/ExternalToolsPage.h @@ -18,7 +18,7 @@ #include <QWidget> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { class ExternalToolsPage; @@ -38,10 +38,10 @@ public: } QIcon icon() const override { - auto icon = LAUNCHER->getThemedIcon("externaltools"); + auto icon = APPLICATION->getThemedIcon("externaltools"); if(icon.isNull()) { - icon = LAUNCHER->getThemedIcon("loadermods"); + icon = APPLICATION->getThemedIcon("loadermods"); } return icon; } diff --git a/launcher/pages/global/JavaPage.cpp b/launcher/pages/global/JavaPage.cpp index dd158fcd..fe545636 100644 --- a/launcher/pages/global/JavaPage.cpp +++ b/launcher/pages/global/JavaPage.cpp @@ -29,7 +29,7 @@ #include "settings/SettingsObject.h" #include <FileSystem.h> -#include "Launcher.h" +#include "Application.h" #include <sys.h> JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) @@ -55,7 +55,7 @@ bool JavaPage::apply() void JavaPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Memory int min = ui->minMemSpinBox->value(); @@ -79,7 +79,7 @@ void JavaPage::applySettings() } void JavaPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Memory int min = s->get("MinMemAlloc").toInt(); int max = s->get("MaxMemAlloc").toInt(); @@ -104,7 +104,7 @@ void JavaPage::on_javaDetectBtn_clicked() { JavaInstallPtr java; - VersionSelectDialog vselect(LAUNCHER->javalist().get(), tr("Select a Java version"), this, true); + VersionSelectDialog vselect(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); vselect.setResizeOn(2); vselect.exec(); diff --git a/launcher/pages/global/JavaPage.h b/launcher/pages/global/JavaPage.h index 93a586cd..56a1d36b 100644 --- a/launcher/pages/global/JavaPage.h +++ b/launcher/pages/global/JavaPage.h @@ -19,7 +19,7 @@ #include <QDialog> #include "pages/BasePage.h" #include "JavaCommon.h" -#include <Launcher.h> +#include <Application.h> #include <QObjectPtr.h> class SettingsObject; @@ -43,7 +43,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("java"); + return APPLICATION->getThemedIcon("java"); } QString id() const override { diff --git a/launcher/pages/global/LanguagePage.cpp b/launcher/pages/global/LanguagePage.cpp index 409bf7d0..142517db 100644 --- a/launcher/pages/global/LanguagePage.cpp +++ b/launcher/pages/global/LanguagePage.cpp @@ -26,7 +26,7 @@ bool LanguagePage::apply() void LanguagePage::applySettings() { - auto settings = LAUNCHER->settings(); + auto settings = APPLICATION->settings(); QString key = mainWidget->getSelectedLanguageKey(); settings->set("Language", key); } diff --git a/launcher/pages/global/LanguagePage.h b/launcher/pages/global/LanguagePage.h index 22db8f94..c269cefc 100644 --- a/launcher/pages/global/LanguagePage.h +++ b/launcher/pages/global/LanguagePage.h @@ -17,7 +17,7 @@ #include <memory> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> #include <QWidget> class LanguageSelectionWidget; @@ -36,7 +36,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("language"); + return APPLICATION->getThemedIcon("language"); } QString id() const override { diff --git a/launcher/pages/global/LauncherPage.cpp b/launcher/pages/global/LauncherPage.cpp index 5f8d87d8..b77a9e81 100644 --- a/launcher/pages/global/LauncherPage.cpp +++ b/launcher/pages/global/LauncherPage.cpp @@ -25,7 +25,7 @@ #include "settings/SettingsObject.h" #include <FileSystem.h> -#include "Launcher.h" +#include "Application.h" #include "BuildConfig.h" #include "themes/ITheme.h" @@ -53,20 +53,20 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat()); - m_languageModel = LAUNCHER->translations(); + m_languageModel = APPLICATION->translations(); loadSettings(); if(BuildConfig.UPDATER_ENABLED) { - QObject::connect(LAUNCHER->updateChecker().get(), &UpdateChecker::channelListLoaded, this, &LauncherPage::refreshUpdateChannelList); + QObject::connect(APPLICATION->updateChecker().get(), &UpdateChecker::channelListLoaded, this, &LauncherPage::refreshUpdateChannelList); - if (LAUNCHER->updateChecker()->hasChannels()) + if (APPLICATION->updateChecker()->hasChannels()) { refreshUpdateChannelList(); } else { - LAUNCHER->updateChecker()->updateChanList(false); + APPLICATION->updateChecker()->updateChanList(false); } } else @@ -171,7 +171,7 @@ void LauncherPage::refreshUpdateChannelList() QObject::disconnect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateChannelSelectionChanged(int))); - QList<UpdateChecker::ChannelListEntry> channelList = LAUNCHER->updateChecker()->getChannelList(); + QList<UpdateChecker::ChannelListEntry> channelList = APPLICATION->updateChecker()->getChannelList(); ui->updateChannelComboBox->clear(); int selection = -1; for (int i = 0; i < channelList.count(); i++) @@ -216,7 +216,7 @@ void LauncherPage::updateChannelSelectionChanged(int index) void LauncherPage::refreshUpdateChannelDesc() { // Get the channel list. - QList<UpdateChecker::ChannelListEntry> channelList = LAUNCHER->updateChecker()->getChannelList(); + QList<UpdateChecker::ChannelListEntry> channelList = APPLICATION->updateChecker()->getChannelList(); int selectedIndex = ui->updateChannelComboBox->currentIndex(); if (selectedIndex < 0) { @@ -237,7 +237,7 @@ void LauncherPage::refreshUpdateChannelDesc() void LauncherPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); if (ui->resetNotificationsBtn->isChecked()) { @@ -283,7 +283,7 @@ void LauncherPage::applySettings() if(original != s->get("IconTheme")) { - LAUNCHER->setIconTheme(s->get("IconTheme").toString()); + APPLICATION->setIconTheme(s->get("IconTheme").toString()); } auto originalAppTheme = s->get("ApplicationTheme").toString(); @@ -291,7 +291,7 @@ void LauncherPage::applySettings() if(originalAppTheme != newAppTheme) { s->set("ApplicationTheme", newAppTheme); - LAUNCHER->setApplicationTheme(newAppTheme, false); + APPLICATION->setApplicationTheme(newAppTheme, false); } // Console settings @@ -330,7 +330,7 @@ void LauncherPage::applySettings() } void LauncherPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Updates ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool()); m_currentUpdateChannel = s->get("UpdateChannel").toString(); @@ -375,7 +375,7 @@ void LauncherPage::loadSettings() { auto currentTheme = s->get("ApplicationTheme").toString(); - auto themes = LAUNCHER->getValidApplicationThemes(); + auto themes = APPLICATION->getValidApplicationThemes(); int idx = 0; for(auto &theme: themes) { @@ -392,12 +392,12 @@ void LauncherPage::loadSettings() ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool()); ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool()); ui->showConsoleErrorCheck->setChecked(s->get("ShowConsoleOnError").toBool()); - QString fontFamily = LAUNCHER->settings()->get("ConsoleFont").toString(); + QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString(); QFont consoleFont(fontFamily); ui->consoleFont->setCurrentFont(consoleFont); bool conversionOk = true; - int fontSize = LAUNCHER->settings()->get("ConsoleFontSize").toInt(&conversionOk); + int fontSize = APPLICATION->settings()->get("ConsoleFontSize").toInt(&conversionOk); if(!conversionOk) { fontSize = 11; diff --git a/launcher/pages/global/LauncherPage.h b/launcher/pages/global/LauncherPage.h index e622ec48..62a4f84c 100644 --- a/launcher/pages/global/LauncherPage.h +++ b/launcher/pages/global/LauncherPage.h @@ -20,7 +20,7 @@ #include "java/JavaChecker.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> #include "ColorCache.h" #include <translations/TranslationsModel.h> @@ -46,7 +46,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("launcher"); + return APPLICATION->getThemedIcon("launcher"); } QString id() const override { diff --git a/launcher/pages/global/MinecraftPage.cpp b/launcher/pages/global/MinecraftPage.cpp index 342941f4..c763f8ac 100644 --- a/launcher/pages/global/MinecraftPage.cpp +++ b/launcher/pages/global/MinecraftPage.cpp @@ -21,7 +21,7 @@ #include <QTabBar> #include "settings/SettingsObject.h" -#include "Launcher.h" +#include "Application.h" MinecraftPage::MinecraftPage(QWidget *parent) : QWidget(parent), ui(new Ui::MinecraftPage) { @@ -56,7 +56,7 @@ void MinecraftPage::on_maximizedCheckBox_clicked(bool checked) void MinecraftPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Window Size s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked()); @@ -75,7 +75,7 @@ void MinecraftPage::applySettings() void MinecraftPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Window Size ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool()); diff --git a/launcher/pages/global/MinecraftPage.h b/launcher/pages/global/MinecraftPage.h index 0fc6cc8e..96a90f6e 100644 --- a/launcher/pages/global/MinecraftPage.h +++ b/launcher/pages/global/MinecraftPage.h @@ -20,7 +20,7 @@ #include "java/JavaChecker.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> class SettingsObject; @@ -43,7 +43,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("minecraft"); + return APPLICATION->getThemedIcon("minecraft"); } QString id() const override { diff --git a/launcher/pages/global/PasteEEPage.cpp b/launcher/pages/global/PasteEEPage.cpp index 9f7a7efb..4b375d9a 100644 --- a/launcher/pages/global/PasteEEPage.cpp +++ b/launcher/pages/global/PasteEEPage.cpp @@ -23,7 +23,7 @@ #include "settings/SettingsObject.h" #include "tools/BaseProfiler.h" -#include "Launcher.h" +#include "Application.h" PasteEEPage::PasteEEPage(QWidget *parent) : QWidget(parent), @@ -42,7 +42,7 @@ PasteEEPage::~PasteEEPage() void PasteEEPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); QString keyToUse = s->get("PasteEEAPIKey").toString(); if(keyToUse == "multimc") { @@ -57,7 +57,7 @@ void PasteEEPage::loadSettings() void PasteEEPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); QString pasteKeyToUse; if (ui->customButton->isChecked()) diff --git a/launcher/pages/global/PasteEEPage.h b/launcher/pages/global/PasteEEPage.h index c99cd51e..0ea74e7c 100644 --- a/launcher/pages/global/PasteEEPage.h +++ b/launcher/pages/global/PasteEEPage.h @@ -18,7 +18,7 @@ #include <QWidget> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { class PasteEEPage; @@ -38,7 +38,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("log"); + return APPLICATION->getThemedIcon("log"); } QString id() const override { diff --git a/launcher/pages/global/ProxyPage.cpp b/launcher/pages/global/ProxyPage.cpp index d4e767e1..622b8ef3 100644 --- a/launcher/pages/global/ProxyPage.cpp +++ b/launcher/pages/global/ProxyPage.cpp @@ -19,7 +19,7 @@ #include <QTabBar> #include "settings/SettingsObject.h" -#include "Launcher.h" +#include "Application.h" #include "Env.h" ProxyPage::ProxyPage(QWidget *parent) : QWidget(parent), ui(new Ui::ProxyPage) @@ -58,7 +58,7 @@ void ProxyPage::proxyChanged(int) void ProxyPage::applySettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Proxy QString proxyType = "None"; @@ -77,12 +77,12 @@ void ProxyPage::applySettings() s->set("ProxyUser", ui->proxyUserEdit->text()); s->set("ProxyPass", ui->proxyPassEdit->text()); - ENV.updateProxySettings(proxyType, ui->proxyAddrEdit->text(), ui->proxyPortEdit->value(), + ENV->updateProxySettings(proxyType, ui->proxyAddrEdit->text(), ui->proxyPortEdit->value(), ui->proxyUserEdit->text(), ui->proxyPassEdit->text()); } void ProxyPage::loadSettings() { - auto s = LAUNCHER->settings(); + auto s = APPLICATION->settings(); // Proxy QString proxyType = s->get("ProxyType").toString(); if (proxyType == "Default") diff --git a/launcher/pages/global/ProxyPage.h b/launcher/pages/global/ProxyPage.h index 90c33c9d..91f1fbaa 100644 --- a/launcher/pages/global/ProxyPage.h +++ b/launcher/pages/global/ProxyPage.h @@ -19,7 +19,7 @@ #include <QDialog> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { @@ -40,7 +40,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("proxy"); + return APPLICATION->getThemedIcon("proxy"); } QString id() const override { diff --git a/launcher/pages/instance/GameOptionsPage.h b/launcher/pages/instance/GameOptionsPage.h index ca7e31b1..31e7b2dd 100644 --- a/launcher/pages/instance/GameOptionsPage.h +++ b/launcher/pages/instance/GameOptionsPage.h @@ -19,7 +19,7 @@ #include <QString> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { @@ -46,7 +46,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("settings"); + return APPLICATION->getThemedIcon("settings"); } virtual QString id() const override { diff --git a/launcher/pages/instance/InstanceSettingsPage.cpp b/launcher/pages/instance/InstanceSettingsPage.cpp index c83832c6..730fcbbd 100644 --- a/launcher/pages/instance/InstanceSettingsPage.cpp +++ b/launcher/pages/instance/InstanceSettingsPage.cpp @@ -7,7 +7,7 @@ #include "dialogs/VersionSelectDialog.h" #include "JavaCommon.h" -#include "Launcher.h" +#include "Application.h" #include <java/JavaInstallList.h> #include <FileSystem.h> @@ -22,8 +22,8 @@ InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent) auto sysMB = Sys::getSystemRam() / Sys::mebibyte; ui->maxMemSpinBox->setMaximum(sysMB); connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked); - connect(LAUNCHER, &Launcher::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings); - connect(LAUNCHER, &Launcher::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); + connect(APPLICATION, &Application::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings); + connect(APPLICATION, &Application::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); loadSettings(); } @@ -41,13 +41,13 @@ void InstanceSettingsPage::globalSettingsButtonClicked(bool) { switch(ui->settingsTabs->currentIndex()) { case 0: - LAUNCHER->ShowGlobalSettings(this, "java-settings"); + APPLICATION->ShowGlobalSettings(this, "java-settings"); return; case 1: - LAUNCHER->ShowGlobalSettings(this, "minecraft-settings"); + APPLICATION->ShowGlobalSettings(this, "minecraft-settings"); return; case 2: - LAUNCHER->ShowGlobalSettings(this, "custom-commands"); + APPLICATION->ShowGlobalSettings(this, "custom-commands"); return; } } @@ -278,7 +278,7 @@ void InstanceSettingsPage::on_javaDetectBtn_clicked() { JavaInstallPtr java; - VersionSelectDialog vselect(LAUNCHER->javalist().get(), tr("Select a Java version"), this, true); + VersionSelectDialog vselect(APPLICATION->javalist().get(), tr("Select a Java version"), this, true); vselect.setResizeOn(2); vselect.exec(); diff --git a/launcher/pages/instance/InstanceSettingsPage.h b/launcher/pages/instance/InstanceSettingsPage.h index a039101c..88169a67 100644 --- a/launcher/pages/instance/InstanceSettingsPage.h +++ b/launcher/pages/instance/InstanceSettingsPage.h @@ -22,7 +22,7 @@ #include <QObjectPtr.h> #include "pages/BasePage.h" #include "JavaCommon.h" -#include "Launcher.h" +#include "Application.h" class JavaChecker; namespace Ui @@ -43,7 +43,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("instance-settings"); + return APPLICATION->getThemedIcon("instance-settings"); } virtual QString id() const override { diff --git a/launcher/pages/instance/LegacyUpgradePage.cpp b/launcher/pages/instance/LegacyUpgradePage.cpp index b12174fa..21444756 100644 --- a/launcher/pages/instance/LegacyUpgradePage.cpp +++ b/launcher/pages/instance/LegacyUpgradePage.cpp @@ -4,7 +4,7 @@ #include "InstanceList.h" #include "minecraft/legacy/LegacyInstance.h" #include "minecraft/legacy/LegacyUpgradeTask.h" -#include "Launcher.h" +#include "Application.h" #include "dialogs/CustomMessageBox.h" #include "dialogs/ProgressDialog.h" @@ -38,9 +38,9 @@ void LegacyUpgradePage::on_upgradeButton_clicked() QString newName = tr("%1 (Migrated)").arg(m_inst->name()); auto upgradeTask = new LegacyUpgradeTask(m_inst); upgradeTask->setName(newName); - upgradeTask->setGroup(LAUNCHER->instances()->getInstanceGroup(m_inst->id())); + upgradeTask->setGroup(APPLICATION->instances()->getInstanceGroup(m_inst->id())); upgradeTask->setIcon(m_inst->iconKey()); - unique_qobject_ptr<Task> task(LAUNCHER->instances()->wrapInstanceTask(upgradeTask)); + unique_qobject_ptr<Task> task(APPLICATION->instances()->wrapInstanceTask(upgradeTask)); runModalTask(task.get()); } diff --git a/launcher/pages/instance/LegacyUpgradePage.h b/launcher/pages/instance/LegacyUpgradePage.h index d8e98f6b..f4b7b57c 100644 --- a/launcher/pages/instance/LegacyUpgradePage.h +++ b/launcher/pages/instance/LegacyUpgradePage.h @@ -19,7 +19,7 @@ #include "minecraft/legacy/LegacyInstance.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> #include "tasks/Task.h" namespace Ui @@ -40,7 +40,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("checkupdate"); + return APPLICATION->getThemedIcon("checkupdate"); } virtual QString id() const override { diff --git a/launcher/pages/instance/LogPage.cpp b/launcher/pages/instance/LogPage.cpp index 2846dc51..b9046b62 100644 --- a/launcher/pages/instance/LogPage.cpp +++ b/launcher/pages/instance/LogPage.cpp @@ -1,7 +1,7 @@ #include "LogPage.h" #include "ui_LogPage.h" -#include "Launcher.h" +#include "Application.h" #include <QIcon> #include <QScrollBar> @@ -125,9 +125,9 @@ LogPage::LogPage(InstancePtr instance, QWidget *parent) // set up fonts in the log proxy { - QString fontFamily = LAUNCHER->settings()->get("ConsoleFont").toString(); + QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString(); bool conversionOk = false; - int fontSize = LAUNCHER->settings()->get("ConsoleFontSize").toInt(&conversionOk); + int fontSize = APPLICATION->settings()->get("ConsoleFontSize").toInt(&conversionOk); if(!conversionOk) { fontSize = 11; diff --git a/launcher/pages/instance/LogPage.h b/launcher/pages/instance/LogPage.h index 285296cd..270a533a 100644 --- a/launcher/pages/instance/LogPage.h +++ b/launcher/pages/instance/LogPage.h @@ -20,7 +20,7 @@ #include "BaseInstance.h" #include "launch/LaunchTask.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { @@ -42,7 +42,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("log"); + return APPLICATION->getThemedIcon("log"); } virtual QString id() const override { diff --git a/launcher/pages/instance/ModFolderPage.cpp b/launcher/pages/instance/ModFolderPage.cpp index caa81958..6d496e55 100644 --- a/launcher/pages/instance/ModFolderPage.cpp +++ b/launcher/pages/instance/ModFolderPage.cpp @@ -22,7 +22,7 @@ #include <QAbstractItemModel> #include <QMenu> -#include "Launcher.h" +#include "Application.h" #include "dialogs/CustomMessageBox.h" #include <GuiUtil.h> #include "minecraft/mod/ModFolderModel.h" @@ -301,7 +301,7 @@ void ModFolderPage::on_actionAdd_triggered() tr("Select %1", "Select whatever type of files the page contains. Example: 'Loader Mods'") .arg(m_displayName), - m_fileSelectionFilter.arg(m_displayName), LAUNCHER->settings()->get("CentralModsDir").toString(), + m_fileSelectionFilter.arg(m_displayName), APPLICATION->settings()->get("CentralModsDir").toString(), this->parentWidget()); if (!list.empty()) { diff --git a/launcher/pages/instance/ModFolderPage.h b/launcher/pages/instance/ModFolderPage.h index 38fcc6a5..7a81f63a 100644 --- a/launcher/pages/instance/ModFolderPage.h +++ b/launcher/pages/instance/ModFolderPage.h @@ -19,7 +19,7 @@ #include "minecraft/MinecraftInstance.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> class ModFolderModel; namespace Ui @@ -54,7 +54,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon(m_iconName); + return APPLICATION->getThemedIcon(m_iconName); } virtual QString id() const override { diff --git a/launcher/pages/instance/NotesPage.h b/launcher/pages/instance/NotesPage.h index 1bdb352d..23d2684a 100644 --- a/launcher/pages/instance/NotesPage.h +++ b/launcher/pages/instance/NotesPage.h @@ -19,7 +19,7 @@ #include "BaseInstance.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { @@ -39,9 +39,9 @@ public: } virtual QIcon icon() const override { - auto icon = LAUNCHER->getThemedIcon("notes"); + auto icon = APPLICATION->getThemedIcon("notes"); if(icon.isNull()) - icon = LAUNCHER->getThemedIcon("news"); + icon = APPLICATION->getThemedIcon("news"); return icon; } virtual QString id() const override diff --git a/launcher/pages/instance/OtherLogsPage.cpp b/launcher/pages/instance/OtherLogsPage.cpp index 31cd44ed..6705c059 100644 --- a/launcher/pages/instance/OtherLogsPage.cpp +++ b/launcher/pages/instance/OtherLogsPage.cpp @@ -129,9 +129,9 @@ void OtherLogsPage::on_btnReload_clicked() { auto setPlainText = [&](const QString & text) { - QString fontFamily = LAUNCHER->settings()->get("ConsoleFont").toString(); + QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString(); bool conversionOk = false; - int fontSize = LAUNCHER->settings()->get("ConsoleFontSize").toInt(&conversionOk); + int fontSize = APPLICATION->settings()->get("ConsoleFontSize").toInt(&conversionOk); if(!conversionOk) { fontSize = 11; diff --git a/launcher/pages/instance/OtherLogsPage.h b/launcher/pages/instance/OtherLogsPage.h index 25f127f6..c8323659 100644 --- a/launcher/pages/instance/OtherLogsPage.h +++ b/launcher/pages/instance/OtherLogsPage.h @@ -18,7 +18,7 @@ #include <QWidget> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> #include <pathmatcher/IPathMatcher.h> namespace Ui @@ -46,7 +46,7 @@ public: } QIcon icon() const override { - return LAUNCHER->getThemedIcon("log"); + return APPLICATION->getThemedIcon("log"); } QString helpPage() const override { diff --git a/launcher/pages/instance/ScreenshotsPage.cpp b/launcher/pages/instance/ScreenshotsPage.cpp index 172e2eb3..f24cf486 100644 --- a/launcher/pages/instance/ScreenshotsPage.cpp +++ b/launcher/pages/instance/ScreenshotsPage.cpp @@ -15,7 +15,7 @@ #include <QKeyEvent> #include <QMenu> -#include <Launcher.h> +#include <Application.h> #include "dialogs/ProgressDialog.h" #include "dialogs/CustomMessageBox.h" @@ -104,7 +104,7 @@ public: { m_thumbnailingPool.setMaxThreadCount(4); m_thumbnailCache = std::make_shared<SharedIconCache>(); - m_thumbnailCache->add("placeholder", LAUNCHER->getThemedIcon("screenshot-placeholder")); + m_thumbnailCache->add("placeholder", APPLICATION->getThemedIcon("screenshot-placeholder")); connect(&watcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString))); // FIXME: the watched file set is not updated when files are removed } diff --git a/launcher/pages/instance/ScreenshotsPage.h b/launcher/pages/instance/ScreenshotsPage.h index 01f26642..84145b0e 100644 --- a/launcher/pages/instance/ScreenshotsPage.h +++ b/launcher/pages/instance/ScreenshotsPage.h @@ -18,7 +18,7 @@ #include <QMainWindow> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> class QFileSystemModel; class QIdentityProxyModel; @@ -53,7 +53,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("screenshots"); + return APPLICATION->getThemedIcon("screenshots"); } virtual QString id() const override { diff --git a/launcher/pages/instance/ServersPage.cpp b/launcher/pages/instance/ServersPage.cpp index 6c55fdac..8116d2bf 100644 --- a/launcher/pages/instance/ServersPage.cpp +++ b/launcher/pages/instance/ServersPage.cpp @@ -324,7 +324,7 @@ public: if(px.loadFromData(bytes)) return QIcon(px); } - return LAUNCHER->getThemedIcon("unknown_server"); + return APPLICATION->getThemedIcon("unknown_server"); } case Qt::DisplayRole: return m_servers[row].m_name; @@ -762,7 +762,7 @@ void ServersPage::on_actionMove_Down_triggered() void ServersPage::on_actionJoin_triggered() { const auto &address = m_model->at(currentServer)->m_address; - LAUNCHER->launch(m_inst, true, nullptr, std::make_shared<MinecraftServerTarget>(MinecraftServerTarget::parse(address))); + APPLICATION->launch(m_inst, true, nullptr, std::make_shared<MinecraftServerTarget>(MinecraftServerTarget::parse(address))); } #include "ServersPage.moc" diff --git a/launcher/pages/instance/ServersPage.h b/launcher/pages/instance/ServersPage.h index 63f3b9e3..1f678bce 100644 --- a/launcher/pages/instance/ServersPage.h +++ b/launcher/pages/instance/ServersPage.h @@ -19,7 +19,7 @@ #include <QString> #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> namespace Ui { @@ -47,7 +47,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("unknown_server"); + return APPLICATION->getThemedIcon("unknown_server"); } virtual QString id() const override { diff --git a/launcher/pages/instance/VersionPage.cpp b/launcher/pages/instance/VersionPage.cpp index 103f0c7a..15d5d8d5 100644 --- a/launcher/pages/instance/VersionPage.cpp +++ b/launcher/pages/instance/VersionPage.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "Launcher.h" +#include "Application.h" #include <QMessageBox> #include <QLabel> @@ -70,14 +70,14 @@ public: auto string = var.toString(); if(string == "warning") { - return LAUNCHER->getThemedIcon("status-yellow"); + return APPLICATION->getThemedIcon("status-yellow"); } else if(string == "error") { - return LAUNCHER->getThemedIcon("status-bad"); + return APPLICATION->getThemedIcon("status-bad"); } } - return LAUNCHER->getThemedIcon("status-good"); + return APPLICATION->getThemedIcon("status-good"); } return var; } @@ -93,7 +93,7 @@ private: QIcon VersionPage::icon() const { - return LAUNCHER->icons()->getIcon(m_inst->iconKey()); + return APPLICATION->icons()->getIcon(m_inst->iconKey()); } bool VersionPage::shouldDisplay() const { @@ -297,7 +297,7 @@ void VersionPage::on_actionInstall_mods_triggered() void VersionPage::on_actionAdd_to_Minecraft_jar_triggered() { - auto list = GuiUtil::BrowseForFiles("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), LAUNCHER->settings()->get("CentralModsDir").toString(), this->parentWidget()); + auto list = GuiUtil::BrowseForFiles("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), APPLICATION->settings()->get("CentralModsDir").toString(), this->parentWidget()); if(!list.empty()) { m_profile->installJarMods(list); @@ -307,7 +307,7 @@ void VersionPage::on_actionAdd_to_Minecraft_jar_triggered() void VersionPage::on_actionReplace_Minecraft_jar_triggered() { - auto jarPath = GuiUtil::BrowseForFile("jar", tr("Select jar"), tr("Minecraft.jar replacement (*.jar)"), LAUNCHER->settings()->get("CentralModsDir").toString(), this->parentWidget()); + auto jarPath = GuiUtil::BrowseForFile("jar", tr("Select jar"), tr("Minecraft.jar replacement (*.jar)"), APPLICATION->settings()->get("CentralModsDir").toString(), this->parentWidget()); if(!jarPath.isEmpty()) { m_profile->installCustomJar(jarPath); @@ -395,7 +395,7 @@ void VersionPage::on_actionChange_version_triggered() void VersionPage::on_actionDownload_All_triggered() { - if (!LAUNCHER->accounts()->anyAccountIsValid()) + if (!APPLICATION->accounts()->anyAccountIsValid()) { CustomMessageBox::selectable( this, tr("Error"), @@ -420,7 +420,7 @@ void VersionPage::on_actionDownload_All_triggered() void VersionPage::on_actionInstall_Forge_triggered() { - auto vlist = ENV.metadataIndex()->get("net.minecraftforge"); + auto vlist = ENV->metadataIndex()->get("net.minecraftforge"); if(!vlist) { return; @@ -449,7 +449,7 @@ void VersionPage::on_actionInstall_Forge_triggered() void VersionPage::on_actionInstall_Fabric_triggered() { - auto vlist = ENV.metadataIndex()->get("net.fabricmc.fabric-loader"); + auto vlist = ENV->metadataIndex()->get("net.fabricmc.fabric-loader"); if(!vlist) { return; @@ -494,7 +494,7 @@ void VersionPage::on_actionAdd_Empty_triggered() void VersionPage::on_actionInstall_LiteLoader_triggered() { - auto vlist = ENV.metadataIndex()->get("com.mumfrey.liteloader"); + auto vlist = ENV->metadataIndex()->get("com.mumfrey.liteloader"); if(!vlist) { return; @@ -614,7 +614,7 @@ void VersionPage::on_actionEdit_triggered() qWarning() << "file" << filename << "can't be opened for editing, doesn't exist!"; return; } - LAUNCHER->openJsonEditor(filename); + APPLICATION->openJsonEditor(filename); } void VersionPage::on_actionRevert_triggered() diff --git a/launcher/pages/instance/WorldListPage.cpp b/launcher/pages/instance/WorldListPage.cpp index d25f23a8..1af38bb8 100644 --- a/launcher/pages/instance/WorldListPage.cpp +++ b/launcher/pages/instance/WorldListPage.cpp @@ -26,7 +26,7 @@ #include <QInputDialog> #include <tools/MCEditTool.h> -#include "Launcher.h" +#include "Application.h" #include <GuiUtil.h> #include <QProcess> #include <FileSystem.h> @@ -48,7 +48,7 @@ public: auto iconFile = worlds->data(sourceIndex, WorldList::IconFileRole).toString(); if(iconFile.isNull()) { // NOTE: Minecraft uses the same placeholder for servers AND worlds - return LAUNCHER->getThemedIcon("unknown_server"); + return APPLICATION->getThemedIcon("unknown_server"); } return QIcon(iconFile); } @@ -218,7 +218,7 @@ void WorldListPage::on_actionCopy_Seed_triggered() return; } int64_t seed = m_worlds->data(index, WorldList::SeedRole).toLongLong(); - LAUNCHER->clipboard()->setText(QString::number(seed)); + APPLICATION->clipboard()->setText(QString::number(seed)); } void WorldListPage::on_actionMCEdit_triggered() @@ -226,7 +226,7 @@ void WorldListPage::on_actionMCEdit_triggered() if(m_mceditStarting) return; - auto mcedit = LAUNCHER->mcedit(); + auto mcedit = APPLICATION->mcedit(); const QString mceditPath = mcedit->path(); diff --git a/launcher/pages/instance/WorldListPage.h b/launcher/pages/instance/WorldListPage.h index b90d7ad1..7636d604 100644 --- a/launcher/pages/instance/WorldListPage.h +++ b/launcher/pages/instance/WorldListPage.h @@ -19,7 +19,7 @@ #include "minecraft/MinecraftInstance.h" #include "pages/BasePage.h" -#include <Launcher.h> +#include <Application.h> #include <LoggedProcess.h> class WorldList; @@ -46,7 +46,7 @@ public: } virtual QIcon icon() const override { - return LAUNCHER->getThemedIcon("worlds"); + return APPLICATION->getThemedIcon("worlds"); } virtual QString id() const override { diff --git a/launcher/pages/modplatform/ImportPage.cpp b/launcher/pages/modplatform/ImportPage.cpp index dd02e839..890cc3a0 100644 --- a/launcher/pages/modplatform/ImportPage.cpp +++ b/launcher/pages/modplatform/ImportPage.cpp @@ -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> diff --git a/launcher/pages/modplatform/ImportPage.h b/launcher/pages/modplatform/ImportPage.h index cc8a0d1f..c39d2a74 100644 --- a/launcher/pages/modplatform/ImportPage.h +++ b/launcher/pages/modplatform/ImportPage.h @@ -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 { diff --git a/launcher/pages/modplatform/VanillaPage.cpp b/launcher/pages/modplatform/VanillaPage.cpp index 1cf5bbc7..6dbc3970 100644 --- a/launcher/pages/modplatform/VanillaPage.cpp +++ b/launcher/pages/modplatform/VanillaPage.cpp @@ -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; } diff --git a/launcher/pages/modplatform/VanillaPage.h b/launcher/pages/modplatform/VanillaPage.h index e090d8bb..22acbcac 100644 --- a/launcher/pages/modplatform/VanillaPage.h +++ b/launcher/pages/modplatform/VanillaPage.h @@ -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 { diff --git a/launcher/pages/modplatform/atlauncher/AtlListModel.cpp b/launcher/pages/modplatform/atlauncher/AtlListModel.cpp index 99d12601..68234f6b 100644 --- a/launcher/pages/modplatform/atlauncher/AtlListModel.cpp +++ b/launcher/pages/modplatform/atlauncher/AtlListModel.cpp @@ -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)); diff --git a/launcher/pages/modplatform/atlauncher/AtlPage.cpp b/launcher/pages/modplatform/atlauncher/AtlPage.cpp index cdf5cc86..5d286182 100644 --- a/launcher/pages/modplatform/atlauncher/AtlPage.cpp +++ b/launcher/pages/modplatform/atlauncher/AtlPage.cpp @@ -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)); diff --git a/launcher/pages/modplatform/atlauncher/AtlPage.h b/launcher/pages/modplatform/atlauncher/AtlPage.h index 84c40656..7321021d 100644 --- a/launcher/pages/modplatform/atlauncher/AtlPage.h +++ b/launcher/pages/modplatform/atlauncher/AtlPage.h @@ -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 { diff --git a/launcher/pages/modplatform/flame/FlameModel.cpp b/launcher/pages/modplatform/flame/FlameModel.cpp index 6dd29d21..c983eefd 100644 --- a/launcher/pages/modplatform/flame/FlameModel.cpp +++ b/launcher/pages/modplatform/flame/FlameModel.cpp @@ -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 { diff --git a/launcher/pages/modplatform/flame/FlamePage.cpp b/launcher/pages/modplatform/flame/FlamePage.cpp index 8f798df6..11fc4222 100644 --- a/launcher/pages/modplatform/flame/FlamePage.cpp +++ b/launcher/pages/modplatform/flame/FlamePage.cpp @@ -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> diff --git a/launcher/pages/modplatform/flame/FlamePage.h b/launcher/pages/modplatform/flame/FlamePage.h index c3d2630a..4e22b3eb 100644 --- a/launcher/pages/modplatform/flame/FlamePage.h +++ b/launcher/pages/modplatform/flame/FlamePage.h @@ -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 { diff --git a/launcher/pages/modplatform/ftb/FtbListModel.cpp b/launcher/pages/modplatform/ftb/FtbListModel.cpp index c4c2c83e..16a744cf 100644 --- a/launcher/pages/modplatform/ftb/FtbListModel.cpp +++ b/launcher/pages/modplatform/ftb/FtbListModel.cpp @@ -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(); diff --git a/launcher/pages/modplatform/ftb/FtbPage.h b/launcher/pages/modplatform/ftb/FtbPage.h index 0a4a6cea..b8331f8f 100644 --- a/launcher/pages/modplatform/ftb/FtbPage.h +++ b/launcher/pages/modplatform/ftb/FtbPage.h @@ -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 { diff --git a/launcher/pages/modplatform/legacy_ftb/ListModel.cpp b/launcher/pages/modplatform/legacy_ftb/ListModel.cpp index 78063c5f..dfef278b 100644 --- a/launcher/pages/modplatform/legacy_ftb/ListModel.cpp +++ b/launcher/pages/modplatform/legacy_ftb/ListModel.cpp @@ -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 { diff --git a/launcher/pages/modplatform/legacy_ftb/Page.cpp b/launcher/pages/modplatform/legacy_ftb/Page.cpp index 6b6a7dcd..93002a87 100644 --- a/launcher/pages/modplatform/legacy_ftb/Page.cpp +++ b/launcher/pages/modplatform/legacy_ftb/Page.cpp @@ -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" diff --git a/launcher/pages/modplatform/legacy_ftb/Page.h b/launcher/pages/modplatform/legacy_ftb/Page.h index 6159cd9d..4c6fb35e 100644 --- a/launcher/pages/modplatform/legacy_ftb/Page.h +++ b/launcher/pages/modplatform/legacy_ftb/Page.h @@ -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 { diff --git a/launcher/pages/modplatform/technic/TechnicModel.cpp b/launcher/pages/modplatform/technic/TechnicModel.cpp index cac6fef1..a07395ef 100644 --- a/launcher/pages/modplatform/technic/TechnicModel.cpp +++ b/launcher/pages/modplatform/technic/TechnicModel.cpp @@ -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)); diff --git a/launcher/pages/modplatform/technic/TechnicPage.cpp b/launcher/pages/modplatform/technic/TechnicPage.cpp index 4f27e685..2befda04 100644 --- a/launcher/pages/modplatform/technic/TechnicPage.cpp +++ b/launcher/pages/modplatform/technic/TechnicPage.cpp @@ -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> diff --git a/launcher/pages/modplatform/technic/TechnicPage.h b/launcher/pages/modplatform/technic/TechnicPage.h index f0619a52..efd5d726 100644 --- a/launcher/pages/modplatform/technic/TechnicPage.h +++ b/launcher/pages/modplatform/technic/TechnicPage.h @@ -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 { |