diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-09-26 04:04:09 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-09-26 04:04:09 +0200 |
commit | cca670013463f0062cec950d9b9bb76f9150ed93 (patch) | |
tree | f3a80479a0184f5f25af6c0ca42714cc7ba4e9c5 | |
parent | 0af04dc060cfe94f25d1d3691c8bb87cbab1ecc5 (diff) | |
download | MultiMC-cca670013463f0062cec950d9b9bb76f9150ed93.tar MultiMC-cca670013463f0062cec950d9b9bb76f9150ed93.tar.gz MultiMC-cca670013463f0062cec950d9b9bb76f9150ed93.tar.lz MultiMC-cca670013463f0062cec950d9b9bb76f9150ed93.tar.xz MultiMC-cca670013463f0062cec950d9b9bb76f9150ed93.zip |
NOISSUE fix all clang warnings
52 files changed, 132 insertions, 161 deletions
diff --git a/application/ConsoleWindow.cpp b/application/ConsoleWindow.cpp index 9de0ec5d..239f538e 100644 --- a/application/ConsoleWindow.cpp +++ b/application/ConsoleWindow.cpp @@ -250,7 +250,7 @@ void ConsoleWindow::onProgressRequested(Task* task) { ProgressDialog progDialog(this); m_proc->proceed(); - progDialog.exec(task); + progDialog.execWithTask(task); } diff --git a/application/GuiUtil.cpp b/application/GuiUtil.cpp index edfe9951..442922cd 100644 --- a/application/GuiUtil.cpp +++ b/application/GuiUtil.cpp @@ -26,7 +26,7 @@ void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget) return; } - dialog.exec(paste.get()); + dialog.execWithTask(paste.get()); if (!paste->successful()) { CustomMessageBox::selectable(parentWidget, QObject::tr("Upload failed"), diff --git a/application/LaunchInteraction.cpp b/application/LaunchInteraction.cpp index c7ef942a..497e43ea 100644 --- a/application/LaunchInteraction.cpp +++ b/application/LaunchInteraction.cpp @@ -93,7 +93,7 @@ void LaunchController::login() ProgressDialog progDialog(m_parentWidget); if (m_online) progDialog.setSkipButton(true, tr("Play Offline")); - progDialog.exec(task.get()); + progDialog.execWithTask(task.get()); if (!task->successful()) { auto failReasonNew = task->failReason(); diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index e9f651cb..4ba717d3 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -972,7 +972,7 @@ void MainWindow::downloadUpdates(GoUpdate::Status status) } GoUpdate::DownloadTask updateTask(status, dlPath, &updateDlg); // If the task succeeds, install the updates. - if (updateDlg.exec(&updateTask)) + if (updateDlg.execWithTask(&updateTask)) { MMC->installUpdates(updateTask.updateFilesDir(), updateTask.operations()); } @@ -1065,7 +1065,7 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup, // FIXME: possibly causes endless loop problems ProgressDialog dlDialog(this); - if (dlDialog.exec(&job) != QDialog::Accepted) + if (dlDialog.execWithTask(&job) != QDialog::Accepted) { return nullptr; } @@ -1199,7 +1199,7 @@ void MainWindow::finalizeInstance(InstancePtr inst) CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning) ->show(); }); - loadDialog.exec(update.get()); + loadDialog.execWithTask(update.get()); } else { @@ -1289,7 +1289,7 @@ void MainWindow::on_actionChangeInstIcon_triggered() return; IconPickerDialog dlg(this); - dlg.exec(m_selectedInstance->iconKey()); + dlg.execWithSelection(m_selectedInstance->iconKey()); if (dlg.result() == QDialog::Accepted) { m_selectedInstance->setIconKey(dlg.selectedIconKey); diff --git a/application/VersionProxyModel.cpp b/application/VersionProxyModel.cpp index 743ffad0..4db5cbd0 100644 --- a/application/VersionProxyModel.cpp +++ b/application/VersionProxyModel.cpp @@ -309,8 +309,9 @@ void VersionProxyModel::sourceDataChanged(const QModelIndex &source_top_left, emit dataChanged(topLeft, bottomRight); } -void VersionProxyModel::setSourceModel(BaseVersionList *replacing) +void VersionProxyModel::setSourceModel(QAbstractItemModel *replacingRaw) { + auto replacing = dynamic_cast<BaseVersionList *>(replacingRaw); beginResetModel(); if(!replacing) diff --git a/application/VersionProxyModel.h b/application/VersionProxyModel.h index 68bb816f..19e89271 100644 --- a/application/VersionProxyModel.h +++ b/application/VersionProxyModel.h @@ -36,7 +36,7 @@ public: virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; virtual QModelIndex parent(const QModelIndex &child) const override; - void setSourceModel(BaseVersionList *sourceModel); + virtual void setSourceModel(QAbstractItemModel *sourceModel) override; const FilterMap &filters() const; void setFilter(const BaseVersionList::ModelRoles column, const QString &filter, const bool exact); diff --git a/application/dialogs/CopyInstanceDialog.cpp b/application/dialogs/CopyInstanceDialog.cpp index 0e94540c..54c42f29 100644 --- a/application/dialogs/CopyInstanceDialog.cpp +++ b/application/dialogs/CopyInstanceDialog.cpp @@ -82,7 +82,7 @@ QString CopyInstanceDialog::instGroup() const void CopyInstanceDialog::on_iconButton_clicked() { IconPickerDialog dlg(this); - dlg.exec(InstIconKey); + dlg.execWithSelection(InstIconKey); if (dlg.result() == QDialog::Accepted) { diff --git a/application/dialogs/IconPickerDialog.cpp b/application/dialogs/IconPickerDialog.cpp index 7bde6fd0..f750cd27 100644 --- a/application/dialogs/IconPickerDialog.cpp +++ b/application/dialogs/IconPickerDialog.cpp @@ -126,7 +126,7 @@ void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection selectedIconKey = key; } -int IconPickerDialog::exec(QString selection) +int IconPickerDialog::execWithSelection(QString selection) { auto list = ENV.icons(); auto contentsWidget = ui->iconView; diff --git a/application/dialogs/IconPickerDialog.h b/application/dialogs/IconPickerDialog.h index 610d9306..e57374a7 100644 --- a/application/dialogs/IconPickerDialog.h +++ b/application/dialogs/IconPickerDialog.h @@ -29,7 +29,7 @@ class IconPickerDialog : public QDialog public: explicit IconPickerDialog(QWidget *parent = 0); ~IconPickerDialog(); - int exec(QString selection); + int execWithSelection(QString selection); QString selectedIconKey; protected: diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index 0360f5f1..0d54172d 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -122,9 +122,10 @@ void NewInstanceDialog::updateDialogState() { ui->instNameTextBox->setPlaceholderText(suggestedName); } - bool allowOK = !instName().isEmpty() && - (ui->versionBox->isChecked() && m_selectedVersion || - (ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput())); + bool allowOK = !instName().isEmpty() && ( + (ui->versionBox->isChecked() && m_selectedVersion) || + (ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput()) + ); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK); } @@ -206,7 +207,7 @@ void NewInstanceDialog::on_btnChangeVersion_clicked() void NewInstanceDialog::on_iconButton_clicked() { IconPickerDialog dlg(this); - dlg.exec(InstIconKey); + dlg.execWithSelection(InstIconKey); if (dlg.result() == QDialog::Accepted) { diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp index 83f82d33..bca4e168 100644 --- a/application/dialogs/ProgressDialog.cpp +++ b/application/dialogs/ProgressDialog.cpp @@ -52,7 +52,7 @@ void ProgressDialog::updateSize() resize(QSize(480, minimumSizeHint().height())); } -int ProgressDialog::exec(Task *task) +int ProgressDialog::execWithTask(Task *task) { this->task = task; QDialog::DialogCode result; diff --git a/application/dialogs/ProgressDialog.h b/application/dialogs/ProgressDialog.h index 44cbbe88..9ddbceb1 100644 --- a/application/dialogs/ProgressDialog.h +++ b/application/dialogs/ProgressDialog.h @@ -34,7 +34,7 @@ public: void updateSize(); - int exec(Task *task); + int execWithTask(Task *task); void setSkipButton(bool present, QString label = QString()); diff --git a/application/pages/InstanceSettingsPage.h b/application/pages/InstanceSettingsPage.h index f85de678..1fc0bdfe 100644 --- a/application/pages/InstanceSettingsPage.h +++ b/application/pages/InstanceSettingsPage.h @@ -49,12 +49,12 @@ public: { return "settings"; } - virtual bool apply(); + virtual bool apply() override; virtual QString helpPage() const override { return "Instance-settings"; } - virtual bool shouldDisplay() const; + virtual bool shouldDisplay() const override; private slots: void on_javaDetectBtn_clicked(); diff --git a/application/pages/LegacyJarModPage.h b/application/pages/LegacyJarModPage.h index 9ca862ff..698e7ff6 100644 --- a/application/pages/LegacyJarModPage.h +++ b/application/pages/LegacyJarModPage.h @@ -36,15 +36,15 @@ public: explicit LegacyJarModPage(LegacyInstance *inst, QWidget *parent = 0); virtual ~LegacyJarModPage(); - virtual QString displayName() const + virtual QString displayName() const override { return tr("Jar Mods"); } - virtual QIcon icon() const + virtual QIcon icon() const override { return MMC->getThemedIcon("jarmods"); } - virtual QString id() const + virtual QString id() const override { return "jarmods"; } @@ -52,7 +52,7 @@ public: { return "Legacy-jar-mods"; } - virtual bool shouldDisplay() const; + virtual bool shouldDisplay() const override; private slots: diff --git a/application/pages/LegacyUpgradePage.h b/application/pages/LegacyUpgradePage.h index f39bff95..8d1131c8 100644 --- a/application/pages/LegacyUpgradePage.h +++ b/application/pages/LegacyUpgradePage.h @@ -49,7 +49,7 @@ public: { return "Legacy-upgrade"; } - virtual bool shouldDisplay() const; + virtual bool shouldDisplay() const override; private slots: void on_upgradeButton_clicked(); diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h index 169319a3..b34a63af 100644 --- a/application/pages/LogPage.h +++ b/application/pages/LogPage.h @@ -48,13 +48,13 @@ public: { return "console"; } - virtual bool apply(); + virtual bool apply() override; virtual QString helpPage() const override { return "Minecraft-Logs"; } - virtual bool shouldDisplay() const; - virtual void setParentContainer(BasePageContainer *); + virtual bool shouldDisplay() const override; + virtual void setParentContainer(BasePageContainer *) override; private slots: /** diff --git a/application/pages/ModFolderPage.h b/application/pages/ModFolderPage.h index cbd98cb7..0870aa64 100644 --- a/application/pages/ModFolderPage.h +++ b/application/pages/ModFolderPage.h @@ -58,12 +58,12 @@ public: { return m_helpName; } - virtual bool shouldDisplay() const; + virtual bool shouldDisplay() const override; - virtual void opened(); - virtual void closed(); + virtual void opened() override; + virtual void closed() override; protected: - bool eventFilter(QObject *obj, QEvent *ev); + bool eventFilter(QObject *obj, QEvent *ev) override; bool modListFilter(QKeyEvent *ev); protected: diff --git a/application/pages/NotesPage.h b/application/pages/NotesPage.h index e9e5aa48..c259d60e 100644 --- a/application/pages/NotesPage.h +++ b/application/pages/NotesPage.h @@ -48,7 +48,7 @@ public: { return "notes"; } - virtual bool apply(); + virtual bool apply() override; virtual QString helpPage() const override { return "Notes"; diff --git a/application/pages/ScreenshotsPage.cpp b/application/pages/ScreenshotsPage.cpp index 9174b33b..2a8d7a43 100644 --- a/application/pages/ScreenshotsPage.cpp +++ b/application/pages/ScreenshotsPage.cpp @@ -73,7 +73,6 @@ public: small = image.scaledToWidth(512).scaledToWidth(256, Qt::SmoothTransformation); else small = image.scaledToHeight(512).scaledToHeight(256, Qt::SmoothTransformation); - auto smallSize = small.size(); QPoint offset((256 - small.width()) / 2, (256 - small.height()) / 2); QImage square(QSize(256, 256), QImage::Format_ARGB32); square.fill(Qt::transparent); @@ -302,7 +301,7 @@ void ScreenshotsPage::on_uploadBtn_clicked() task.addTask(job.unwrap()); task.addTask(albumTask.unwrap()); ProgressDialog prog(this); - if (prog.exec(&task) != QDialog::Accepted) + if (prog.execWithTask(&task) != QDialog::Accepted) { CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), tr("Unknown error"), QMessageBox::Warning)->exec(); diff --git a/application/pages/ScreenshotsPage.h b/application/pages/ScreenshotsPage.h index f5700ba8..f19ff35f 100644 --- a/application/pages/ScreenshotsPage.h +++ b/application/pages/ScreenshotsPage.h @@ -46,7 +46,7 @@ public: NothingDone = 0x42 }; - virtual bool eventFilter(QObject *, QEvent *); + virtual bool eventFilter(QObject *, QEvent *) override; virtual QString displayName() const override { return tr("Screenshots"); diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index 36091630..e6933da7 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -275,7 +275,7 @@ int VersionPage::doUpdate() } ProgressDialog tDialog(this); connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); - int ret = tDialog.exec(updateTask.get()); + int ret = tDialog.execWithTask(updateTask.get()); updateButtons(); return ret; } @@ -290,7 +290,7 @@ void VersionPage::on_forgeBtn_clicked() if (vselect.exec() && vselect.selectedVersion()) { ProgressDialog dialog(this); - dialog.exec( + dialog.execWithTask( ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); preselect(m_version->rowCount(QModelIndex())-1); } @@ -307,7 +307,7 @@ void VersionPage::on_liteloaderBtn_clicked() if (vselect.exec() && vselect.selectedVersion()) { ProgressDialog dialog(this); - dialog.exec( + dialog.execWithTask( LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); preselect(m_version->rowCount(QModelIndex())-1); } @@ -447,7 +447,7 @@ void VersionPage::on_revertBtn_clicked() return; } } - if(!m_version->revert(version)) + if(!m_version->revertToBase(version)) { // TODO: some error box here } diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h index bd22e140..8f2bf024 100644 --- a/application/pages/VersionPage.h +++ b/application/pages/VersionPage.h @@ -45,9 +45,9 @@ public: { return "Instance-Versions"; } - virtual bool shouldDisplay() const; + virtual bool shouldDisplay() const override; - virtual void setParentContainer(BasePageContainer *); + virtual void setParentContainer(BasePageContainer *) override; private slots: void on_forgeBtn_clicked(); diff --git a/application/pages/WorldListPage.cpp b/application/pages/WorldListPage.cpp index a952d02c..6bea9dbd 100644 --- a/application/pages/WorldListPage.cpp +++ b/application/pages/WorldListPage.cpp @@ -31,7 +31,7 @@ WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr<WorldList> worlds, QString id, QString iconName, QString displayName, QString helpPage, QWidget *parent) - : QWidget(parent), ui(new Ui::WorldListPage), m_worlds(worlds), m_inst(inst), m_id(id), m_displayName(displayName), m_iconName(iconName), m_helpName(helpPage) + : QWidget(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds), m_iconName(iconName), m_id(id), m_displayName(displayName), m_helpName(helpPage) { ui->setupUi(this); ui->tabWidget->tabBar()->hide(); diff --git a/application/pages/WorldListPage.h b/application/pages/WorldListPage.h index 5cf0966a..1ef441a6 100644 --- a/application/pages/WorldListPage.h +++ b/application/pages/WorldListPage.h @@ -54,13 +54,13 @@ public: { return m_helpName; } - virtual bool shouldDisplay() const; + virtual bool shouldDisplay() const override; - virtual void opened(); - virtual void closed(); + virtual void opened() override; + virtual void closed() override; protected: - bool eventFilter(QObject *obj, QEvent *ev); + bool eventFilter(QObject *obj, QEvent *ev) override; bool worldListFilter(QKeyEvent *ev); protected: diff --git a/application/pages/global/ExternalToolsPage.h b/application/pages/global/ExternalToolsPage.h index b7db8450..01fe8880 100644 --- a/application/pages/global/ExternalToolsPage.h +++ b/application/pages/global/ExternalToolsPage.h @@ -53,7 +53,7 @@ public: { return "Tools"; } - virtual bool apply(); + virtual bool apply() override; private: void loadSettings(); diff --git a/application/widgets/VersionListView.h b/application/widgets/VersionListView.h index 4fcbd8ee..8f16344e 100644 --- a/application/widgets/VersionListView.h +++ b/application/widgets/VersionListView.h @@ -25,7 +25,7 @@ public: explicit VersionListView(QWidget *parent = 0); virtual void paintEvent(QPaintEvent *event) override; - virtual void setModel ( QAbstractItemModel* model ); + virtual void setModel(QAbstractItemModel* model) override; enum EmptyMode { diff --git a/logic/BaseInstaller.h b/logic/BaseInstaller.h index dd804085..a50c8cb1 100644 --- a/logic/BaseInstaller.h +++ b/logic/BaseInstaller.h @@ -24,7 +24,7 @@ class QDir; class QString; class QObject; class Task; -struct BaseVersion; +class BaseVersion; typedef std::shared_ptr<BaseVersion> BaseVersionPtr; class MULTIMC_LOGIC_EXPORT BaseInstaller diff --git a/logic/BaseVersion.h b/logic/BaseVersion.h index 053fa7d2..80767518 100644 --- a/logic/BaseVersion.h +++ b/logic/BaseVersion.h @@ -22,8 +22,9 @@ /*! * An abstract base class for versions. */ -struct BaseVersion +class BaseVersion { +public: virtual ~BaseVersion() {} /*! * A string used to identify this version in config files. diff --git a/logic/BaseVersionList.h b/logic/BaseVersionList.h index e8d0cca7..42ea77c0 100644 --- a/logic/BaseVersionList.h +++ b/logic/BaseVersionList.h @@ -104,7 +104,7 @@ public: /*! * Sorts the version list. */ - virtual void sort() = 0; + virtual void sortVersions() = 0; protected slots: diff --git a/logic/NullInstance.h b/logic/NullInstance.h index cf304f9f..dc2a8de3 100644 --- a/logic/NullInstance.h +++ b/logic/NullInstance.h @@ -16,11 +16,11 @@ public: virtual void cleanupAfterRun() override { } - virtual QString currentVersionId() const + virtual QString currentVersionId() const override { return "Null"; }; - virtual QString intendedVersionId() const + virtual QString intendedVersionId() const override { return "Null"; }; @@ -35,50 +35,50 @@ public: { return false; }; - virtual QSet< QString > traits() + virtual QSet< QString > traits() override { return {}; }; - virtual QString instanceConfigFolder() const + virtual QString instanceConfigFolder() const override { return instanceRoot(); }; - virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr) + virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr) override { return nullptr; } - virtual std::shared_ptr< Task > createUpdateTask() + virtual std::shared_ptr< Task > createUpdateTask() override { return nullptr; } - virtual std::shared_ptr<Task> createJarModdingTask() + virtual std::shared_ptr<Task> createJarModdingTask() override { return nullptr; } - virtual void setShouldUpdate(bool) + virtual void setShouldUpdate(bool) override { }; - virtual std::shared_ptr< BaseVersionList > versionList() const + virtual std::shared_ptr< BaseVersionList > versionList() const override { return nullptr; }; - virtual QProcessEnvironment createEnvironment() + virtual QProcessEnvironment createEnvironment() override { return QProcessEnvironment(); } - virtual QMap<QString, QString> getVariables() const + virtual QMap<QString, QString> getVariables() const override { return QMap<QString, QString>(); } - virtual IPathMatcher::Ptr getLogFileMatcher() + virtual IPathMatcher::Ptr getLogFileMatcher() override { return nullptr; } - virtual QString getLogFileRoot() + virtual QString getLogFileRoot() override { return instanceRoot(); } - virtual QString typeName() const + virtual QString typeName() const override { return "Null"; } diff --git a/logic/auth/MojangAccount.h b/logic/auth/MojangAccount.h index 5cf8a0f2..2de0c19c 100644 --- a/logic/auth/MojangAccount.h +++ b/logic/auth/MojangAccount.h @@ -26,7 +26,6 @@ #include "AuthSession.h" #include "multimc_logic_export.h" -MULTIMC_LOGIC_EXPORT class Task; class YggdrasilTask; diff --git a/logic/auth/YggdrasilTask.h b/logic/auth/YggdrasilTask.h index e81eeb44..d989bee3 100644 --- a/logic/auth/YggdrasilTask.h +++ b/logic/auth/YggdrasilTask.h @@ -83,7 +83,7 @@ public: protected: - virtual void executeTask(); + virtual void executeTask() override; /** * Gets the JSON object that will be sent to the authentication server. diff --git a/logic/forge/ForgeVersionList.cpp b/logic/forge/ForgeVersionList.cpp index 7c0e851a..7f2176fd 100644 --- a/logic/forge/ForgeVersionList.cpp +++ b/logic/forge/ForgeVersionList.cpp @@ -108,7 +108,7 @@ void ForgeVersionList::updateListData(QList<BaseVersionPtr> versions) // sort(); } -void ForgeVersionList::sort() +void ForgeVersionList::sortVersions() { // NO-OP for now } diff --git a/logic/forge/ForgeVersionList.h b/logic/forge/ForgeVersionList.h index e2e8c3f8..dbf4b5de 100644 --- a/logic/forge/ForgeVersionList.h +++ b/logic/forge/ForgeVersionList.h @@ -35,20 +35,20 @@ public: explicit ForgeVersionList(QObject *parent = 0); - virtual Task *getLoadTask(); - virtual bool isLoaded(); - virtual const BaseVersionPtr at(int i) const; - virtual int count() const; - virtual void sort(); + virtual Task *getLoadTask() override; + virtual bool isLoaded() override; + virtual const BaseVersionPtr at(int i) const override; + virtual int count() const override; + virtual void sortVersions() override; - virtual BaseVersionPtr getLatestStable() const; + virtual BaseVersionPtr getLatestStable() const override; ForgeVersionPtr findVersionByVersionNr(QString version); - virtual QVariant data(const QModelIndex &index, int role) const; + virtual QVariant data(const QModelIndex &index, int role) const override; virtual QList<ModelRoles> providesRoles() override; - virtual int columnCount(const QModelIndex &parent) const; + virtual int columnCount(const QModelIndex &parent) const override; protected: QList<BaseVersionPtr> m_vlist; @@ -57,7 +57,7 @@ protected: protected slots: - virtual void updateListData(QList<BaseVersionPtr> versions); + virtual void updateListData(QList<BaseVersionPtr> versions) override; }; class ForgeListLoadTask : public Task diff --git a/logic/ftb/OneSixFTBInstance.h b/logic/ftb/OneSixFTBInstance.h index c53a2ed8..35d8216b 100644 --- a/logic/ftb/OneSixFTBInstance.h +++ b/logic/ftb/OneSixFTBInstance.h @@ -13,16 +13,16 @@ public: void copy(const QDir &newDir) override; - virtual void createProfile(); + virtual void createProfile() override; virtual std::shared_ptr<Task> createUpdateTask() override; - virtual QString id() const; + virtual QString id() const override; QDir librariesPath() const override; QDir versionsPath() const override; bool providesVersionFile() const override; - virtual QString typeName() const; + virtual QString typeName() const override; private: SettingsObjectPtr m_globalSettings; diff --git a/logic/java/JavaCheckerJob.h b/logic/java/JavaCheckerJob.h index 23003a03..d031c435 100644 --- a/logic/java/JavaCheckerJob.h +++ b/logic/java/JavaCheckerJob.h @@ -59,7 +59,7 @@ public: { return javacheckers.size(); } - virtual bool isRunning() const + virtual bool isRunning() const override { return m_running; } diff --git a/logic/java/JavaVersionList.cpp b/logic/java/JavaVersionList.cpp index a463ca6c..e3929f45 100644 --- a/logic/java/JavaVersionList.cpp +++ b/logic/java/JavaVersionList.cpp @@ -104,7 +104,7 @@ void JavaVersionList::updateListData(QList<BaseVersionPtr> versions) m_vlist.push_back(std::make_shared<JavaVersion>("1.9.0_1", "32", "/foo/bar/baz")); m_vlist.push_back(std::make_shared<JavaVersion>("1.9.0_1", "64", "/foo/bar/baz")); */ - sort(); + sortVersions(); if(m_vlist.size()) { auto best = std::dynamic_pointer_cast<JavaVersion>(m_vlist[0]); @@ -136,7 +136,7 @@ bool sortJavas(BaseVersionPtr left, BaseVersionPtr right) return labove19 < rabove19; } -void JavaVersionList::sort() +void JavaVersionList::sortVersions() { beginResetModel(); std::sort(m_vlist.begin(), m_vlist.end(), sortJavas); diff --git a/logic/java/JavaVersionList.h b/logic/java/JavaVersionList.h index 905a5a7b..3acb5343 100644 --- a/logic/java/JavaVersionList.h +++ b/logic/java/JavaVersionList.h @@ -66,13 +66,13 @@ public: virtual bool isLoaded() override; virtual const BaseVersionPtr at(int i) const override; virtual int count() const override; - virtual void sort() override; + virtual void sortVersions() override; virtual QVariant data(const QModelIndex &index, int role) const override; virtual RoleList providesRoles() override; public slots: - virtual void updateListData(QList<BaseVersionPtr> versions); + virtual void updateListData(QList<BaseVersionPtr> versions) override; protected: QList<BaseVersionPtr> m_vlist; diff --git a/logic/launch/LaunchTask.h b/logic/launch/LaunchTask.h index eb13a72d..447445ca 100644 --- a/logic/launch/LaunchTask.h +++ b/logic/launch/LaunchTask.h @@ -85,8 +85,8 @@ public: QString censorPrivateInfo(QString in); protected: /* methods */ - virtual void emitFailed(QString reason); - virtual void emitSucceeded(); + virtual void emitFailed(QString reason) override; + virtual void emitSucceeded() override; signals: /** diff --git a/logic/liteloader/LiteLoaderVersionList.cpp b/logic/liteloader/LiteLoaderVersionList.cpp index 21bb4f50..c1b43cb8 100644 --- a/logic/liteloader/LiteLoaderVersionList.cpp +++ b/logic/liteloader/LiteLoaderVersionList.cpp @@ -61,7 +61,7 @@ static bool cmpVersions(BaseVersionPtr first, BaseVersionPtr second) return left->timestamp > right->timestamp; } -void LiteLoaderVersionList::sort() +void LiteLoaderVersionList::sortVersions() { beginResetModel(); std::sort(m_vlist.begin(), m_vlist.end(), cmpVersions); diff --git a/logic/liteloader/LiteLoaderVersionList.h b/logic/liteloader/LiteLoaderVersionList.h index e25f2c64..43bb270d 100644 --- a/logic/liteloader/LiteLoaderVersionList.h +++ b/logic/liteloader/LiteLoaderVersionList.h @@ -79,7 +79,7 @@ public: virtual bool isLoaded(); virtual const BaseVersionPtr at(int i) const; virtual int count() const; - virtual void sort(); + virtual void sortVersions(); virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QList< ModelRoles > providesRoles(); diff --git a/logic/minecraft/LegacyInstance.cpp b/logic/minecraft/LegacyInstance.cpp index f39f3c8b..342a6f2d 100644 --- a/logic/minecraft/LegacyInstance.cpp +++ b/logic/minecraft/LegacyInstance.cpp @@ -186,7 +186,7 @@ std::shared_ptr<Task> LegacyInstance::createJarModdingTask() class JarModTask : public Task { public: - explicit JarModTask(std::shared_ptr<LegacyInstance> inst) : m_inst(inst), Task(nullptr) + explicit JarModTask(std::shared_ptr<LegacyInstance> inst) : Task(nullptr), m_inst(inst) { } virtual void executeTask() diff --git a/logic/minecraft/LegacyInstance.h b/logic/minecraft/LegacyInstance.h index 14f13b20..a2ab86de 100644 --- a/logic/minecraft/LegacyInstance.h +++ b/logic/minecraft/LegacyInstance.h @@ -29,7 +29,7 @@ public: explicit LegacyInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir); - virtual void init() {}; + virtual void init() override {}; /// Path to the instance's minecraft.jar QString runnableJar() const; @@ -105,7 +105,7 @@ public: virtual QString intendedVersionId() const override; virtual bool setIntendedVersionId(QString version) override; - virtual QSet<QString> traits() + virtual QSet<QString> traits() override { return {"legacy-instance", "texturepacks"}; }; @@ -120,7 +120,7 @@ public: virtual void cleanupAfterRun() override; - virtual QString typeName() const; + virtual QString typeName() const override; protected: mutable std::shared_ptr<ModList> jar_mod_list; diff --git a/logic/minecraft/LwjglVersionList.h b/logic/minecraft/LwjglVersionList.h index 84abaab1..f043f6e2 100644 --- a/logic/minecraft/LwjglVersionList.h +++ b/logic/minecraft/LwjglVersionList.h @@ -68,7 +68,7 @@ class MULTIMC_LOGIC_EXPORT LWJGLVersionList : public BaseVersionList public: explicit LWJGLVersionList(QObject *parent = 0); - bool isLoaded() + bool isLoaded() override { return m_vlist.length() > 0; } @@ -77,27 +77,27 @@ public: return m_vlist[i]; } - virtual Task* getLoadTask() + virtual Task* getLoadTask() override { return nullptr; } - virtual void sort() {}; + virtual void sortVersions() override {}; - virtual void updateListData(QList< BaseVersionPtr > versions) {}; + virtual void updateListData(QList< BaseVersionPtr > versions) override {}; - int count() const + int count() const override { return m_vlist.length(); } - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - virtual int rowCount(const QModelIndex &parent) const + virtual QVariant data(const QModelIndex &index, int role) const override; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + virtual int rowCount(const QModelIndex &parent) const override { return count(); } - virtual int columnCount(const QModelIndex &parent) const; + virtual int columnCount(const QModelIndex &parent) const override; virtual bool isLoading() const; virtual bool errored() const diff --git a/logic/minecraft/MinecraftInstance.h b/logic/minecraft/MinecraftInstance.h index b5483d1b..5381ce4f 100644 --- a/logic/minecraft/MinecraftInstance.h +++ b/logic/minecraft/MinecraftInstance.h @@ -37,7 +37,7 @@ public: } //FIXME: nuke? - virtual std::shared_ptr< BaseVersionList > versionList() const; + virtual std::shared_ptr<BaseVersionList> versionList() const override; /// get arguments passed to java QStringList javaArguments() const; @@ -49,7 +49,7 @@ public: virtual QProcessEnvironment createEnvironment() override; /// guess log level from a line of minecraft log - virtual MessageLevel::Enum guessLevel(const QString &line, MessageLevel::Enum level); + virtual MessageLevel::Enum guessLevel(const QString &line, MessageLevel::Enum level) override; virtual IPathMatcher::Ptr getLogFileMatcher() override; diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp index 1baf008e..efeb254b 100644 --- a/logic/minecraft/MinecraftProfile.cpp +++ b/logic/minecraft/MinecraftProfile.cpp @@ -150,7 +150,7 @@ bool MinecraftProfile::customize(int index) return true; } -bool MinecraftProfile::revert(int index) +bool MinecraftProfile::revertToBase(int index) { auto patch = versionPatch(index); if (!patch->isRevertible()) diff --git a/logic/minecraft/MinecraftProfile.h b/logic/minecraft/MinecraftProfile.h index 6f56e848..7686c55b 100644 --- a/logic/minecraft/MinecraftProfile.h +++ b/logic/minecraft/MinecraftProfile.h @@ -45,11 +45,11 @@ public: void setStrategy(ProfileStrategy * strategy); ProfileStrategy *strategy(); - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent) const; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; + virtual int columnCount(const QModelIndex &parent) const override; + virtual Qt::ItemFlags flags(const QModelIndex &index) const override; /// is this version unchanged by the user? bool isVanilla(); @@ -75,7 +75,7 @@ public: bool customize(int index); - bool revert(int index); + bool revertToBase(int index); void resetOrder(); diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index 8ba51b99..afa7c4c5 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -335,7 +335,7 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s } } -void MinecraftVersionList::sort() +void MinecraftVersionList::sortVersions() { beginResetModel(); sortInternal(); diff --git a/logic/minecraft/MinecraftVersionList.h b/logic/minecraft/MinecraftVersionList.h index 110f8a66..e414a1da 100644 --- a/logic/minecraft/MinecraftVersionList.h +++ b/logic/minecraft/MinecraftVersionList.h @@ -47,13 +47,13 @@ public: std::shared_ptr<Task> createUpdateTask(QString version); - virtual Task *getLoadTask(); - virtual bool isLoaded(); - virtual const BaseVersionPtr at(int i) const; - virtual int count() const; - virtual void sort(); - virtual QVariant data(const QModelIndex & index, int role) const; - virtual RoleList providesRoles(); + virtual Task *getLoadTask() override; + virtual bool isLoaded() override; + virtual const BaseVersionPtr at(int i) const override; + virtual int count() const override; + virtual void sortVersions() override; + virtual QVariant data(const QModelIndex & index, int role) const override; + virtual RoleList providesRoles() override; virtual BaseVersionPtr getLatestStable() const override; virtual BaseVersionPtr getRecommended() const override; @@ -69,5 +69,5 @@ protected: protected slots: - virtual void updateListData(QList<BaseVersionPtr> versions); + virtual void updateListData(QList<BaseVersionPtr> versions) override; }; diff --git a/logic/minecraft/OneSixInstance.h b/logic/minecraft/OneSixInstance.h index 6d09b81a..824e3786 100644 --- a/logic/minecraft/OneSixInstance.h +++ b/logic/minecraft/OneSixInstance.h @@ -29,7 +29,7 @@ public: explicit OneSixInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir); virtual ~OneSixInstance(){}; - virtual void init(); + virtual void init() override; ////// Mod Lists ////// std::shared_ptr<ModList> loaderModList() const; @@ -40,7 +40,7 @@ public: virtual QList<Mod> getJarMods() const override; virtual void createProfile(); - virtual QSet<QString> traits(); + virtual QSet<QString> traits() override; ////// Directories and files ////// QString jarModsDir() const; @@ -90,7 +90,7 @@ public: std::shared_ptr<OneSixInstance> getSharedPtr(); - virtual QString typeName() const; + virtual QString typeName() const override; signals: void versionReloaded(); diff --git a/logic/settings/INISettingsObject.h b/logic/settings/INISettingsObject.h index 426b62f5..4afa2a2c 100644 --- a/logic/settings/INISettingsObject.h +++ b/logic/settings/INISettingsObject.h @@ -49,15 +49,15 @@ public: bool reload() override; - void suspendSave(); - void resumeSave(); + void suspendSave() override; + void resumeSave() override; protected slots: - virtual void changeSetting(const Setting &setting, QVariant value); - virtual void resetSetting(const Setting &setting); + virtual void changeSetting(const Setting &setting, QVariant value) override; + virtual void resetSetting(const Setting &setting) override; protected: - virtual QVariant retrieveValue(const Setting &setting); + virtual QVariant retrieveValue(const Setting &setting) override; void doSave(); protected: diff --git a/tests/tst_modutils.cpp b/tests/tst_modutils.cpp index 96d37d6e..4d9fe35f 100644 --- a/tests/tst_modutils.cpp +++ b/tests/tst_modutils.cpp @@ -98,11 +98,11 @@ private slots: QCOMPARE(Util::versionIsInInterval(version, interval), result); } - void test_versionCompareLessThan_data() + void test_versionCompare_data() { setupVersions(); } - void test_versionCompareLessThan() + void test_versionCompare() { QFETCH(QString, first); QFETCH(QString, second); @@ -113,37 +113,7 @@ private slots: const auto v2 = Util::Version(second); QCOMPARE(v1 < v2, lessThan); - } - void test_versionCompareGreaterThan_data() - { - setupVersions(); - } - void test_versionCompareGreaterThan() - { - QFETCH(QString, first); - QFETCH(QString, second); - QFETCH(bool, lessThan); - QFETCH(bool, equal); - - const auto v1 = Util::Version(first); - const auto v2 = Util::Version(second); - QCOMPARE(v1 > v2, !lessThan && !equal); - } - void test_versionCompareEqual_data() - { - setupVersions(); - } - void test_versionCompareEqual() - { - QFETCH(QString, first); - QFETCH(QString, second); - QFETCH(bool, lessThan); - QFETCH(bool, equal); - - const auto v1 = Util::Version(first); - const auto v2 = Util::Version(second); - QCOMPARE(v1 == v2, equal); } }; |