diff options
| author | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-15 12:16:00 +0300 |
|---|---|---|
| committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-08-15 12:16:00 +0300 |
| commit | c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5 (patch) | |
| tree | 437dec3be224cae5e229eeaa4ac9ebeedffd03e3 /launcher/ui/dialogs | |
| parent | 019e5ca3e819f5daf9933bc0fb091784b0ca561f (diff) | |
| parent | 8f5bb982cd27dd9158b63d826769c168455a139b (diff) | |
| download | PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.gz PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.tar.bz2 PrismLauncher-c94ee67077076fdfb3ad04e93a0de2ae32b6a4e5.zip | |
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into curseforge-url-handle3
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/ui/dialogs')
38 files changed, 447 insertions, 558 deletions
diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp index b1734eff..3c6f6ef1 100644 --- a/launcher/ui/dialogs/AboutDialog.cpp +++ b/launcher/ui/dialogs/AboutDialog.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> * * This program is free software: you can redistribute it and/or modify @@ -34,26 +34,28 @@ */ #include "AboutDialog.h" -#include "BuildConfig.h" -#include "ui_AboutDialog.h" #include <QIcon> #include "Application.h" #include "BuildConfig.h" #include "Markdown.h" +#include "ui_AboutDialog.h" #include <net/NetJob.h> #include <qobject.h> namespace { -QString getLink(QString link, QString name) { +QString getLink(QString link, QString name) +{ return QString("<<a href='%1'>%2</a>>").arg(link).arg(name); } -QString getWebsite(QString link) { +QString getWebsite(QString link) +{ return getLink(link, QObject::tr("Website")); } -QString getGitHub(QString username) { +QString getGitHub(QString username) +{ return getLink("https://github.com/" + username, "GitHub"); } @@ -70,19 +72,19 @@ QString getCreditsHtml() //: %1 is the name of the launcher, determined at build time, e.g. "Prism Launcher Developers" stream << "<h3>" << QObject::tr("%1 Developers", "About Credits").arg(BuildConfig.LAUNCHER_DISPLAYNAME) << "</h3>\n"; - stream << QString("<p>Sefa Eyeoglu (Scrumplex) %1</p>\n") .arg(getWebsite("https://scrumplex.net")); - stream << QString("<p>d-513 %1</p>\n") .arg(getGitHub("d-513")); - stream << QString("<p>txtsd %1</p>\n") .arg(getWebsite("https://ihavea.quest")); - stream << QString("<p>timoreo %1</p>\n") .arg(getGitHub("timoreo22")); - stream << QString("<p>Ezekiel Smith (ZekeSmith) %1</p>\n") .arg(getGitHub("ZekeSmith")); - stream << QString("<p>cozyGalvinism %1</p>\n") .arg(getGitHub("cozyGalvinism")); - stream << QString("<p>DioEgizio %1</p>\n") .arg(getGitHub("DioEgizio")); - stream << QString("<p>flowln %1</p>\n") .arg(getGitHub("flowln")); - stream << QString("<p>ViRb3 %1</p>\n") .arg(getGitHub("ViRb3")); - stream << QString("<p>Rachel Powers (Ryex) %1</p>\n") .arg(getGitHub("Ryex")); - stream << QString("<p>TayouVR %1</p>\n") .arg(getGitHub("TayouVR")); - stream << QString("<p>TheKodeToad %1</p>\n") .arg(getGitHub("TheKodeToad")); - stream << QString("<p>getchoo %1</p>\n") .arg(getGitHub("getchoo")); + stream << QString("<p>Sefa Eyeoglu (Scrumplex) %1</p>\n").arg(getWebsite("https://scrumplex.net")); + stream << QString("<p>d-513 %1</p>\n").arg(getGitHub("d-513")); + stream << QString("<p>txtsd %1</p>\n").arg(getWebsite("https://ihavea.quest")); + stream << QString("<p>timoreo %1</p>\n").arg(getGitHub("timoreo22")); + stream << QString("<p>Ezekiel Smith (ZekeSmith) %1</p>\n").arg(getGitHub("ZekeSmith")); + stream << QString("<p>cozyGalvinism %1</p>\n").arg(getGitHub("cozyGalvinism")); + stream << QString("<p>DioEgizio %1</p>\n").arg(getGitHub("DioEgizio")); + stream << QString("<p>flowln %1</p>\n").arg(getGitHub("flowln")); + stream << QString("<p>ViRb3 %1</p>\n").arg(getGitHub("ViRb3")); + stream << QString("<p>Rachel Powers (Ryex) %1</p>\n").arg(getGitHub("Ryex")); + stream << QString("<p>TayouVR %1</p>\n").arg(getGitHub("TayouVR")); + stream << QString("<p>TheKodeToad %1</p>\n").arg(getGitHub("TheKodeToad")); + stream << QString("<p>getchoo %1</p>\n").arg(getGitHub("getchoo")); stream << "<br />\n"; // TODO: possibly retrieve from git history at build time? @@ -96,20 +98,21 @@ QString getCreditsHtml() stream << "<br />\n"; stream << "<h3>" << QObject::tr("With thanks to", "About Credits") << "</h3>\n"; - stream << QString("<p>Boba %1</p>\n") .arg(getWebsite("https://bobaonline.neocities.org/")); - stream << QString("<p>Davi Rafael %1</p>\n") .arg(getWebsite("https://auti.one/")); - stream << QString("<p>Fulmine %1</p>\n") .arg(getWebsite("https://www.fulmine.xyz/")); - stream << QString("<p>ely %1</p>\n") .arg(getGitHub("elyrodso")); - stream << QString("<p>gon sawa %1</p>\n") .arg(getGitHub("gonsawa")); + stream << QString("<p>Boba %1</p>\n").arg(getWebsite("https://bobaonline.neocities.org/")); + stream << QString("<p>Davi Rafael %1</p>\n").arg(getWebsite("https://auti.one/")); + stream << QString("<p>Fulmine %1</p>\n").arg(getWebsite("https://www.fulmine.xyz/")); + stream << QString("<p>ely %1</p>\n").arg(getGitHub("elyrodso")); + stream << QString("<p>gon sawa %1</p>\n").arg(getGitHub("gonsawa")); stream << QString("<p>Pankakes</p>\n"); - stream << QString("<p>tobimori %1</p>\n") .arg(getGitHub("tobimori")); + stream << QString("<p>tobimori %1</p>\n").arg(getGitHub("tobimori")); stream << "<p>Orochimarufan <<a href='mailto:orochimarufan.x3@gmail.com'>orochimarufan.x3@gmail.com</a>></p>\n"; stream << "<p>TakSuyu <<a href='mailto:taksuyu@gmail.com'>taksuyu@gmail.com</a>></p>\n"; stream << "<p>Kilobyte <<a href='mailto:stiepen22@gmx.de'>stiepen22@gmx.de</a>></p>\n"; stream << "<p>Rootbear75 <<a href='https://twitter.com/rootbear75'>@rootbear75</a>></p>\n"; stream << "<p>Zeker Zhayard <<a href='https://twitter.com/zeker_zhayard'>@Zeker_Zhayard</a>></p>\n"; stream << "<p>Everyone who helped establish our branding!</p>\n"; - stream << "<p>And everyone else who <a href='https://github.com/PrismLauncher/PrismLauncher/graphs/contributors'>contributed</a>!</p>\n"; + stream + << "<p>And everyone else who <a href='https://github.com/PrismLauncher/PrismLauncher/graphs/contributors'>contributed</a>!</p>\n"; stream << "<br />\n"; stream << "</center>\n"; @@ -124,9 +127,9 @@ QString getLicenseHtml() return output; } -} +} // namespace -AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) +AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); @@ -148,7 +151,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia ui->versionLabel->setText(BuildConfig.printableVersionString()); if (!BuildConfig.BUILD_PLATFORM.isEmpty()) - ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM); + ui->platformLabel->setText(tr("Platform") + ": " + BuildConfig.BUILD_PLATFORM); else ui->platformLabel->setVisible(false); @@ -163,7 +166,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia ui->buildDateLabel->setVisible(false); if (!BuildConfig.VERSION_CHANNEL.isEmpty()) - ui->channelLabel->setText(tr("Channel") +": " + BuildConfig.VERSION_CHANNEL); + ui->channelLabel->setText(tr("Channel") + ": " + BuildConfig.VERSION_CHANNEL); else ui->channelLabel->setVisible(false); diff --git a/launcher/ui/dialogs/AboutDialog.h b/launcher/ui/dialogs/AboutDialog.h index 814fd98c..356f005e 100644 --- a/launcher/ui/dialogs/AboutDialog.h +++ b/launcher/ui/dialogs/AboutDialog.h @@ -15,26 +15,23 @@ #pragma once -#include <QDialog> #include <net/NetJob.h> +#include <QDialog> -namespace Ui -{ +namespace Ui { class AboutDialog; } -class AboutDialog : public QDialog -{ +class AboutDialog : public QDialog { Q_OBJECT -public: - explicit AboutDialog(QWidget *parent = 0); + public: + explicit AboutDialog(QWidget* parent = 0); ~AboutDialog(); -private: - Ui::AboutDialog *ui; + private: + Ui::AboutDialog* ui; NetJob::Ptr netJob; QByteArray dataSink; }; - diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp index fdfae597..727c0614 100644 --- a/launcher/ui/dialogs/BlockedModsDialog.cpp +++ b/launcher/ui/dialogs/BlockedModsDialog.cpp @@ -313,7 +313,7 @@ bool BlockedModsDialog::checkValidPath(QString path) // efectivly compare two strings ignoring all separators and case auto laxCompare = [](QString fsfilename, QString metadataFilename) { // allowed character seperators - QList<QChar> allowedSeperators = { '-', '+', '.' , '_'}; + QList<QChar> allowedSeperators = { '-', '+', '.', '_' }; // copy in lowercase auto fsName = fsfilename.toLower(); diff --git a/launcher/ui/dialogs/CopyInstanceDialog.cpp b/launcher/ui/dialogs/CopyInstanceDialog.cpp index d75bb5fe..8b2f5bb8 100644 --- a/launcher/ui/dialogs/CopyInstanceDialog.cpp +++ b/launcher/ui/dialogs/CopyInstanceDialog.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> * * This program is free software: you can redistribute it and/or modify @@ -107,8 +107,8 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget* parent) #if defined(Q_OS_WIN) ui->symbolicLinksCheckbox->setIcon(style()->standardIcon(QStyle::SP_VistaShield)); - ui->symbolicLinksCheckbox->setToolTip(tr("Use symbolic links instead of copying files.") + - "\n" + tr("On Windows, symbolic links may require admin permission to create.")); + ui->symbolicLinksCheckbox->setToolTip(tr("Use symbolic links instead of copying files.") + "\n" + + tr("On Windows, symbolic links may require admin permission to create.")); #endif updateLinkOptions(); @@ -220,7 +220,7 @@ void CopyInstanceDialog::on_iconButton_clicked() } } -void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString& arg1) +void CopyInstanceDialog::on_instNameTextBox_textChanged([[maybe_unused]] const QString& arg1) { updateDialogState(); } diff --git a/launcher/ui/dialogs/CustomMessageBox.cpp b/launcher/ui/dialogs/CustomMessageBox.cpp index 19029f68..1af47a44 100644 --- a/launcher/ui/dialogs/CustomMessageBox.cpp +++ b/launcher/ui/dialogs/CustomMessageBox.cpp @@ -15,13 +15,15 @@ #include "CustomMessageBox.h" -namespace CustomMessageBox -{ -QMessageBox *selectable(QWidget *parent, const QString &title, const QString &text, - QMessageBox::Icon icon, QMessageBox::StandardButtons buttons, +namespace CustomMessageBox { +QMessageBox* selectable(QWidget* parent, + const QString& title, + const QString& text, + QMessageBox::Icon icon, + QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - QMessageBox *messageBox = new QMessageBox(parent); + QMessageBox* messageBox = new QMessageBox(parent); messageBox->setWindowTitle(title); messageBox->setText(text); messageBox->setStandardButtons(buttons); @@ -32,4 +34,4 @@ QMessageBox *selectable(QWidget *parent, const QString &title, const QString &te return messageBox; } -} +} // namespace CustomMessageBox diff --git a/launcher/ui/dialogs/CustomMessageBox.h b/launcher/ui/dialogs/CustomMessageBox.h index 712c6518..a9bc6a24 100644 --- a/launcher/ui/dialogs/CustomMessageBox.h +++ b/launcher/ui/dialogs/CustomMessageBox.h @@ -17,9 +17,10 @@ #include <QMessageBox> -namespace CustomMessageBox -{ -QMessageBox *selectable(QWidget *parent, const QString &title, const QString &text, +namespace CustomMessageBox { +QMessageBox* selectable(QWidget* parent, + const QString& title, + const QString& text, QMessageBox::Icon icon = QMessageBox::NoIcon, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); diff --git a/launcher/ui/dialogs/EditAccountDialog.cpp b/launcher/ui/dialogs/EditAccountDialog.cpp index 002c064b..58036fd8 100644 --- a/launcher/ui/dialogs/EditAccountDialog.cpp +++ b/launcher/ui/dialogs/EditAccountDialog.cpp @@ -14,12 +14,11 @@ */ #include "EditAccountDialog.h" -#include "ui_EditAccountDialog.h" #include <DesktopServices.h> #include <QUrl> +#include "ui_EditAccountDialog.h" -EditAccountDialog::EditAccountDialog(const QString &text, QWidget *parent, int flags) - : QDialog(parent), ui(new Ui::EditAccountDialog) +EditAccountDialog::EditAccountDialog(const QString& text, QWidget* parent, int flags) : QDialog(parent), ui(new Ui::EditAccountDialog) { ui->setupUi(this); @@ -35,12 +34,12 @@ EditAccountDialog::~EditAccountDialog() delete ui; } -void EditAccountDialog::on_label_linkActivated(const QString &link) +void EditAccountDialog::on_label_linkActivated(const QString& link) { DesktopServices::openUrl(QUrl(link)); } -void EditAccountDialog::setUsername(const QString & user) const +void EditAccountDialog::setUsername(const QString& user) const { ui->userTextBox->setText(user); } @@ -50,7 +49,7 @@ QString EditAccountDialog::username() const return ui->userTextBox->text(); } -void EditAccountDialog::setPassword(const QString & pass) const +void EditAccountDialog::setPassword(const QString& pass) const { ui->passTextBox->setText(pass); } diff --git a/launcher/ui/dialogs/EditAccountDialog.h b/launcher/ui/dialogs/EditAccountDialog.h index 6b5eb4aa..7a9ccba7 100644 --- a/launcher/ui/dialogs/EditAccountDialog.h +++ b/launcher/ui/dialogs/EditAccountDialog.h @@ -17,28 +17,24 @@ #include <QDialog> -namespace Ui -{ +namespace Ui { class EditAccountDialog; } -class EditAccountDialog : public QDialog -{ +class EditAccountDialog : public QDialog { Q_OBJECT -public: - explicit EditAccountDialog(const QString &text = "", QWidget *parent = 0, - int flags = UsernameField | PasswordField); + public: + explicit EditAccountDialog(const QString& text = "", QWidget* parent = 0, int flags = UsernameField | PasswordField); ~EditAccountDialog(); - void setUsername(const QString & user) const; - void setPassword(const QString & pass) const; + void setUsername(const QString& user) const; + void setPassword(const QString& pass) const; QString username() const; QString password() const; - enum Flags - { + enum Flags { NoFlags = 0, //! Specifies that the dialog should have a username field. @@ -48,9 +44,9 @@ public: PasswordField, }; -private slots: - void on_label_linkActivated(const QString &link); + private slots: + void on_label_linkActivated(const QString& link); -private: - Ui::EditAccountDialog *ui; + private: + Ui::EditAccountDialog* ui; }; diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp index d6a503cc..703736d6 100644 --- a/launcher/ui/dialogs/ExportInstanceDialog.cpp +++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp @@ -195,8 +195,8 @@ void ExportInstanceDialog::loadPackIgnore() if (!ignoreFile.open(QIODevice::ReadOnly)) { return; } - auto data = ignoreFile.readAll(); - auto string = QString::fromUtf8(data); + auto ignoreData = ignoreFile.readAll(); + auto string = QString::fromUtf8(ignoreData); #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) proxyModel->setBlockedPaths(string.split('\n', Qt::SkipEmptyParts)); #else @@ -206,10 +206,10 @@ void ExportInstanceDialog::loadPackIgnore() void ExportInstanceDialog::savePackIgnore() { - auto data = proxyModel->blockedPaths().toStringList().join('\n').toUtf8(); + auto ignoreData = proxyModel->blockedPaths().toStringList().join('\n').toUtf8(); auto filename = ignoreFileName(); try { - FS::write(filename, data); + FS::write(filename, ignoreData); } catch (const Exception& e) { qWarning() << e.cause(); } diff --git a/launcher/ui/dialogs/IconPickerDialog.cpp b/launcher/ui/dialogs/IconPickerDialog.cpp index 5131686a..faad3ce7 100644 --- a/launcher/ui/dialogs/IconPickerDialog.cpp +++ b/launcher/ui/dialogs/IconPickerDialog.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ +#include <QFileDialog> #include <QKeyEvent> #include <QPushButton> -#include <QFileDialog> #include "Application.h" @@ -24,12 +24,11 @@ #include "ui/instanceview/InstanceDelegate.h" +#include <DesktopServices.h> #include "icons/IconList.h" #include "icons/IconUtils.h" -#include <DesktopServices.h> -IconPickerDialog::IconPickerDialog(QWidget *parent) - : QDialog(parent), ui(new Ui::IconPickerDialog) +IconPickerDialog::IconPickerDialog(QWidget* parent) : QDialog(parent), ui(new Ui::IconPickerDialog) { ui->setupUi(this); setWindowModality(Qt::WindowModal); @@ -69,31 +68,30 @@ IconPickerDialog::IconPickerDialog(QWidget *parent) connect(contentsWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex))); - connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(selectionChanged(QItemSelection, QItemSelection))); + connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + SLOT(selectionChanged(QItemSelection, QItemSelection))); auto buttonFolder = ui->buttonBox->addButton(tr("Open Folder"), QDialogButtonBox::ResetRole); connect(buttonFolder, &QPushButton::clicked, this, &IconPickerDialog::openFolder); } -bool IconPickerDialog::eventFilter(QObject *obj, QEvent *evt) +bool IconPickerDialog::eventFilter(QObject* obj, QEvent* evt) { if (obj != ui->iconView) return QDialog::eventFilter(obj, evt); - if (evt->type() != QEvent::KeyPress) - { + if (evt->type() != QEvent::KeyPress) { return QDialog::eventFilter(obj, evt); } - QKeyEvent *keyEvent = static_cast<QKeyEvent *>(evt); - switch (keyEvent->key()) - { - case Qt::Key_Delete: - removeSelectedIcon(); - return true; - case Qt::Key_Plus: - addNewIcon(); - return true; - default: - break; + QKeyEvent* keyEvent = static_cast<QKeyEvent*>(evt); + switch (keyEvent->key()) { + case Qt::Key_Delete: + removeSelectedIcon(); + return true; + case Qt::Key_Plus: + addNewIcon(); + return true; + default: + break; } return QDialog::eventFilter(obj, evt); } @@ -142,8 +140,7 @@ int IconPickerDialog::execWithSelection(QString selection) int index_nr = list->getIconIndex(selection); auto model_index = list->index(index_nr); - contentsWidget->selectionModel()->select( - model_index, QItemSelectionModel::Current | QItemSelectionModel::Select); + contentsWidget->selectionModel()->select(model_index, QItemSelectionModel::Current | QItemSelectionModel::Select); QMetaObject::invokeMethod(this, "delayed_scroll", Qt::QueuedConnection, Q_ARG(QModelIndex, model_index)); return QDialog::exec(); diff --git a/launcher/ui/dialogs/IconPickerDialog.h b/launcher/ui/dialogs/IconPickerDialog.h index c93f565f..37e53dcc 100644 --- a/launcher/ui/dialogs/IconPickerDialog.h +++ b/launcher/ui/dialogs/IconPickerDialog.h @@ -17,30 +17,27 @@ #include <QDialog> #include <QItemSelection> -namespace Ui -{ +namespace Ui { class IconPickerDialog; } -class IconPickerDialog : public QDialog -{ +class IconPickerDialog : public QDialog { Q_OBJECT -public: - explicit IconPickerDialog(QWidget *parent = 0); + public: + explicit IconPickerDialog(QWidget* parent = 0); ~IconPickerDialog(); int execWithSelection(QString selection); QString selectedIconKey; -protected: - virtual bool eventFilter(QObject *, QEvent *); + protected: + virtual bool eventFilter(QObject*, QEvent*); -private: - Ui::IconPickerDialog *ui; - QPushButton *buttonRemove; + private: + Ui::IconPickerDialog* ui; + QPushButton* buttonRemove; -private -slots: + private slots: void selectionChanged(QItemSelection, QItemSelection); void activated(QModelIndex); void delayed_scroll(QModelIndex); diff --git a/launcher/ui/dialogs/ImportResourceDialog.h b/launcher/ui/dialogs/ImportResourceDialog.h index 5f2f7a92..bbde1ba7 100644 --- a/launcher/ui/dialogs/ImportResourceDialog.h +++ b/launcher/ui/dialogs/ImportResourceDialog.h @@ -17,7 +17,7 @@ class ImportResourceDialog : public QDialog { explicit ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent = nullptr); ~ImportResourceDialog() override; QString selectedInstanceKey; - + private: Ui::ImportResourceDialog* ui; PackedResourceType m_resource_type; diff --git a/launcher/ui/dialogs/LoginDialog.cpp b/launcher/ui/dialogs/LoginDialog.cpp index 30394b72..7296a13e 100644 --- a/launcher/ui/dialogs/LoginDialog.cpp +++ b/launcher/ui/dialogs/LoginDialog.cpp @@ -20,7 +20,7 @@ #include <QtWidgets/QPushButton> -LoginDialog::LoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LoginDialog) +LoginDialog::LoginDialog(QWidget* parent) : QDialog(parent), ui(new Ui::LoginDialog) { ui->setupUi(this); ui->progressBar->setVisible(false); @@ -59,27 +59,24 @@ void LoginDialog::setUserInputsEnabled(bool enable) } // Enable the OK button only when both textboxes contain something. -void LoginDialog::on_userTextBox_textEdited(const QString &newText) +void LoginDialog::on_userTextBox_textEdited(const QString& newText) { - ui->buttonBox->button(QDialogButtonBox::Ok) - ->setEnabled(!newText.isEmpty() && !ui->passTextBox->text().isEmpty()); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!newText.isEmpty() && !ui->passTextBox->text().isEmpty()); } -void LoginDialog::on_passTextBox_textEdited(const QString &newText) +void LoginDialog::on_passTextBox_textEdited(const QString& newText) { - ui->buttonBox->button(QDialogButtonBox::Ok) - ->setEnabled(!newText.isEmpty() && !ui->userTextBox->text().isEmpty()); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!newText.isEmpty() && !ui->userTextBox->text().isEmpty()); } -void LoginDialog::onTaskFailed(const QString &reason) +void LoginDialog::onTaskFailed(const QString& reason) { // Set message auto lines = reason.split('\n'); QString processed; - for(auto line: lines) { - if(line.size()) { + for (auto line : lines) { + if (line.size()) { processed += "<font color='red'>" + line + "</font><br />"; - } - else { + } else { processed += "<br />"; } } @@ -95,7 +92,7 @@ void LoginDialog::onTaskSucceeded() QDialog::accept(); } -void LoginDialog::onTaskStatus(const QString &status) +void LoginDialog::onTaskStatus(const QString& status) { ui->label->setText(status); } @@ -107,12 +104,11 @@ void LoginDialog::onTaskProgress(qi |
