diff options
| author | Petr Mrázek <peterix@gmail.com> | 2018-07-15 14:51:05 +0200 |
|---|---|---|
| committer | Petr Mrázek <peterix@gmail.com> | 2018-07-15 14:51:05 +0200 |
| commit | bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9 (patch) | |
| tree | e6497e304b7b9368367565fbc7c06efab1124b1c /application/pages | |
| parent | 03280cc62e75f8073f8d3d9e9e3952acf21fa77d (diff) | |
| download | PrismLauncher-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.gz PrismLauncher-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.tar.bz2 PrismLauncher-bbb3b3e6f6e3c0f95873f22e6d0a4aaf350f49d9.zip | |
NOISSUE tabs -> spaces
Diffstat (limited to 'application/pages')
57 files changed, 4645 insertions, 4645 deletions
diff --git a/application/pages/BasePage.h b/application/pages/BasePage.h index d4547770..e1169c08 100644 --- a/application/pages/BasePage.h +++ b/application/pages/BasePage.h @@ -24,35 +24,35 @@ class BasePage { public: - virtual ~BasePage() {} - virtual QString id() const = 0; - virtual QString displayName() const = 0; - virtual QIcon icon() const = 0; - virtual bool apply() { return true; } - virtual bool shouldDisplay() const { return true; } - virtual QString helpPage() const { return QString(); } - void opened() - { - isOpened = true; - openedImpl(); - } - void closed() - { - isOpened = false; - closedImpl(); - } - virtual void openedImpl() {} - virtual void closedImpl() {} - virtual void setParentContainer(BasePageContainer * container) - { - m_container = container; - }; + virtual ~BasePage() {} + virtual QString id() const = 0; + virtual QString displayName() const = 0; + virtual QIcon icon() const = 0; + virtual bool apply() { return true; } + virtual bool shouldDisplay() const { return true; } + virtual QString helpPage() const { return QString(); } + void opened() + { + isOpened = true; + openedImpl(); + } + void closed() + { + isOpened = false; + closedImpl(); + } + virtual void openedImpl() {} + virtual void closedImpl() {} + virtual void setParentContainer(BasePageContainer * container) + { + m_container = container; + }; public: - int stackIndex = -1; - int listIndex = -1; + int stackIndex = -1; + int listIndex = -1; protected: - BasePageContainer * m_container = nullptr; - bool isOpened = false; + BasePageContainer * m_container = nullptr; + bool isOpened = false; }; typedef std::shared_ptr<BasePage> BasePagePtr; diff --git a/application/pages/BasePageContainer.h b/application/pages/BasePageContainer.h index ff7315c2..f8c7adeb 100644 --- a/application/pages/BasePageContainer.h +++ b/application/pages/BasePageContainer.h @@ -3,8 +3,8 @@ class BasePageContainer { public: - virtual ~BasePageContainer(){}; - virtual bool selectPage(QString pageId) = 0; - virtual void refreshContainer() = 0; - virtual bool requestClose() = 0; + virtual ~BasePageContainer(){}; + virtual bool selectPage(QString pageId) = 0; + virtual void refreshContainer() = 0; + virtual bool requestClose() = 0; }; diff --git a/application/pages/BasePageProvider.h b/application/pages/BasePageProvider.h index 05c38d23..e403800c 100644 --- a/application/pages/BasePageProvider.h +++ b/application/pages/BasePageProvider.h @@ -22,47 +22,47 @@ class BasePageProvider { public: - virtual QList<BasePage *> getPages() = 0; - virtual QString dialogTitle() = 0; + virtual QList<BasePage *> getPages() = 0; + virtual QString dialogTitle() = 0; }; class GenericPageProvider : public BasePageProvider { - typedef std::function<BasePage *()> PageCreator; + typedef std::function<BasePage *()> PageCreator; public: - explicit GenericPageProvider(const QString &dialogTitle) - : m_dialogTitle(dialogTitle) - { - } - virtual ~GenericPageProvider() {} + explicit GenericPageProvider(const QString &dialogTitle) + : m_dialogTitle(dialogTitle) + { + } + virtual ~GenericPageProvider() {} - QList<BasePage *> getPages() override - { - QList<BasePage *> pages; - for (PageCreator creator : m_creators) - { - pages.append(creator()); - } - return pages; - } - QString dialogTitle() override { return m_dialogTitle; } + QList<BasePage *> getPages() override + { + QList<BasePage *> pages; + for (PageCreator creator : m_creators) + { + pages.append(creator()); + } + return pages; + } + QString dialogTitle() override { return m_dialogTitle; } - void setDialogTitle(const QString &title) - { - m_dialogTitle = title; - } - void addPageCreator(PageCreator page) - { - m_creators.append(page); - } + void setDialogTitle(const QString &title) + { + m_dialogTitle = title; + } + void addPageCreator(PageCreator page) + { + m_creators.append(page); + } - template<typename PageClass> - void addPage() - { - addPageCreator([](){return new PageClass();}); - } + template<typename PageClass> + void addPage() + { + addPageCreator([](){return new PageClass();}); + } private: - QList<PageCreator> m_creators; - QString m_dialogTitle; + QList<PageCreator> m_creators; + QString m_dialogTitle; }; diff --git a/application/pages/global/AccountListPage.cpp b/application/pages/global/AccountListPage.cpp index 63943174..b89c410f 100644 --- a/application/pages/global/AccountListPage.cpp +++ b/application/pages/global/AccountListPage.cpp @@ -34,120 +34,120 @@ #include "MultiMC.h" AccountListPage::AccountListPage(QWidget *parent) - : QWidget(parent), ui(new Ui::AccountListPage) + : QWidget(parent), ui(new Ui::AccountListPage) { - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); - m_accounts = MMC->accounts(); + m_accounts = MMC->accounts(); - ui->listView->setModel(m_accounts.get()); - ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->listView->setModel(m_accounts.get()); + ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - // Expand the account column - ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch); + // Expand the account column + ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch); - QItemSelectionModel *selectionModel = ui->listView->selectionModel(); + QItemSelectionModel *selectionModel = ui->listView->selectionModel(); - connect(selectionModel, &QItemSelectionModel::selectionChanged, - [this](const QItemSelection &sel, const QItemSelection &dsel) - { updateButtonStates(); }); + connect(selectionModel, &QItemSelectionModel::selectionChanged, + [this](const QItemSelection &sel, const QItemSelection &dsel) + { updateButtonStates(); }); - connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged())); - connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged())); + connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged())); + connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged())); - updateButtonStates(); + updateButtonStates(); } AccountListPage::~AccountListPage() { - delete ui; + delete ui; } void AccountListPage::listChanged() { - updateButtonStates(); + updateButtonStates(); } void AccountListPage::on_addAccountBtn_clicked() { - addAccount(tr("Please enter your Mojang or Minecraft account username and password to add " - "your account.")); + addAccount(tr("Please enter your Mojang or Minecraft account username and password to add " + "your account.")); } void AccountListPage::on_rmAccountBtn_clicked() { - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - m_accounts->removeAccount(selected); - } + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.size() > 0) + { + QModelIndex selected = selection.first(); + m_accounts->removeAccount(selected); + } } void AccountListPage::on_setDefaultBtn_clicked() { - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - MojangAccountPtr account = - selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>(); - m_accounts->setActiveAccount(account->username()); - } + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.size() > 0) + { + QModelIndex selected = selection.first(); + MojangAccountPtr account = + selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>(); + m_accounts->setActiveAccount(account->username()); + } } void AccountListPage::on_noDefaultBtn_clicked() { - m_accounts->setActiveAccount(""); + m_accounts->setActiveAccount(""); } void AccountListPage::updateButtonStates() { - // If there is no selection, disable buttons that require something selected. - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + // If there is no selection, disable buttons that require something selected. + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - ui->rmAccountBtn->setEnabled(selection.size() > 0); - ui->setDefaultBtn->setEnabled(selection.size() > 0); - ui->uploadSkinBtn->setEnabled(selection.size() > 0); + ui->rmAccountBtn->setEnabled(selection.size() > 0); + ui->setDefaultBtn->setEnabled(selection.size() > 0); + ui->uploadSkinBtn->setEnabled(selection.size() > 0); - ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr); + ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr); } void AccountListPage::addAccount(const QString &errMsg) { - // TODO: The login dialog isn't quite done yet - MojangAccountPtr account = LoginDialog::newAccount(this, errMsg); - - if (account != nullptr) - { - m_accounts->addAccount(account); - if (m_accounts->count() == 1) - m_accounts->setActiveAccount(account->username()); - - // Grab associated player skins - auto job = new NetJob("Player skins: " + account->username()); - - for (AccountProfile profile : account->profiles()) - { - auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); - auto action = Net::Download::makeCached(QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta); - job->addNetAction(action); - meta->setStale(true); - } - - job->start(); - } + // TODO: The login dialog isn't quite done yet + MojangAccountPtr account = LoginDialog::newAccount(this, errMsg); + + if (account != nullptr) + { + m_accounts->addAccount(account); + if (m_accounts->count() == 1) + m_accounts->setActiveAccount(account->username()); + + // Grab associated player skins + auto job = new NetJob("Player skins: " + account->username()); + + for (AccountProfile profile : account->profiles()) + { + auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); + auto action = Net::Download::makeCached(QUrl("https://" + URLConstants::SKINS_BASE + profile.id + ".png"), meta); + job->addNetAction(action); + meta->setStale(true); + } + + job->start(); + } } void AccountListPage::on_uploadSkinBtn_clicked() { - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>(); - SkinUploadDialog dialog(account, this); - dialog.exec(); - } + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.size() > 0) + { + QModelIndex selected = selection.first(); + MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value<MojangAccountPtr>(); + SkinUploadDialog dialog(account, this); + dialog.exec(); + } } diff --git a/application/pages/global/AccountListPage.h b/application/pages/global/AccountListPage.h index fa5561fe..ad93c904 100644 --- a/application/pages/global/AccountListPage.h +++ b/application/pages/global/AccountListPage.h @@ -32,57 +32,57 @@ class AuthenticateTask; class AccountListPage : public QWidget, public BasePage { - Q_OBJECT + Q_OBJECT public: - explicit AccountListPage(QWidget *parent = 0); - ~AccountListPage(); - - QString displayName() const override - { - return tr("Accounts"); - } - QIcon icon() const override - { - auto icon = MMC->getThemedIcon("accounts"); - if(icon.isNull()) - { - icon = MMC->getThemedIcon("noaccount"); - } - return icon; - } - QString id() const override - { - return "accounts"; - } - QString helpPage() const override - { - return "Getting-Started#adding-an-account"; - } + explicit AccountListPage(QWidget *parent = 0); + ~AccountListPage(); + + QString displayName() const override + { + return tr("Accounts"); + } + QIcon icon() const override + { + auto icon = MMC->getThemedIcon("accounts"); + if(icon.isNull()) + { + icon = MMC->getThemedIcon("noaccount"); + } + return icon; + } + QString id() const override + { + return "accounts"; + } + QString helpPage() const override + { + return "Getting-Started#adding-an-account"; + } public slots: - void on_addAccountBtn_clicked(); + void on_addAccountBtn_clicked(); - void on_rmAccountBtn_clicked(); + void on_rmAccountBtn_clicked(); - void on_setDefaultBtn_clicked(); + void on_setDefaultBtn_clicked(); - void on_noDefaultBtn_clicked(); + void on_noDefaultBtn_clicked(); - void on_uploadSkinBtn_clicked(); + void on_uploadSkinBtn_clicked(); - void listChanged(); + void listChanged(); - //! Updates the states of the dialog's buttons. - void updateButtonStates(); + //! Updates the states of the dialog's buttons. + void updateButtonStates(); protected: - std::shared_ptr<MojangAccountList> m_accounts; + std::shared_ptr<MojangAccountList> m_accounts; protected slots: - void addAccount(const QString& errMsg=""); + void addAccount(const QString& errMsg=""); private: - Ui::AccountListPage *ui; + Ui::AccountListPage *ui; }; diff --git a/application/pages/global/CustomCommandsPage.cpp b/application/pages/global/CustomCommandsPage.cpp index 1352b6be..f2c3b185 100644 --- a/application/pages/global/CustomCommandsPage.cpp +++ b/application/pages/global/CustomCommandsPage.cpp @@ -6,17 +6,17 @@ CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent) { - auto verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); + auto verticalLayout = new QVBoxLayout(this); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + verticalLayout->setContentsMargins(0, 0, 0, 0); - auto tabWidget = new QTabWidget(this); - tabWidget->setObjectName(QStringLiteral("tabWidget")); - commands = new CustomCommands(this); - tabWidget->addTab(commands, "Foo"); - tabWidget->tabBar()->hide(); - verticalLayout->addWidget(tabWidget); - loadSettings(); + auto tabWidget = new QTabWidget(this); + tabWidget->setObjectName(QStringLiteral("tabWidget")); + commands = new CustomCommands(this); + tabWidget->addTab(commands, "Foo"); + tabWidget->tabBar()->hide(); + verticalLayout->addWidget(tabWidget); + loadSettings(); } CustomCommandsPage::~CustomCommandsPage() @@ -25,26 +25,26 @@ CustomCommandsPage::~CustomCommandsPage() bool CustomCommandsPage::apply() { - applySettings(); - return true; + applySettings(); + return true; } void CustomCommandsPage::applySettings() { - auto s = MMC->settings(); - s->set("PreLaunchCommand", commands->prelaunchCommand()); - s->set("WrapperCommand", commands->wrapperCommand()); - s->set("PostExitCommand", commands->postexitCommand()); + auto s = MMC->settings(); + s->set("PreLaunchCommand", commands->prelaunchCommand()); + s->set("WrapperCommand", commands->wrapperCommand()); + s->set("PostExitCommand", commands->postexitCommand()); } void CustomCommandsPage::loadSettings() { - auto s = MMC->settings(); - commands->initialize( - false, - true, - s->get("PreLaunchCommand").toString(), - s->get("WrapperCommand").toString(), - s->get("PostExitCommand").toString() - ); + auto s = MMC->settings(); + commands->initialize( + false, + true, + s->get("PreLaunchCommand").toString(), + s->get("WrapperCommand").toString(), + s->get("PostExitCommand").toString() + ); } diff --git a/application/pages/global/CustomCommandsPage.h b/application/pages/global/CustomCommandsPage.h index 52256ed3..d7206dfa 100644 --- a/application/pages/global/CustomCommandsPage.h +++ b/application/pages/global/CustomCommandsPage.h @@ -24,32 +24,32 @@ class CustomCommandsPage : public QWidget, public BasePage { - Q_OBJECT + Q_OBJECT public: - explicit CustomCommandsPage(QWidget *parent = 0); - ~CustomCommandsPage(); + explicit CustomCommandsPage(QWidget *parent = 0); + ~CustomCommandsPage(); - QString displayName() const override - { - return tr("Custom Commands"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("custom-commands"); - } - QString id() const override - { - return "custom-commands"; - } - QString helpPage() const override - { - return "Custom-commands"; - } - bool apply() override; + QString displayName() const override + { + return tr("Custom Commands"); + } + QIcon icon() const override + { + return MMC->getThemedIcon("custom-commands"); + } + QString id() const override + { + return "custom-commands"; + } + QString helpPage() const override + { + return "Custom-commands"; + } + bool apply() over |
