NOISSUE Some happy little refactors
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
#include "AboutDialog.h"
|
||||
#include "ui_AboutDialog.h"
|
||||
#include <QIcon>
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
#include <net/NetJob.h>
|
||||
@ -88,7 +88,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia
|
||||
|
||||
ui->urlLabel->setOpenExternalLinks(true);
|
||||
|
||||
ui->icon->setPixmap(LAUNCHER->getThemedIcon("logo").pixmap(64));
|
||||
ui->icon->setPixmap(APPLICATION->getThemedIcon("logo").pixmap(64));
|
||||
ui->title->setText(launcherName);
|
||||
|
||||
ui->versionLabel->setText(tr("Version") +": " + BuildConfig.printableVersionString());
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include "CopyInstanceDialog.h"
|
||||
#include "ui_CopyInstanceDialog.h"
|
||||
|
||||
@ -36,16 +36,16 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
InstIconKey = original->iconKey();
|
||||
ui->iconButton->setIcon(LAUNCHER->icons()->getIcon(InstIconKey));
|
||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||
ui->instNameTextBox->setText(original->name());
|
||||
ui->instNameTextBox->setFocus();
|
||||
auto groups = LAUNCHER->instances()->getGroups().toSet();
|
||||
auto groups = APPLICATION->instances()->getGroups().toSet();
|
||||
auto groupList = QStringList(groups.toList());
|
||||
groupList.sort(Qt::CaseInsensitive);
|
||||
groupList.removeOne("");
|
||||
groupList.push_front("");
|
||||
ui->groupBox->addItems(groupList);
|
||||
int index = groupList.indexOf(LAUNCHER->instances()->getInstanceGroup(m_original->id()));
|
||||
int index = groupList.indexOf(APPLICATION->instances()->getInstanceGroup(m_original->id()));
|
||||
if(index == -1)
|
||||
{
|
||||
index = 0;
|
||||
@ -99,7 +99,7 @@ void CopyInstanceDialog::on_iconButton_clicked()
|
||||
if (dlg.result() == QDialog::Accepted)
|
||||
{
|
||||
InstIconKey = dlg.selectedIconKey;
|
||||
ui->iconButton->setIcon(LAUNCHER->icons()->getIcon(InstIconKey));
|
||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <QSaveFile>
|
||||
#include "MMCStrings.h"
|
||||
#include "SeparatorPrefixTree.h"
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include <icons/IconList.h>
|
||||
#include <FileSystem.h>
|
||||
|
||||
@ -341,7 +341,7 @@ ExportInstanceDialog::~ExportInstanceDialog()
|
||||
void SaveIcon(InstancePtr m_instance)
|
||||
{
|
||||
auto iconKey = m_instance->iconKey();
|
||||
auto iconList = LAUNCHER->icons();
|
||||
auto iconList = APPLICATION->icons();
|
||||
auto mmcIcon = iconList->icon(iconKey);
|
||||
if(!mmcIcon || mmcIcon->isBuiltIn()) {
|
||||
return;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
|
||||
#include "IconPickerDialog.h"
|
||||
#include "ui_IconPickerDialog.h"
|
||||
@ -59,7 +59,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent)
|
||||
|
||||
contentsWidget->installEventFilter(this);
|
||||
|
||||
contentsWidget->setModel(LAUNCHER->icons().get());
|
||||
contentsWidget->setModel(APPLICATION->icons().get());
|
||||
|
||||
// NOTE: ResetRole forces the button to be on the left, while the OK/Cancel ones are on the right. We win.
|
||||
auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole);
|
||||
@ -106,12 +106,12 @@ void IconPickerDialog::addNewIcon()
|
||||
//: The type of icon files
|
||||
auto filter = IconUtils::getIconFilter();
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(), tr("Icons %1").arg(filter));
|
||||
LAUNCHER->icons()->installIcons(fileNames);
|
||||
APPLICATION->icons()->installIcons(fileNames);
|
||||
}
|
||||
|
||||
void IconPickerDialog::removeSelectedIcon()
|
||||
{
|
||||
LAUNCHER->icons()->deleteIcon(selectedIconKey);
|
||||
APPLICATION->icons()->deleteIcon(selectedIconKey);
|
||||
}
|
||||
|
||||
void IconPickerDialog::activated(QModelIndex index)
|
||||
@ -133,7 +133,7 @@ void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection
|
||||
|
||||
int IconPickerDialog::execWithSelection(QString selection)
|
||||
{
|
||||
auto list = LAUNCHER->icons();
|
||||
auto list = APPLICATION->icons();
|
||||
auto contentsWidget = ui->iconView;
|
||||
selectedIconKey = selection;
|
||||
|
||||
@ -159,5 +159,5 @@ IconPickerDialog::~IconPickerDialog()
|
||||
|
||||
void IconPickerDialog::openFolder()
|
||||
{
|
||||
DesktopServices::openDirectory(LAUNCHER->icons()->getDirectory(), true);
|
||||
DesktopServices::openDirectory(APPLICATION->icons()->getDirectory(), true);
|
||||
}
|
||||
|
@ -54,5 +54,5 @@ slots:
|
||||
private:
|
||||
Ui::LoginDialog *ui;
|
||||
MinecraftAccountPtr m_account;
|
||||
std::shared_ptr<Task> m_loginTask;
|
||||
shared_qobject_ptr<Task> m_loginTask;
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ slots:
|
||||
private:
|
||||
Ui::MSALoginDialog *ui;
|
||||
MinecraftAccountPtr m_account;
|
||||
std::shared_ptr<AccountTask> m_loginTask;
|
||||
shared_qobject_ptr<AccountTask> m_loginTask;
|
||||
QTimer m_externalLoginTimer;
|
||||
int m_externalLoginElapsed = 0;
|
||||
int m_externalLoginTimeout = 0;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include "NewComponentDialog.h"
|
||||
#include "ui_NewComponentDialog.h"
|
||||
|
||||
@ -46,7 +46,7 @@ NewComponentDialog::NewComponentDialog(const QString & initialName, const QStrin
|
||||
connect(ui->nameTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState);
|
||||
connect(ui->uidTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState);
|
||||
|
||||
auto groups = LAUNCHER->instances()->getGroups().toSet();
|
||||
auto groups = APPLICATION->instances()->getGroups().toSet();
|
||||
ui->nameTextBox->setFocus();
|
||||
|
||||
originalPlaceholderText = ui->uidTextBox->placeholderText();
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include "NewInstanceDialog.h"
|
||||
#include "ui_NewInstanceDialog.h"
|
||||
|
||||
@ -48,12 +48,12 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowIcon(LAUNCHER->getThemedIcon("new"));
|
||||
setWindowIcon(APPLICATION->getThemedIcon("new"));
|
||||
|
||||
InstIconKey = "default";
|
||||
ui->iconButton->setIcon(LAUNCHER->icons()->getIcon(InstIconKey));
|
||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||
|
||||
auto groups = LAUNCHER->instances()->getGroups().toSet();
|
||||
auto groups = APPLICATION->instances()->getGroups().toSet();
|
||||
auto groupList = QStringList(groups.toList());
|
||||
groupList.sort(Qt::CaseInsensitive);
|
||||
groupList.removeOne("");
|
||||
@ -105,18 +105,18 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString
|
||||
|
||||
updateDialogState();
|
||||
|
||||
restoreGeometry(QByteArray::fromBase64(LAUNCHER->settings()->get("NewInstanceGeometry").toByteArray()));
|
||||
restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("NewInstanceGeometry").toByteArray()));
|
||||
}
|
||||
|
||||
void NewInstanceDialog::reject()
|
||||
{
|
||||
LAUNCHER->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void NewInstanceDialog::accept()
|
||||
{
|
||||
LAUNCHER->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||
importIconNow();
|
||||
QDialog::accept();
|
||||
}
|
||||
@ -155,7 +155,7 @@ void NewInstanceDialog::setSuggestedPack(const QString& name, InstanceTask* task
|
||||
|
||||
if(!task)
|
||||
{
|
||||
ui->iconButton->setIcon(LAUNCHER->icons()->getIcon("default"));
|
||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon("default"));
|
||||
importIcon = false;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ void NewInstanceDialog::setSuggestedIconFromFile(const QString &path, const QStr
|
||||
|
||||
void NewInstanceDialog::setSuggestedIcon(const QString &key)
|
||||
{
|
||||
auto icon = LAUNCHER->icons()->getIcon(key);
|
||||
auto icon = APPLICATION->icons()->getIcon(key);
|
||||
importIcon = false;
|
||||
|
||||
ui->iconButton->setIcon(icon);
|
||||
@ -234,7 +234,7 @@ void NewInstanceDialog::on_iconButton_clicked()
|
||||
if (dlg.result() == QDialog::Accepted)
|
||||
{
|
||||
InstIconKey = dlg.selectedIconKey;
|
||||
ui->iconButton->setIcon(LAUNCHER->icons()->getIcon(InstIconKey));
|
||||
ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey));
|
||||
importIcon = false;
|
||||
}
|
||||
}
|
||||
@ -247,9 +247,9 @@ void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
|
||||
void NewInstanceDialog::importIconNow()
|
||||
{
|
||||
if(importIcon) {
|
||||
LAUNCHER->icons()->installIcon(importIconPath, importIconName);
|
||||
APPLICATION->icons()->installIcon(importIconPath, importIconName);
|
||||
InstIconKey = importIconName;
|
||||
importIcon = false;
|
||||
}
|
||||
LAUNCHER->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||
}
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
#include <dialogs/ProgressDialog.h>
|
||||
|
||||
#include <Launcher.h>
|
||||
#include <Application.h>
|
||||
|
||||
ProfileSelectDialog::ProfileSelectDialog(const QString &message, int flags, QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::ProfileSelectDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_accounts = LAUNCHER->accounts();
|
||||
m_accounts = APPLICATION->accounts();
|
||||
auto view = ui->listView;
|
||||
//view->setModel(m_accounts.get());
|
||||
//view->hideColumn(AccountList::ActiveColumn);
|
||||
|
@ -80,7 +80,7 @@ slots:
|
||||
void on_buttonBox_rejected();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<AccountList> m_accounts;
|
||||
shared_qobject_ptr<AccountList> m_accounts;
|
||||
|
||||
//! The account that was selected when the user clicked OK.
|
||||
MinecraftAccountPtr m_selected;
|
||||
|
@ -23,19 +23,21 @@
|
||||
|
||||
#include <dialogs/ProgressDialog.h>
|
||||
|
||||
#include <Launcher.h>
|
||||
#include <Application.h>
|
||||
#include <minecraft/auth/flows/AuthRequest.h>
|
||||
#include <minecraft/auth/flows/Parsers.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
ProfileSetupDialog::ProfileSetupDialog(MinecraftAccountPtr accountToSetup, QWidget *parent)
|
||||
: QDialog(parent), m_accountToSetup(accountToSetup), ui(new Ui::ProfileSetupDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->errorLabel->setVisible(false);
|
||||
|
||||
goodIcon = LAUNCHER->getThemedIcon("status-good");
|
||||
yellowIcon = LAUNCHER->getThemedIcon("status-yellow");
|
||||
badIcon = LAUNCHER->getThemedIcon("status-bad");
|
||||
goodIcon = APPLICATION->getThemedIcon("status-good");
|
||||
yellowIcon = APPLICATION->getThemedIcon("status-yellow");
|
||||
badIcon = APPLICATION->getThemedIcon("status-bad");
|
||||
|
||||
QRegExp permittedNames("[a-zA-Z0-9_]{3,16}");
|
||||
auto nameEdit = ui->nameEdit;
|
||||
|
@ -3,14 +3,15 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include <FileSystem.h>
|
||||
|
||||
#include <minecraft/services/SkinUpload.h>
|
||||
#include <minecraft/services/CapeChange.h>
|
||||
#include <tasks/SequentialTask.h>
|
||||
|
||||
#include "SkinUploadDialog.h"
|
||||
#include "ui_SkinUploadDialog.h"
|
||||
#include "ProgressDialog.h"
|
||||
#include "CustomMessageBox.h"
|
||||
#include <minecraft/services/CapeChange.h>
|
||||
|
||||
void SkinUploadDialog::on_buttonBox_rejected()
|
||||
{
|
||||
@ -91,10 +92,10 @@ void SkinUploadDialog::on_buttonBox_accepted()
|
||||
model = SkinUpload::ALEX;
|
||||
}
|
||||
SequentialTask skinUpload;
|
||||
skinUpload.addTask(std::make_shared<SkinUpload>(this, session, FS::read(fileName), model));
|
||||
skinUpload.addTask(shared_qobject_ptr<SkinUpload>(new SkinUpload(this, session, FS::read(fileName), model)));
|
||||
auto selectedCape = ui->capeCombo->currentData().toString();
|
||||
if(selectedCape != session->m_accountPtr->accountData()->minecraftProfile.currentCape) {
|
||||
skinUpload.addTask(std::make_shared<CapeChange>(this, session, selectedCape));
|
||||
if(selectedCape != m_acct->accountData()->minecraftProfile.currentCape) {
|
||||
skinUpload.addTask(shared_qobject_ptr<CapeChange>(new CapeChange(this, session, selectedCape)));
|
||||
}
|
||||
if (prog.execWithTask(&skinUpload) != QDialog::Accepted)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "UpdateDialog.h"
|
||||
#include "ui_UpdateDialog.h"
|
||||
#include <QDebug>
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include <settings/SettingsObject.h>
|
||||
#include <Json.h>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
auto channel = LAUNCHER->settings()->get("UpdateChannel").toString();
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
if(hasUpdate)
|
||||
{
|
||||
ui->label->setText(tr("A new %1 update is available!").arg(channel));
|
||||
@ -24,7 +24,7 @@ UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), u
|
||||
}
|
||||
ui->changelogBrowser->setHtml(tr("<center><h1>Loading changelog...</h1></center>"));
|
||||
loadChangelog();
|
||||
restoreGeometry(QByteArray::fromBase64(LAUNCHER->settings()->get("UpdateDialogGeometry").toByteArray()));
|
||||
restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("UpdateDialogGeometry").toByteArray()));
|
||||
}
|
||||
|
||||
UpdateDialog::~UpdateDialog()
|
||||
@ -33,7 +33,7 @@ UpdateDialog::~UpdateDialog()
|
||||
|
||||
void UpdateDialog::loadChangelog()
|
||||
{
|
||||
auto channel = LAUNCHER->settings()->get("UpdateChannel").toString();
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
dljob.reset(new NetJob("Changelog"));
|
||||
QString url;
|
||||
if(channel == "stable")
|
||||
@ -65,7 +65,7 @@ QString reprocessMarkdown(QByteArray markdown)
|
||||
|
||||
QString reprocessCommits(QByteArray json)
|
||||
{
|
||||
auto channel = LAUNCHER->settings()->get("UpdateChannel").toString();
|
||||
auto channel = APPLICATION->settings()->get("UpdateChannel").toString();
|
||||
try
|
||||
{
|
||||
QString result;
|
||||
@ -177,6 +177,6 @@ void UpdateDialog::on_btnUpdateNow_clicked()
|
||||
|
||||
void UpdateDialog::closeEvent(QCloseEvent* evt)
|
||||
{
|
||||
LAUNCHER->settings()->set("UpdateDialogGeometry", saveGeometry().toBase64());
|
||||
APPLICATION->settings()->set("UpdateDialogGeometry", saveGeometry().toBase64());
|
||||
QDialog::closeEvent(evt);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <BaseVersionList.h>
|
||||
#include <tasks/Task.h>
|
||||
#include <QDebug>
|
||||
#include "Launcher.h"
|
||||
#include "Application.h"
|
||||
#include <VersionProxyModel.h>
|
||||
#include <widgets/VersionSelectWidget.h>
|
||||
|
||||
|
Reference in New Issue
Block a user