From b05eb9d9e79121ffd1e697921f6112e306a294c3 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Tue, 28 Apr 2026 22:26:30 -0500 Subject: clang-tidy: apply auto-fixes from safest checks across our authored code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ran sequentially (not parallel — concurrent fixes corrupt shared headers) on src/src/ + libs/skse_log_redirector/. The check set: - modernize-use-override - modernize-use-nullptr - modernize-use-default-member-init - readability-redundant-member-init - readability-container-contains - readability-container-size-empty Net effect: ~108 files updated, 425/426 lines changed (overrides added, NULL/0 -> nullptr, member-init lists pruned where the same value is already in the in-class default). Build verified after revert/re-apply. Also disable readability-redundant-access-specifiers in .clang-tidy: the check is confused by Qt's `private slots:` specifier and strips the `private:` that follows it, breaking MOC. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/src/aboutdialog.h | 4 +- src/src/activatemodsdialog.cpp | 2 +- src/src/activatemodsdialog.h | 4 +- src/src/apiuseraccount.cpp | 2 +- src/src/apiuseraccount.h | 2 +- src/src/archivefiletree.cpp | 18 ++-- src/src/categories.cpp | 8 +- src/src/categories.h | 4 +- src/src/categoriesdialog.cpp | 16 ++-- src/src/categoriesdialog.h | 4 +- src/src/categoriestable.h | 6 +- src/src/categoryimportdialog.h | 4 +- src/src/colortable.cpp | 2 +- src/src/colortable.h | 2 +- src/src/commandline.cpp | 32 +++---- src/src/commandline.h | 2 +- src/src/createinstancedialog.cpp | 3 +- src/src/createinstancedialog.h | 6 +- src/src/createinstancedialogpages.cpp | 18 ++-- src/src/createinstancedialogpages.h | 20 ++--- src/src/credentialsdialog.h | 4 +- src/src/csvbuilder.cpp | 4 +- src/src/csvbuilder.h | 8 +- src/src/datatab.cpp | 4 +- src/src/datatab.h | 2 +- src/src/directoryrefresher.cpp | 8 +- src/src/directoryrefresher.h | 8 +- src/src/downloadlist.h | 14 ++-- src/src/downloadlistview.h | 8 +- src/src/downloadmanager.cpp | 12 +-- src/src/downloadmanager.h | 23 +++-- src/src/downloadmanagerproxy.h | 2 +- src/src/editexecutablesdialog.cpp | 2 +- src/src/editexecutablesdialog.h | 4 +- src/src/env.cpp | 4 +- src/src/env.h | 10 +-- src/src/envfs.h | 4 +- src/src/envmetrics.cpp | 2 +- src/src/envmetrics.h | 6 +- src/src/envmodule.cpp | 2 +- src/src/envwindows.cpp | 2 +- src/src/envwindows.h | 4 +- src/src/executableslist.h | 8 +- src/src/filedialogmemory.h | 6 +- src/src/filetreeitem.cpp | 4 +- src/src/filetreeitem.h | 8 +- src/src/filetreemodel.cpp | 10 +-- src/src/filetreemodel.h | 6 +- src/src/filterlist.cpp | 10 +-- src/src/forcedloaddialog.h | 2 +- src/src/forcedloaddialogwidget.h | 2 +- src/src/fuseconnector.cpp | 4 +- src/src/fuseconnector.h | 2 +- src/src/game_features.cpp | 2 +- src/src/game_features.h | 2 +- src/src/genericicondelegate.h | 4 +- src/src/github.h | 8 +- src/src/icondelegate.cpp | 6 +- src/src/icondelegate.h | 2 +- src/src/iconfetcher.cpp | 2 +- src/src/iconfetcher.h | 2 +- src/src/installationmanager.cpp | 8 +- src/src/installationmanager.h | 14 ++-- src/src/instancemanager.cpp | 2 +- src/src/instancemanager.h | 2 +- src/src/instancemanagerdialog.cpp | 4 +- src/src/instancemanagerdialog.h | 6 +- src/src/lcdnumber.h | 2 +- src/src/listdialog.cpp | 4 +- src/src/listdialog.h | 2 +- src/src/loghighlighter.h | 4 +- src/src/loglist.cpp | 2 +- src/src/loglist.h | 2 +- src/src/mainwindow.cpp | 14 ++-- src/src/mainwindow.h | 34 ++++---- src/src/messagedialog.h | 4 +- src/src/moapplication.cpp | 2 +- src/src/modidlineedit.h | 6 +- src/src/modinfo.cpp | 4 +- src/src/modinfo.h | 74 ++++++++-------- src/src/modinfobackup.h | 70 ++++++++-------- src/src/modinfodialog.cpp | 6 +- src/src/modinfodialog.h | 12 +-- src/src/modinfodialogcategories.cpp | 2 +- src/src/modinfodialogconflictsmodels.cpp | 4 +- src/src/modinfodialogconflictsmodels.h | 8 +- src/src/modinfodialogesps.cpp | 4 +- src/src/modinfodialogesps.h | 2 +- src/src/modinfodialogfiletree.cpp | 6 +- src/src/modinfodialogfiletree.h | 6 +- src/src/modinfodialogfwd.h | 2 +- src/src/modinfodialogimages.cpp | 17 ++-- src/src/modinfodialogimages.h | 28 +++---- src/src/modinfodialognexus.cpp | 4 +- src/src/modinfodialognexus.h | 6 +- src/src/modinfodialogtab.cpp | 2 +- src/src/modinfodialogtab.h | 6 +- src/src/modinfoforeign.h | 132 ++++++++++++++--------------- src/src/modinfooverwrite.h | 130 ++++++++++++++-------------- src/src/modinforegular.cpp | 9 +- src/src/modinforegular.h | 140 +++++++++++++++---------------- src/src/modinfoseparator.h | 86 +++++++++---------- src/src/modinfowithconflictinfo.cpp | 4 +- src/src/modinfowithconflictinfo.h | 12 +-- src/src/modlist.h | 40 ++++----- src/src/modlistbypriorityproxy.cpp | 4 +- src/src/modlistbypriorityproxy.h | 2 +- src/src/modlistcontextmenu.cpp | 2 +- src/src/modlistdropinfo.cpp | 2 +- src/src/modlistdropinfo.h | 2 +- src/src/modlistsortproxy.h | 8 +- src/src/modlistview.h | 4 +- src/src/motddialog.h | 4 +- src/src/multiprocess.h | 2 +- src/src/nexusinterface.h | 18 ++-- src/src/nxmaccessmanager.h | 4 +- src/src/organizercore.h | 16 ++-- src/src/organizerproxy.h | 24 +++--- src/src/overwriteinfodialog.h | 18 ++-- src/src/plugincontainer.h | 12 +-- src/src/pluginlist.h | 30 +++---- src/src/previewdialog.h | 4 +- src/src/problemsdialog.h | 4 +- src/src/profile.h | 18 ++-- src/src/profilesdialog.h | 6 +- src/src/qdirfiletree.h | 4 +- src/src/qtgroupingproxy.h | 36 ++++---- src/src/queryoverwritedialog.h | 2 +- src/src/selectiondialog.h | 4 +- src/src/selfupdater.h | 2 +- src/src/settings.h | 2 +- src/src/settingsdialog.h | 6 +- src/src/settingsdialognexus.h | 2 +- src/src/shared/fileregisterfwd.h | 2 +- src/src/statusbar.h | 4 +- src/src/texteditor.h | 2 +- src/src/vfs/mo2filesystem.h | 4 +- src/src/vfs/vfstree.h | 4 +- 138 files changed, 782 insertions(+), 790 deletions(-) (limited to 'src') diff --git a/src/src/aboutdialog.h b/src/src/aboutdialog.h index 5784da1..7c8d572 100644 --- a/src/src/aboutdialog.h +++ b/src/src/aboutdialog.h @@ -37,8 +37,8 @@ class AboutDialog : public QDialog Q_OBJECT public: - explicit AboutDialog(const QString& version, QWidget* parent = 0); - ~AboutDialog(); + explicit AboutDialog(const QString& version, QWidget* parent = nullptr); + ~AboutDialog() override; private: enum Licenses diff --git a/src/src/activatemodsdialog.cpp b/src/src/activatemodsdialog.cpp index dd2d1a6..fd69a69 100644 --- a/src/src/activatemodsdialog.cpp +++ b/src/src/activatemodsdialog.cpp @@ -48,7 +48,7 @@ ActivateModsDialog::ActivateModsDialog(SaveGameInfo::MissingAssets const& missin for (SaveGameInfo::MissingAssets::const_iterator espIter = missingAssets.begin(); espIter != missingAssets.end(); ++espIter, ++row) { modsTable->setCellWidget(row, 0, new QLabel(espIter.key())); - if (espIter->size() == 0) { + if (espIter->empty()) { modsTable->setCellWidget(row, 1, new QLabel(tr("not found"))); } else { QComboBox* combo = new QComboBox(); diff --git a/src/src/activatemodsdialog.h b/src/src/activatemodsdialog.h index 91de327..7c0c548 100644 --- a/src/src/activatemodsdialog.h +++ b/src/src/activatemodsdialog.h @@ -49,8 +49,8 @@ public: * @param parent ... Defaults to 0. **/ explicit ActivateModsDialog(MOBase::SaveGameInfo::MissingAssets const& missingAssets, - QWidget* parent = 0); - ~ActivateModsDialog(); + QWidget* parent = nullptr); + ~ActivateModsDialog() override; /** * @brief get a list of mods that the user chose to activate diff --git a/src/src/apiuseraccount.cpp b/src/src/apiuseraccount.cpp index 9a22fe8..a511e88 100644 --- a/src/src/apiuseraccount.cpp +++ b/src/src/apiuseraccount.cpp @@ -15,7 +15,7 @@ QString localizedUserAccountType(APIUserAccountTypes t) } } -APIUserAccount::APIUserAccount() : m_type(APIUserAccountTypes::None) {} +APIUserAccount::APIUserAccount() {} bool APIUserAccount::isValid() const { diff --git a/src/src/apiuseraccount.h b/src/src/apiuseraccount.h index 3fbabeb..3a7ef77 100644 --- a/src/src/apiuseraccount.h +++ b/src/src/apiuseraccount.h @@ -133,7 +133,7 @@ public: private: QString m_key, m_id, m_name; - APIUserAccountTypes m_type; + APIUserAccountTypes m_type{APIUserAccountTypes::None}; APILimits m_limits; }; diff --git a/src/src/archivefiletree.cpp b/src/src/archivefiletree.cpp index 4365b39..d39951a 100644 --- a/src/src/archivefiletree.cpp +++ b/src/src/archivefiletree.cpp @@ -43,7 +43,7 @@ public: : FileTreeEntry(parent, name), m_Index(index) {} - virtual std::shared_ptr clone() const override + std::shared_ptr clone() const override { return std::make_shared(nullptr, name(), m_Index); } @@ -65,20 +65,20 @@ public : // Public for make_shared (but not accessible by other since not exposed in .h): ArchiveFileTreeImpl(std::shared_ptr parent, QString name, int index, std::vector files) - : FileTreeEntry(parent, name), ArchiveFileEntry(parent, name, index), IFileTree(), + : FileTreeEntry(parent, name), ArchiveFileEntry(parent, name, index), m_Files(std::move(files)) {} public: // Override to avoid VS warnings: - virtual std::shared_ptr astree() override { return IFileTree::astree(); } + std::shared_ptr astree() override { return IFileTree::astree(); } - virtual std::shared_ptr astree() const override + std::shared_ptr astree() const override { return IFileTree::astree(); } protected: - virtual std::shared_ptr clone() const override + std::shared_ptr clone() const override { return IFileTree::clone(); } @@ -135,19 +135,19 @@ protected: * -1. * */ - virtual std::shared_ptr + std::shared_ptr makeDirectory(std::shared_ptr parent, QString name) const override { return std::make_shared(parent, name, -1, std::vector{}); } - virtual std::shared_ptr + std::shared_ptr makeFile(std::shared_ptr parent, QString name) const override { return std::make_shared(parent, name, -1); } - virtual bool + bool doPopulate(std::shared_ptr parent, std::vector>& entries) const override { @@ -215,7 +215,7 @@ protected: return false; } - virtual std::shared_ptr doClone() const override + std::shared_ptr doClone() const override { return std::make_shared(nullptr, name(), m_Index, m_Files); } diff --git a/src/src/categories.cpp b/src/src/categories.cpp index 9fbce18..78e7b53 100644 --- a/src/src/categories.cpp +++ b/src/src/categories.cpp @@ -40,7 +40,7 @@ QString CategoryFactory::categoriesFilePath() return qApp->property("dataPath").toString() + "/categories.dat"; } -CategoryFactory::CategoryFactory() : QObject() +CategoryFactory::CategoryFactory() { atexit(&cleanup); } @@ -241,7 +241,7 @@ int CategoryFactory::addCategory(const QString& name, int parentID) { int id = 1; - while (m_IDMap.find(id) != m_IDMap.end()) { + while (m_IDMap.contains(id)) { ++id; } addCategory(id, name, nexusCats, parentID); @@ -360,7 +360,7 @@ int CategoryFactory::getParentID(unsigned int index) const bool CategoryFactory::categoryExists(int id) const { - return m_IDMap.find(id) != m_IDMap.end(); + return m_IDMap.contains(id); } bool CategoryFactory::isDescendantOf(int id, int parentID) const @@ -508,7 +508,7 @@ unsigned int CategoryFactory::resolveNexusID(int nexusID) const { auto result = m_NexusMap.find(nexusID); if (result != m_NexusMap.end()) { - if (m_IDMap.count(result->second.categoryID())) { + if (m_IDMap.contains(result->second.categoryID())) { log::debug(tr("nexus category id {0} maps to internal {1}"), nexusID, m_IDMap.at(result->second.categoryID())); return m_IDMap.at(result->second.categoryID()); diff --git a/src/src/categories.h b/src/src/categories.h index c96b421..99e3d55 100644 --- a/src/src/categories.h +++ b/src/src/categories.h @@ -91,7 +91,7 @@ public: { Category(int sortValue, int id, const QString name, int parentID, std::vector nexusCats) - : m_SortValue(sortValue), m_ID(id), m_Name(name), m_HasChildren(false), + : m_SortValue(sortValue), m_ID(id), m_Name(name), m_ParentID(parentID), m_NexusCats(std::move(nexusCats)) {} @@ -113,7 +113,7 @@ public: int m_ParentID; QString m_Name; std::vector m_NexusCats; - bool m_HasChildren; + bool m_HasChildren{false}; }; public: diff --git a/src/src/categoriesdialog.cpp b/src/src/categoriesdialog.cpp index d575e17..d25a808 100644 --- a/src/src/categoriesdialog.cpp +++ b/src/src/categoriesdialog.cpp @@ -35,13 +35,13 @@ class NewIDValidator : public QIntValidator { public: NewIDValidator(const std::set& ids) : m_UsedIDs(ids) {} - virtual State validate(QString& input, int& pos) const + State validate(QString& input, int& pos) const override { State intRes = QIntValidator::validate(input, pos); if (intRes == Acceptable) { bool ok = false; int id = input.toInt(&ok); - if (m_UsedIDs.find(id) != m_UsedIDs.end()) { + if (m_UsedIDs.contains(id)) { return QValidator::Intermediate; } } @@ -56,13 +56,13 @@ class ExistingIDValidator : public QIntValidator { public: ExistingIDValidator(const std::set& ids) : m_UsedIDs(ids) {} - virtual State validate(QString& input, int& pos) const + State validate(QString& input, int& pos) const override { State intRes = QIntValidator::validate(input, pos); if (intRes == Acceptable) { bool ok = false; int id = input.toInt(&ok); - if ((id == 0) || (m_UsedIDs.find(id) != m_UsedIDs.end())) { + if ((id == 0) || (m_UsedIDs.contains(id))) { return QValidator::Acceptable; } else { return QValidator::Intermediate; @@ -85,14 +85,14 @@ public: {} QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem&, - const QModelIndex&) const + const QModelIndex&) const override { QLineEdit* edit = new QLineEdit(parent); edit->setValidator(m_Validator); return edit; } - virtual void setModelData(QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index) const + void setModelData(QWidget* editor, QAbstractItemModel* model, + const QModelIndex& index) const override { QLineEdit* edit = qobject_cast(editor); int pos = 0; @@ -325,7 +325,7 @@ void CategoriesDialog::nexusImport_clicked() nexusData.insert(nexusData.size(), data); auto nexusCatItem = std::make_unique(nexusLabel.join(", ")); nexusCatItem->setData(Qt::UserRole, nexusData); - if (!table->findItems(name, Qt::MatchExactly).size()) { + if (table->findItems(name, Qt::MatchExactly).empty()) { row = table->rowCount(); table->insertRow(table->rowCount()); diff --git a/src/src/categoriesdialog.h b/src/src/categoriesdialog.h index df05f38..ac4c89a 100644 --- a/src/src/categoriesdialog.h +++ b/src/src/categoriesdialog.h @@ -38,8 +38,8 @@ class CategoriesDialog : public MOBase::TutorableDialog Q_OBJECT public: - explicit CategoriesDialog(QWidget* parent = 0); - ~CategoriesDialog(); + explicit CategoriesDialog(QWidget* parent = nullptr); + ~CategoriesDialog() override; // also saves and restores geometry // diff --git a/src/src/categoriestable.h b/src/src/categoriestable.h index 7012eb5..0183b68 100644 --- a/src/src/categoriestable.h +++ b/src/src/categoriestable.h @@ -27,11 +27,11 @@ class CategoriesTable : public QTableWidget { Q_OBJECT public: - CategoriesTable(QWidget* parent = 0); + CategoriesTable(QWidget* parent = nullptr); protected: - virtual bool dropMimeData(int row, int column, const QMimeData* data, - Qt::DropAction action); + bool dropMimeData(int row, int column, const QMimeData* data, + Qt::DropAction action) override; }; #endif // CATEGORIESTABLE_H diff --git a/src/src/categoryimportdialog.h b/src/src/categoryimportdialog.h index e7ada2a..d6437b4 100644 --- a/src/src/categoryimportdialog.h +++ b/src/src/categoryimportdialog.h @@ -24,8 +24,8 @@ public: }; public: - explicit CategoryImportDialog(QWidget* parent = 0); - ~CategoryImportDialog(); + explicit CategoryImportDialog(QWidget* parent = nullptr); + ~CategoryImportDialog() override; ImportStrategy strategy(); bool assign(); diff --git a/src/src/colortable.cpp b/src/src/colortable.cpp index 3bc252d..f37d2c5 100644 --- a/src/src/colortable.cpp +++ b/src/src/colortable.cpp @@ -178,7 +178,7 @@ void paintBackground(QTableWidget* table, QPainter* p, } } -ColorTable::ColorTable(QWidget* parent) : QTableWidget(parent), m_settings(nullptr) +ColorTable::ColorTable(QWidget* parent) : QTableWidget(parent) { setColumnCount(4); setHorizontalHeaderLabels({"", "", "", ""}); diff --git a/src/src/colortable.h b/src/src/colortable.h index 9c1f235..4e4ad13 100644 --- a/src/src/colortable.h +++ b/src/src/colortable.h @@ -26,7 +26,7 @@ public: void commitColors(); private: - Settings* m_settings; + Settings* m_settings{nullptr}; void addColor(const QString& text, const QColor& defaultColor, std::function get, std::function commit); diff --git a/src/src/commandline.cpp b/src/src/commandline.cpp index 0d8b016..d33b5c5 100644 --- a/src/src/commandline.cpp +++ b/src/src/commandline.cpp @@ -50,7 +50,7 @@ std::string table(const std::vector>& v, return s; } -CommandLine::CommandLine() : m_command(nullptr) +CommandLine::CommandLine() { createOptions(); @@ -90,7 +90,7 @@ std::optional CommandLine::process(const std::wstring& line) // collect options past the command name auto opts = po::collect_unrecognized(parsed.options, po::include_positional); - if (m_vm.count("command")) { + if (m_vm.contains("command")) { // there's a word as the first argument; this may be a command name or // an old style exe name/binary @@ -122,7 +122,7 @@ std::optional CommandLine::process(const std::wstring& line) po::store(parsed, m_vm); - if (m_vm.count("help")) { + if (m_vm.contains("help")) { env::Console console; std::cout << usage(c.get()) << "\n"; return 0; @@ -153,7 +153,7 @@ std::optional CommandLine::process(const std::wstring& line) // MOApplication::doOneRun() // look for help - if (m_vm.count("help")) { + if (m_vm.contains("help")) { env::Console console; std::cout << usage() << "\n"; return 0; @@ -219,7 +219,7 @@ bool CommandLine::forwardToPrimary(MOMultiProcess& multiProcess) std::optional CommandLine::runEarly() { - if (m_vm.count("logs")) { + if (m_vm.contains("logs")) { // in loglist.h logToStdout(true); } @@ -234,7 +234,7 @@ std::optional CommandLine::runEarly() std::optional CommandLine::runPostApplication(MOApplication& a) { // handle -i with no arguments - if (m_vm.count("instance") && m_vm["instance"].as() == "") { + if (m_vm.contains("instance") && m_vm["instance"].as().empty()) { env::Console c; if (auto i = InstanceManager::singleton().currentInstance()) { @@ -391,17 +391,17 @@ std::string CommandLine::usage(const Command* c) const bool CommandLine::pick() const { - return (m_vm.count("pick") > 0); + return (m_vm.contains("pick")); } bool CommandLine::multiple() const { - return (m_vm.count("multiple") > 0); + return (m_vm.contains("multiple")); } std::optional CommandLine::profile() const { - if (m_vm.count("profile")) { + if (m_vm.contains("profile")) { return QString::fromStdString(m_vm["profile"].as()); } @@ -414,7 +414,7 @@ std::optional CommandLine::instance() const if (m_shortcut.isValid() && m_shortcut.hasInstance()) { return m_shortcut.instanceName(); - } else if (m_vm.count("instance")) { + } else if (m_vm.contains("instance")) { return QString::fromStdString(m_vm["instance"].as()); } @@ -716,11 +716,11 @@ std::optional RunCommand::runPostOrganizer(OrganizerCore& core) p.setFromFile(nullptr, QFileInfo(program)); } - if (vm().count("arguments")) { + if (vm().contains("arguments")) { p.setArguments(QString::fromStdString(vm()["arguments"].as())); } - if (vm().count("cwd")) { + if (vm().contains("cwd")) { p.setCurrentDirectory(QString::fromStdString(vm()["cwd"].as())); } @@ -924,10 +924,10 @@ std::optional CreatePortableCommand::runEarly() { QSettings ini(QDir(instanceDir).filePath("ModOrganizer.ini"), QSettings::IniFormat); - if (vm().count("game")) { + if (vm().contains("game")) { ini.setValue("General/gameName", QString::fromStdString(vm()["game"].as())); } - if (vm().count("game-path")) { + if (vm().contains("game-path")) { ini.setValue("General/gamePath", QString::fromStdString(vm()["game-path"].as())); } ini.setValue("General/portable", true); @@ -937,10 +937,10 @@ std::optional CreatePortableCommand::runEarly() ini.setValue("Settings/overwrite_directory", "%BASE_DIR%/overwrite"); ini.setValue("Settings/profile_local_inis", true); - if (vm().count("prefix")) { + if (vm().contains("prefix")) { ini.setValue("fluorine/prefix_path", QString::fromStdString(vm()["prefix"].as())); } - if (vm().count("proton")) { + if (vm().contains("proton")) { ini.setValue("fluorine/proton_path", QString::fromStdString(vm()["proton"].as())); } ini.sync(); diff --git a/src/src/commandline.h b/src/src/commandline.h index 77016f0..1a7535e 100644 --- a/src/src/commandline.h +++ b/src/src/commandline.h @@ -389,7 +389,7 @@ private: std::optional m_nxmLink; std::optional m_executable; QStringList m_untouched; - Command* m_command; + Command* m_command{nullptr}; std::wstring m_originalLine; void createOptions(); diff --git a/src/src/createinstancedialog.cpp b/src/src/createinstancedialog.cpp index 3bce099..dc5680b 100644 --- a/src/src/createinstancedialog.cpp +++ b/src/src/createinstancedialog.cpp @@ -99,8 +99,7 @@ private: CreateInstanceDialog::CreateInstanceDialog(const PluginContainer& pc, Settings* s, QWidget* parent) - : QDialog(parent), ui(new Ui::CreateInstanceDialog), m_pc(pc), m_settings(s), - m_switching(false), m_singlePage(false) + : QDialog(parent), ui(new Ui::CreateInstanceDialog), m_pc(pc), m_settings(s) { using namespace cid; diff --git a/src/src/createinstancedialog.h b/src/src/createinstancedialog.h index bacdcf9..24fa5df 100644 --- a/src/src/createinstancedialog.h +++ b/src/src/createinstancedialog.h @@ -93,7 +93,7 @@ public: CreateInstanceDialog(const PluginContainer& pc, Settings* s, QWidget* parent = nullptr); - ~CreateInstanceDialog(); + ~CreateInstanceDialog() override; Ui::CreateInstanceDialog* getUI(); const PluginContainer& pluginContainer(); @@ -169,8 +169,8 @@ private: Settings* m_settings; std::vector> m_pages; QString m_originalNext; - bool m_switching; - bool m_singlePage; + bool m_switching{false}; + bool m_singlePage{false}; // creates a shortcut for the given sequence // diff --git a/src/src/createinstancedialogpages.cpp b/src/src/createinstancedialogpages.cpp index 5f134a0..1207e6c 100644 --- a/src/src/createinstancedialogpages.cpp +++ b/src/src/createinstancedialogpages.cpp @@ -75,8 +75,8 @@ void PlaceholderLabel::setVisible(bool b) } Page::Page(CreateInstanceDialog& dlg) - : ui(dlg.getUI()), m_dlg(dlg), m_pc(dlg.pluginContainer()), m_skip(false), - m_firstActivation(true) + : ui(dlg.getUI()), m_dlg(dlg), m_pc(dlg.pluginContainer()) + {} bool Page::ready() const @@ -183,7 +183,7 @@ bool IntroPage::doSkip() const } TypePage::TypePage(CreateInstanceDialog& dlg) - : Page(dlg), m_type(CreateInstanceDialog::NoType) + : Page(dlg) { // replace placeholders with actual paths ui->createGlobal->setDescription(ui->createGlobal->description().arg( @@ -252,7 +252,7 @@ GamePage::Game::Game(IPluginGame* g) : game(g), installed(g->isInstalled()) } } -GamePage::GamePage(CreateInstanceDialog& dlg) : Page(dlg), m_selection(nullptr) +GamePage::GamePage(CreateInstanceDialog& dlg) : Page(dlg) { createGames(); fillList(); @@ -770,7 +770,7 @@ IPluginGame* GamePage::confirmOtherGame(const QString& path, IPluginGame* select } VariantsPage::VariantsPage(CreateInstanceDialog& dlg) - : Page(dlg), m_previousGame(nullptr) + : Page(dlg) {} bool VariantsPage::ready() const @@ -868,7 +868,7 @@ void VariantsPage::fillList() } NamePage::NamePage(CreateInstanceDialog& dlg) - : Page(dlg), m_modified(false), m_okay(false), m_label(ui->instanceNameLabel), + : Page(dlg), m_label(ui->instanceNameLabel), m_exists(ui->instanceNameExists), m_invalid(ui->instanceNameInvalid) { QObject::connect(ui->instanceName, &QLineEdit::textEdited, [&] { @@ -990,10 +990,10 @@ CreateInstanceDialog::ProfileSettings ProfilePage::profileSettings() const } PathsPage::PathsPage(CreateInstanceDialog& dlg) - : Page(dlg), m_lastType(CreateInstanceDialog::NoType), m_label(ui->pathsLabel), + : Page(dlg), m_label(ui->pathsLabel), m_simpleExists(ui->locationExists), m_simpleInvalid(ui->locationInvalid), m_advancedExists(ui->advancedDirExists), - m_advancedInvalid(ui->advancedDirInvalid), m_okay(false) + m_advancedInvalid(ui->advancedDirInvalid) { auto setEdit = [&](QLineEdit* e) { QObject::connect(e, &QLineEdit::textEdited, [&] { @@ -1245,7 +1245,7 @@ bool PathsPage::checkPath(QString path, PlaceholderLabel& existsLabel, return okay; } -NexusPage::NexusPage(CreateInstanceDialog& dlg) : Page(dlg), m_skip(false) +NexusPage::NexusPage(CreateInstanceDialog& dlg) : Page(dlg) { m_connectionUI.reset(new NexusConnectionUI(&m_dlg, dlg.settings(), ui->nexusConnect, nullptr, ui->nexusManual, ui->nexusLog)); diff --git a/src/src/createinstancedialogpages.h b/src/src/createinstancedialogpages.h index 2838b38..e4c3a2e 100644 --- a/src/src/createinstancedialogpages.h +++ b/src/src/createinstancedialogpages.h @@ -118,8 +118,8 @@ protected: Ui::CreateInstanceDialog* ui; CreateInstanceDialog& m_dlg; const PluginContainer& m_pc; - bool m_skip; - bool m_firstActivation; + bool m_skip{false}; + bool m_firstActivation{true}; // called every time a page is shown in the screen; `firstTime` is true for // first activation @@ -177,7 +177,7 @@ protected: void doActivated(bool firstTime) override; private: - CreateInstanceDialog::Types m_type; + CreateInstanceDialog::Types m_type{CreateInstanceDialog::NoType}; }; // game plugin page, displays a list of command buttons for each game, along @@ -267,7 +267,7 @@ private: std::vector> m_games; // current selection - Game* m_selection; + Game* m_selection{nullptr}; // filter MOBase::FilterWidget m_filter; @@ -393,7 +393,7 @@ protected: private: // game that was selected the last time this page was active - MOBase::IPluginGame* m_previousGame; + MOBase::IPluginGame* m_previousGame{nullptr}; // buttons std::vector m_buttons; @@ -447,10 +447,10 @@ private: // whether the user has modified the text, prevents auto generation when the // selected game changes - bool m_modified; + bool m_modified{false}; // whether the instance name is valid - bool m_okay; + bool m_okay{false}; // called when the user modifies the textbox, remember that it has changed and // calls verify() @@ -496,7 +496,7 @@ private: QString m_lastInstanceName; // instance type the last time this page was active - CreateInstanceDialog::Types m_lastType; + CreateInstanceDialog::Types m_lastType{CreateInstanceDialog::NoType}; // help label, replaces %1 by the game name PlaceholderLabel m_label; @@ -510,7 +510,7 @@ private: PlaceholderLabel m_advancedExists, m_advancedInvalid; // whether the paths are valid - bool m_okay; + bool m_okay{false}; // called when the user changes any textbox, checks the path and updates nav // @@ -601,7 +601,7 @@ private: // set to true only if the api key was detected when opening the dialog, or // going back and forth would skip the page after the process is completed, // which would be unexpected - bool m_skip; + bool m_skip{false}; }; // shows a text log of all the creation parameters diff --git a/src/src/credentialsdialog.h b/src/src/credentialsdialog.h index 7775bc4..8986d9c 100644 --- a/src/src/credentialsdialog.h +++ b/src/src/credentialsdialog.h @@ -32,8 +32,8 @@ class CredentialsDialog : public QDialog Q_OBJECT public: - explicit CredentialsDialog(QWidget* parent = 0); - ~CredentialsDialog(); + explicit CredentialsDialog(QWidget* parent = nullptr); + ~CredentialsDialog() override; bool store() const; bool neverAsk() const; diff --git a/src/src/csvbuilder.cpp b/src/src/csvbuilder.cpp index a7819bf..11cd112 100644 --- a/src/src/csvbuilder.cpp +++ b/src/src/csvbuilder.cpp @@ -1,7 +1,7 @@ #include "csvbuilder.h" CSVBuilder::CSVBuilder(QIODevice* target) - : m_Out(target), m_Separator(','), m_LineBreak(BREAK_CRLF) + : m_Out(target) { m_Out.setEncoding(QStringConverter::Encoding::Utf8); @@ -89,7 +89,7 @@ void CSVBuilder::setDefault(const QString& field, const QVariant& value) void CSVBuilder::writeHeader() { - if (m_Fields.size() == 0) { + if (m_Fields.empty()) { throw CSVException(QObject::tr("no fields set up yet!")); } diff --git a/src/src/csvbuilder.h b/src/src/csvbuilder.h index 36e8eac..01f7b93 100644 --- a/src/src/csvbuilder.h +++ b/src/src/csvbuilder.h @@ -10,9 +10,9 @@ class CSVException : public std::exception { public: - CSVException(const QString& text) : std::exception(), m_Message(text.toLocal8Bit()) {} + CSVException(const QString& text) : m_Message(text.toLocal8Bit()) {} - virtual const char* what() const throw() { return m_Message.constData(); } + const char* what() const throw() override { return m_Message.constData(); } private: QByteArray m_Message; @@ -75,8 +75,8 @@ private: private: QTextStream m_Out; - char m_Separator; - ELineBreak m_LineBreak; + char m_Separator{','}; + ELineBreak m_LineBreak{BREAK_CRLF}; std::map m_QuoteMode; std::vector m_Fields; std::map m_FieldTypes; diff --git a/src/src/datatab.cpp b/src/src/datatab.cpp index 4ef982f..61ded81 100644 --- a/src/src/datatab.cpp +++ b/src/src/datatab.cpp @@ -30,8 +30,8 @@ DataTab::DataTab(OrganizerCore& core, PluginContainer& pc, QWidget* parent, mwui->dataTree, mwui->dataTabShowOnlyConflicts, mwui->dataTabShowFromArchives, - mwui->dataTabShowHiddenFiles}, - m_needUpdate(true) + mwui->dataTabShowHiddenFiles} + { m_filetree.reset(new FileTree(core, m_pluginContainer, ui.tree)); m_filter.setUseSourceSort(true); diff --git a/src/src/datatab.h b/src/src/datatab.h index 7d5fd1f..632a45a 100644 --- a/src/src/datatab.h +++ b/src/src/datatab.h @@ -67,7 +67,7 @@ private: std::unique_ptr m_filetree; std::vector m_removeLater; MOBase::FilterWidget m_filter; - bool m_needUpdate; + bool m_needUpdate{true}; void onRefresh(); void onBrowseVFS(); diff --git a/src/src/directoryrefresher.cpp b/src/src/directoryrefresher.cpp index ccba80c..1c415c7 100644 --- a/src/src/directoryrefresher.cpp +++ b/src/src/directoryrefresher.cpp @@ -162,7 +162,7 @@ void dumpStats(std::vector& stats) } DirectoryRefresher::DirectoryRefresher(OrganizerCore* core, std::size_t threadCount) - : m_Core(*core), m_threadCount(threadCount), m_lastFileCount(0) + : m_Core(*core), m_threadCount(threadCount) {} DirectoryEntry* DirectoryRefresher::stealDirectoryStructure() @@ -290,7 +290,7 @@ void DirectoryRefresher::addModFilesToStructure(DirectoryEntry* directoryStructu std::wstring directoryW = ToWString(QDir::toNativeSeparators(directory)); DirectoryStats dummy; - if (stealFiles.length() > 0) { + if (!stealFiles.empty()) { stealModFilesIntoStructure(directoryStructure, modName, priority, directory, stealFiles); } else { @@ -308,7 +308,7 @@ void DirectoryRefresher::addModToStructure(DirectoryEntry* directoryStructure, DirectoryStats dummy; - if (stealFiles.length() > 0) { + if (!stealFiles.empty()) { stealModFilesIntoStructure(directoryStructure, modName, priority, directory, stealFiles); } else { @@ -415,7 +415,7 @@ void DirectoryRefresher::addMultipleModsFilesToStructure( } try { - if (e.stealFiles.length() > 0) { + if (!e.stealFiles.empty()) { stealModFilesIntoStructure(directoryStructure, e.modName, prio, e.absolutePath, e.stealFiles); diff --git a/src/src/directoryrefresher.h b/src/src/directoryrefresher.h index 1e71966..09ecdfa 100644 --- a/src/src/directoryrefresher.h +++ b/src/src/directoryrefresher.h @@ -155,7 +155,7 @@ private: std::unique_ptr m_Root; QMutex m_RefreshLock; std::size_t m_threadCount; - std::size_t m_lastFileCount; + std::size_t m_lastFileCount{0}; void stealModFilesIntoStructure(MOShared::DirectoryEntry* directoryStructure, const QString& modName, int priority, @@ -169,7 +169,7 @@ class DirectoryRefreshProgress : public QObject public: DirectoryRefreshProgress(DirectoryRefresher* r) - : QObject(r), m_refresher(r), m_modCount(0), m_modDone(0), m_finished(false) + : QObject(r), m_refresher(r), m_modDone(0) {} void start(std::size_t modCount) @@ -203,9 +203,9 @@ public: private: DirectoryRefresher* m_refresher; - std::size_t m_modCount; + std::size_t m_modCount{0}; std::atomic m_modDone; - bool m_finished; + bool m_finished{false}; }; #endif // DIRECTORYREFRESHER_H diff --git a/src/src/downloadlist.h b/src/src/downloadlist.h index 1be2ea5..1ea64a8 100644 --- a/src/src/downloadlist.h +++ b/src/src/downloadlist.h @@ -51,7 +51,7 @@ public: }; public: - explicit DownloadList(OrganizerCore& core, QObject* parent = 0); + explicit DownloadList(OrganizerCore& core, QObject* parent = nullptr); /** * @brief retrieve the number of rows to display. Invoked by Qt @@ -59,15 +59,15 @@ public: * @param parent not relevant for this implementation * @return number of rows to display **/ - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex& parent) const; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent) const override; - QModelIndex index(int row, int column, const QModelIndex& parent) const; - QModelIndex parent(const QModelIndex& child) const; + QModelIndex index(int row, int column, const QModelIndex& parent) const override; + QModelIndex parent(const QModelIndex& child) const override; Qt::ItemFlags flags(const QModelIndex& idx) const override; QMimeData* mimeData(const QModelIndexList& indexes) const override; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; /** * @brief retrieve the data to display in a specific row. Invoked by Qt @@ -77,7 +77,7 @@ public: * @return this implementation only returns the row, the QItemDelegate implementation *is expected to fetch its information from the DownloadManager **/ - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; // used in DownloadsTab as the sorting predicate for the filter widget // diff --git a/src/src/downloadlistview.h b/src/src/downloadlistview.h index 36732bd..2f6d7b3 100644 --- a/src/src/downloadlistview.h +++ b/src/src/downloadlistview.h @@ -71,8 +71,8 @@ class DownloadListView : public QTreeView Q_OBJECT public: - explicit DownloadListView(QWidget* parent = 0); - ~DownloadListView(); + explicit DownloadListView(QWidget* parent = nullptr); + ~DownloadListView() override; void setManager(DownloadManager* manager); void setSourceModel(DownloadList* sourceModel); @@ -125,9 +125,9 @@ private slots: private: DownloadManager* m_Manager; - DownloadList* m_SourceModel = 0; + DownloadList* m_SourceModel = nullptr; - void resizeEvent(QResizeEvent* event); + void resizeEvent(QResizeEvent* event) override; }; #endif // DOWNLOADLISTWIDGET_H diff --git a/src/src/downloadmanager.cpp b/src/src/downloadmanager.cpp index 91518ff..add1da7 100644 --- a/src/src/downloadmanager.cpp +++ b/src/src/downloadmanager.cpp @@ -249,8 +249,8 @@ QString DownloadManager::DownloadInfo::currentURL() } DownloadManager::DownloadManager(NexusInterface* nexusInterface, QObject* parent) - : m_NexusInterface(nexusInterface), m_DirWatcher(), m_ShowHidden(false), - m_ParentWidget(nullptr) + : m_NexusInterface(nexusInterface) + { m_OrganizerCore = dynamic_cast(parent); connect(&m_DirWatcher, SIGNAL(directoryChanged(QString)), this, @@ -334,7 +334,7 @@ void DownloadManager::setOutputDirectory(const QString& outputDirectory, const bool refresh) { QStringList directories = m_DirWatcher.directories(); - if (directories.length() != 0) { + if (!directories.empty()) { m_DirWatcher.removePaths(directories); } m_OutputDirectory = QDir::fromNativeSeparators(outputDirectory); @@ -399,7 +399,7 @@ void DownloadManager::refreshList() orphans.append(dir.absoluteFilePath(metaFile)); } } - if (orphans.size() > 0) { + if (!orphans.empty()) { log::debug("{} orphaned meta files will be deleted", orphans.size()); shellDelete(orphans, true); } @@ -1086,7 +1086,7 @@ void DownloadManager::resumeDownloadInt(int index) } } } - if ((info->m_Urls.size() == 0) || + if ((info->m_Urls.empty()) || ((info->m_Urls.size() == 1) && (info->m_Urls[0].size() == 0))) { emit showMessage( tr("No known download urls. Sorry, this download can't be resumed.")); @@ -2126,7 +2126,7 @@ void DownloadManager::nxmDownloadURLsAvailable(QString gameName, int modID, int ModRepositoryFileInfo* info = qobject_cast(qvariant_cast(userData)); QVariantList resultList = resultData.toList(); - if (resultList.length() == 0) { + if (resultList.empty()) { removePending(gameName, modID, fileID); emit showMessage(tr("No download server available. Please try again later.")); return; diff --git a/src/src/downloadmanager.h b/src/src/downloadmanager.h index f17fe3c..8b63153 100644 --- a/src/src/downloadmanager.h +++ b/src/src/downloadmanager.h @@ -85,8 +85,8 @@ private: ~DownloadInfo() { delete m_FileInfo; } accumulator_set> m_DownloadAcc; accumulator_set> m_DownloadTimeAcc; - qint64 m_DownloadLast; - qint64 m_DownloadTimeLast; + qint64 m_DownloadLast{0}; + qint64 m_DownloadTimeLast{0}; unsigned int m_DownloadID; QString m_FileName; QFile m_Output; @@ -94,12 +94,12 @@ private: QElapsedTimer m_StartTime; qint64 m_PreResumeSize; std::pair m_Progress; - bool m_HasData; + bool m_HasData{false}; DownloadState m_State; int m_CurrentUrl; QStringList m_Urls; qint64 m_ResumePos; - qint64 m_TotalSize; + qint64 m_TotalSize{0}; QDateTime m_Created; // used as a cache in DownloadManager::getFileTime, may not be // valid elsewhere QByteArray m_Hash; @@ -107,14 +107,14 @@ private: QString m_RemoteFileName; int m_Tries; - bool m_ReQueried; - bool m_AskIfNotFound; + bool m_ReQueried{false}; + bool m_AskIfNotFound{true}; quint32 m_TaskProgressId; MOBase::ModRepositoryFileInfo* m_FileInfo{nullptr}; - bool m_Hidden; + bool m_Hidden{false}; static DownloadInfo* createNew(const MOBase::ModRepositoryFileInfo* fileInfo, const QStringList& URLs); @@ -143,8 +143,7 @@ private: private: DownloadInfo() - : m_TotalSize(0), m_ReQueried(false), m_Hidden(false), m_HasData(false), - m_AskIfNotFound(true), m_DownloadTimeLast(0), m_DownloadLast(0), + : m_DownloadAcc(tag::rolling_window::window_size = 200), m_DownloadTimeAcc(tag::rolling_window::window_size = 200) {} @@ -164,7 +163,7 @@ public: **/ explicit DownloadManager(NexusInterface* nexusInterface, QObject* parent); - ~DownloadManager(); + ~DownloadManager() override; void setParentWidget(QWidget* w); @@ -601,7 +600,7 @@ private: NexusInterface* m_NexusInterface; OrganizerCore* m_OrganizerCore; - QWidget* m_ParentWidget; + QWidget* m_ParentWidget{nullptr}; QVector> m_PendingDownloads; @@ -627,7 +626,7 @@ private: std::map m_DownloadFails; - bool m_ShowHidden; + bool m_ShowHidden{false}; MOBase::IPluginGame const* m_ManagedGame; diff --git a/src/src/downloadmanagerproxy.h b/src/src/downloadmanagerproxy.h index ef3605f..3f63362 100644 --- a/src/src/downloadmanagerproxy.h +++ b/src/src/downloadmanagerproxy.h @@ -11,7 +11,7 @@ class DownloadManagerProxy : public MOBase::IDownloadManager public: DownloadManagerProxy(OrganizerProxy* oproxy, DownloadManager* downloadManager); - virtual ~DownloadManagerProxy(); + ~DownloadManagerProxy() override; int startDownloadURLs(const QStringList& urls) override; int startDownloadNexusFile(int modID, int fileID) override; diff --git a/src/src/editexecutablesdialog.cpp b/src/src/editexecutablesdialog.cpp index c39eb0f..15f669a 100644 --- a/src/src/editexecutablesdialog.cpp +++ b/src/src/editexecutablesdialog.cpp @@ -53,7 +53,7 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, int sel, QWidget* parent) : TutorableDialog("EditExecutables", parent), ui(new Ui::EditExecutablesDialog), m_organizerCore(oc), m_originalExecutables(*oc.executablesList()), - m_executablesList(*oc.executablesList()), m_settingUI(false) + m_executablesList(*oc.executablesList()) { ui->setupUi(this); ui->splitter->setSizes({200, 1}); diff --git a/src/src/editexecutablesdialog.h b/src/src/editexecutablesdialog.h index 4430d6c..88b241c 100644 --- a/src/src/editexecutablesdialog.h +++ b/src/src/editexecutablesdialog.h @@ -148,7 +148,7 @@ public: explicit EditExecutablesDialog(OrganizerCore& oc, int selection = -1, QWidget* parent = nullptr); - ~EditExecutablesDialog(); + ~EditExecutablesDialog() override; // also saves and restores geometry // @@ -202,7 +202,7 @@ private: // true when the change events being triggered are in response to loading // the executable's data into the UI, not from a user change - bool m_settingUI; + bool m_settingUI{false}; void loadCustomOverwrites(); void loadForcedLibraries(); diff --git a/src/src/env.cpp b/src/src/env.cpp index b78d43f..7f1a141 100644 --- a/src/src/env.cpp +++ b/src/src/env.cpp @@ -27,7 +27,7 @@ namespace env using namespace MOBase; -Console::Console() : m_hasConsole(false), m_in(nullptr), m_out(nullptr), m_err(nullptr) +Console::Console() { // stdout/stderr are already attached on Linux. } @@ -35,7 +35,7 @@ Console::Console() : m_hasConsole(false), m_in(nullptr), m_out(nullptr), m_err(n Console::~Console() = default; ModuleNotification::ModuleNotification(QObject* o, std::function f) - : m_cookie(nullptr), m_object(o), m_f(std::move(f)) + : m_object(o), m_f(std::move(f)) {} ModuleNotification::~ModuleNotification() = default; diff --git a/src/src/env.h b/src/src/env.h index e7d1484..5e5978c 100644 --- a/src/src/env.h +++ b/src/src/env.h @@ -51,12 +51,12 @@ public: private: // whether the console was allocated successfully - bool m_hasConsole; + bool m_hasConsole{false}; // standard streams - FILE* m_in; - FILE* m_out; - FILE* m_err; + FILE* m_in{nullptr}; + FILE* m_out{nullptr}; + FILE* m_err{nullptr}; }; class ModuleNotification @@ -75,7 +75,7 @@ public: void fire(QString path, std::size_t fileSize); private: - void* m_cookie; + void* m_cookie{nullptr}; QObject* m_object; std::set m_loaded; std::function m_f; diff --git a/src/src/envfs.h b/src/src/envfs.h index b83795a..f6da750 100644 --- a/src/src/envfs.h +++ b/src/src/envfs.h @@ -110,11 +110,11 @@ private: std::condition_variable cv; std::mutex mutex; - bool ready; + bool ready{false}; std::atomic stop; - ThreadInfo() : busy(true), ready(false), stop(false) + ThreadInfo() : busy(true), stop(false) { thread = MOShared::startSafeThread([&] { run(); diff --git a/src/src/envmetrics.cpp b/src/src/envmetrics.cpp index 5eb623c..e04652c 100644 --- a/src/src/envmetrics.cpp +++ b/src/src/envmetrics.cpp @@ -9,7 +9,7 @@ namespace env Display::Display(QString adapter, QString monitorDevice, bool primary) : m_adapter(std::move(adapter)), m_monitorDevice(std::move(monitorDevice)), - m_primary(primary), m_resX(0), m_resY(0), m_dpi(0), m_refreshRate(0) + m_primary(primary) { getSettings(); } diff --git a/src/src/envmetrics.h b/src/src/envmetrics.h index b0033d6..44efb9d 100644 --- a/src/src/envmetrics.h +++ b/src/src/envmetrics.h @@ -47,9 +47,9 @@ private: QString m_adapter; QString m_monitorDevice; bool m_primary; - int m_resX, m_resY; - int m_dpi; - int m_refreshRate; + int m_resX{0}, m_resY{0}; + int m_dpi{0}; + int m_refreshRate{0}; void getSettings(); }; diff --git a/src/src/envmodule.cpp b/src/src/envmodule.cpp index 6149333..1400e91 100644 --- a/src/src/envmodule.cpp +++ b/src/src/envmodule.cpp @@ -262,7 +262,7 @@ std::vector getLoadedModules() QString qpath = QString::fromStdString(path); - if (seen.count(qpath)) { + if (seen.contains(qpath)) { continue; } seen.insert(qpath); diff --git a/src/src/envwindows.cpp b/src/src/envwindows.cpp index e235032..b2c1656 100644 --- a/src/src/envwindows.cpp +++ b/src/src/envwindows.cpp @@ -36,7 +36,7 @@ WindowsInfo::Version WindowsInfo::getKernelVersion() const QString kver = QString::fromUtf8(uts.release); QStringList parts = kver.split('.'); - if (parts.size() >= 1) + if (!parts.empty()) v.major = parts[0].toUInt(); if (parts.size() >= 2) v.minor = parts[1].toUInt(); diff --git a/src/src/envwindows.h b/src/src/envwindows.h index 70d8d2a..a10fd6b 100644 --- a/src/src/envwindows.h +++ b/src/src/envwindows.h @@ -39,9 +39,9 @@ public: QString ID; // some sub-build number, may be empty - uint32_t UBR; + uint32_t UBR{0}; - Release() : UBR(0) {} + Release() {} }; WindowsInfo(); diff --git a/src/src/executableslist.h b/src/src/executableslist.h index 8a768d9..1824d67 100644 --- a/src/src/executableslist.h +++ b/src/src/executableslist.h @@ -76,11 +76,11 @@ public: Executable& workingDirectory(const QString& s); Executable& flags(Flags f); - bool isShownOnToolbar() const; + bool isShownOnToolbar() const override; void setShownOnToolbar(bool state); - bool usesOwnIcon() const; - bool minimizeToSystemTray() const; - bool hide() const; + bool usesOwnIcon() const override; + bool minimizeToSystemTray() const override; + bool hide() const override; bool useProton() const; bool useTerminal() const; diff --git a/src/src/filedialogmemory.h b/src/src/filedialogmemory.h index c627ba9..d5ced66 100644 --- a/src/src/filedialogmemory.h +++ b/src/src/filedialogmemory.h @@ -34,15 +34,15 @@ public: static void save(Settings& settings); static void restore(const Settings& settings); - static QString getOpenFileName(const QString& dirID, QWidget* parent = 0, + static QString getOpenFileName(const QString& dirID, QWidget* parent = nullptr, const QString& caption = QString(), const QString& dir = QString(), const QString& filter = QString(), - QString* selectedFilter = 0, + QString* selectedFilter = nullptr, QFileDialog::Options options = QFileDialog::Option(0)); static QString - getExistingDirectory(const QString& dirID, QWidget* parent = 0, + getExistingDirectory(const QString& dirID, QWidget* parent = nullptr, const QString& caption = QString(), const QString& dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly); diff --git a/src/src/filetreeitem.cpp b/src/src/filetreeitem.cpp index e2e8a30..6ab7e91 100644 --- a/src/src/filetreeitem.cpp +++ b/src/src/filetreeitem.cpp @@ -62,8 +62,8 @@ FileTreeItem::FileTreeItem(FileTreeModel* model, FileTreeItem* parent, : m_model(model), m_parent(parent), m_indexGuess(NoIndexGuess), m_virtualParentPath(QString::fromStdWString(dataRelativeParentPath)), m_wsFile(file), m_wsLcFile(ToLowerCopy(file)), m_key(m_wsLcFile), - m_file(QString::fromStdWString(file)), m_isDirectory(isDirectory), m_originID(-1), - m_flags(NoFlags), m_loaded(false), m_expanded(false), m_sortingStale(true) + m_file(QString::fromStdWString(file)), m_isDirectory(isDirectory), + m_flags(NoFlags) {} FileTreeItem::Ptr FileTreeItem::createFile(FileTreeModel* model, FileTreeItem* parent, diff --git a/src/src/filetreeitem.h b/src/src/filetreeitem.h index 2d6d8ab..2dfbb1e 100644 --- a/src/src/filetreeitem.h +++ b/src/src/filetreeitem.h @@ -230,7 +230,7 @@ private: const QString m_file; const bool m_isDirectory; - int m_originID; + int m_originID{-1}; QString m_realPath; std::wstring m_wsRealPath; Flags m_flags; @@ -241,9 +241,9 @@ private: mutable Cached m_fileType; mutable Cached m_compressedFileSize; - bool m_loaded; - bool m_expanded; - bool m_sortingStale; + bool m_loaded{false}; + bool m_expanded{false}; + bool m_sortingStale{true}; Children m_children; FileTreeItem(FileTreeModel* model, FileTreeItem* parent, diff --git a/src/src/filetreemodel.cpp b/src/src/filetreemodel.cpp index e7d5283..87eadce 100644 --- a/src/src/filetreemodel.cpp +++ b/src/src/filetreemodel.cpp @@ -62,7 +62,7 @@ public: // directories // Range(FileTreeModel* model, FileTreeItem& parentItem, int start = 0) - : m_model(model), m_parentItem(parentItem), m_first(-1), m_current(start) + : m_model(model), m_parentItem(parentItem), m_current(start) {} // includes the current index in the range @@ -167,7 +167,7 @@ public: private: FileTreeModel* m_model; FileTreeItem& m_parentItem; - int m_first; + int m_first{-1}; int m_current; }; @@ -182,9 +182,9 @@ void* makeInternalPointer(FileTreeItem* item) } FileTreeModel::FileTreeModel(OrganizerCore& core, QObject* parent) - : QAbstractItemModel(parent), m_core(core), m_enabled(true), + : QAbstractItemModel(parent), m_core(core), m_root(FileTreeItem::createDirectory(this, nullptr, L"", L"")), - m_flags(HiddenFiles), m_fullyLoaded(false), m_sortingEnabled(true) + m_flags(HiddenFiles) { m_root->setExpanded(true); m_sortTimer.setSingleShot(true); @@ -971,7 +971,7 @@ void FileTreeModel::updateFileItem(FileTreeItem& item, const MOShared::FileEntry bool FileTreeModel::shouldShowFile(const FileEntry& file) const { if (showConflictsOnly() && - ((file.getAlternatives().size() == 0) || + ((file.getAlternatives().empty()) || QString::fromStdWString(file.getName()) .endsWith(ModInfo::s_HiddenExt, Qt::CaseInsensitive))) { // only conflicts should be shown, but this file is hidden or not conflicted diff --git a/src/src/filetreemodel.h b/src/src/filetreemodel.h index 35b63f9..7cd764e 100644 --- a/src/src/filetreemodel.h +++ b/src/src/filetreemodel.h @@ -83,15 +83,15 @@ private: using DirectoryIterator = std::vector::const_iterator; OrganizerCore& m_core; - bool m_enabled; + bool m_enabled{true}; mutable FileTreeItem::Ptr m_root; Flags m_flags; mutable IconFetcher m_iconFetcher; mutable std::vector m_iconPending; mutable QTimer m_iconPendingTimer; SortInfo m_sort; - bool m_fullyLoaded; - bool m_sortingEnabled; + bool m_fullyLoaded{false}; + bool m_sortingEnabled{true}; // see top of filetreemodel.cpp std::vector m_removeItems; diff --git a/src/src/filterlist.cpp b/src/src/filterlist.cpp index 1e17e14..e50740a 100644 --- a/src/src/filterlist.cpp +++ b/src/src/filterlist.cpp @@ -32,7 +32,7 @@ public: }; CriteriaItem(FilterList* list, QString name, CriteriaType type, int id) - : QTreeWidgetItem({"", name}), m_list(list), m_state(Inactive) + : QTreeWidgetItem({"", name}), m_list(list) { setData(0, Qt::ToolTipRole, name); setData(0, TypeRole, type); @@ -75,7 +75,7 @@ public: setState(s); } - QVariant data(int column, int role) const + QVariant data(int column, int role) const override { if (role == StateRole) { return m_state; @@ -83,7 +83,7 @@ public: return QTreeWidgetItem::data(column, role); } - void setData(int column, int role, const QVariant& value) + void setData(int column, int role, const QVariant& value) override { if (role == StateRole) { setState(static_cast(value.toInt())); @@ -94,7 +94,7 @@ public: private: FilterList* m_list; - States m_state; + States m_state{Inactive}; void updateState() { @@ -279,7 +279,7 @@ void FilterList::addCategoryCriteria(QTreeWidgetItem* root, for (unsigned int i = 1; i < count; ++i) { if (m_factory.getParentID(i) == targetID) { int categoryID = m_factory.getCategoryID(i); - if (categoriesUsed.find(categoryID) != categoriesUsed.end()) { + if (categoriesUsed.contains(categoryID)) { QTreeWidgetItem* item = addCriteriaItem(root, m_factory.getCategoryName(i), categoryID, ModListSortProxy::TypeCategory); diff --git a/src/src/forcedloaddialog.h b/src/src/forcedloaddialog.h index 5d3806e..27e8f35 100644 --- a/src/src/forcedloaddialog.h +++ b/src/src/forcedloaddialog.h @@ -18,7 +18,7 @@ class ForcedLoadDialog : public QDialog public: explicit ForcedLoadDialog(const MOBase::IPluginGame* game, QWidget* parent = nullptr); - ~ForcedLoadDialog(); + ~ForcedLoadDialog() override; void setValues(QList& values); QList values(); diff --git a/src/src/forcedloaddialogwidget.h b/src/src/forcedloaddialogwidget.h index 2624d58..ceb931f 100644 --- a/src/src/forcedloaddialogwidget.h +++ b/src/src/forcedloaddialogwidget.h @@ -16,7 +16,7 @@ class ForcedLoadDialogWidget : public QWidget public: explicit ForcedLoadDialogWidget(const MOBase::IPluginGame* game, QWidget* parent = nullptr); - ~ForcedLoadDialogWidget(); + ~ForcedLoadDialogWidget() override; bool getEnabled(); bool getForced(); diff --git a/src/src/fuseconnector.cpp b/src/src/fuseconnector.cpp index 71cf7bc..e960fef 100644 --- a/src/src/fuseconnector.cpp +++ b/src/src/fuseconnector.cpp @@ -1208,10 +1208,10 @@ void FuseConnector::deployRootFiles( const auto relPath = fs::relative(entry.path(), rootDir, ec).string(); const auto dst = (fs::path(m_gameDir) / relPath).string(); - if (deployedSet.count(dst)) continue; // higher-priority mod already deployed + if (deployedSet.contains(dst)) continue; // higher-priority mod already deployed // Backup existing file - if (fs::exists(dst, ec) && !deployedSet.count(dst)) { + if (fs::exists(dst, ec) && !deployedSet.contains(dst)) { const auto bak = (fs::path(backupDir) / relPath).string(); fs::create_directories(fs::path(bak).parent_path(), ec); fs::copy_file(dst, bak, fs::copy_options::overwrite_existing, ec); diff --git a/src/src/fuseconnector.h b/src/src/fuseconnector.h index 412f794..29601c6 100644 --- a/src/src/fuseconnector.h +++ b/src/src/fuseconnector.h @@ -19,7 +19,7 @@ class FuseConnectorException : public std::exception { public: explicit FuseConnectorException(const QString& text) - : std::exception(), m_Message(text.toLocal8Bit()) + : m_Message(text.toLocal8Bit()) {} const char* what() const throw() override { return m_Message.constData(); } diff --git a/src/src/game_features.cpp b/src/src/game_features.cpp index 1865b18..7bb1f8f 100644 --- a/src/src/game_features.cpp +++ b/src/src/game_features.cpp @@ -119,7 +119,7 @@ public: std::vector getAllContents() const override { return m_allContents; } std::vector - getContentsFor(std::shared_ptr fileTree) const + getContentsFor(std::shared_ptr fileTree) const override { std::vector contentsFor; for (const auto& modDataContent : m_modDataContents) { diff --git a/src/src/game_features.h b/src/src/game_features.h index 52390ae..a25e537 100644 --- a/src/src/game_features.h +++ b/src/src/game_features.h @@ -35,7 +35,7 @@ public: */ GameFeatures(OrganizerCore* core, PluginContainer* plugins); - ~GameFeatures(); + ~GameFeatures() override; // register game features // diff --git a/src/src/genericicondelegate.h b/src/src/genericicondelegate.h index 9aabfd4..18e7cb1 100644 --- a/src/src/genericicondelegate.h +++ b/src/src/genericicondelegate.h @@ -27,8 +27,8 @@ public: int logicalIndex = -1, int compactSize = 150); private: - virtual QList getIcons(const QModelIndex& index) const; - virtual size_t getNumIcons(const QModelIndex& index) const; + QList getIcons(const QModelIndex& index) const override; + size_t getNumIcons(const QModelIndex& index) const override; private: int m_Role; diff --git a/src/src/github.h b/src/src/github.h index b82fe94..36a17f3 100644 --- a/src/src/github.h +++ b/src/src/github.h @@ -12,14 +12,14 @@ class GitHubException : public std::exception { public: - GitHubException(const QJsonObject& errorObj) : std::exception() + GitHubException(const QJsonObject& errorObj) { initMessage(errorObj); } - virtual ~GitHubException() throw() override {} + ~GitHubException() throw() override {} - virtual const char* what() const throw() { return m_Message.constData(); } + const char* what() const throw() override { return m_Message.constData(); } private: void initMessage(const QJsonObject& obj) @@ -68,7 +68,7 @@ public: public: GitHub(const char* clientId = nullptr); - ~GitHub(); + ~GitHub() override; QJsonArray releases(const Repository& repo); void releases(const Repository& repo, diff --git a/src/src/icondelegate.cpp b/src/src/icondelegate.cpp index b422e39..bd00476 100644 --- a/src/src/icondelegate.cpp +++ b/src/src/icondelegate.cpp @@ -29,8 +29,8 @@ along with Mod Organizer. If not, see . using namespace MOBase; IconDelegate::IconDelegate(QTreeView* view, int column, int compactSize) - : QStyledItemDelegate(view), m_column(column), m_compactSize(compactSize), - m_compact(false) + : QStyledItemDelegate(view), m_column(column), m_compactSize(compactSize) + { if (view) { connect(view->header(), &QHeaderView::sectionResized, @@ -48,7 +48,7 @@ void IconDelegate::paintIcons(QPainter* painter, const QStyleOptionViewItem& opt int x = 4; painter->save(); - int iconWidth = icons.size() > 0 ? ((option.rect.width() / icons.size()) - 4) : 16; + int iconWidth = !icons.empty() ? ((option.rect.width() / icons.size()) - 4) : 16; // Clamp: narrow content columns can make the per-icon slot 0 or negative, // which causes QIcon::pixmap() to return null and log "failed to load icon" // spuriously. Keep at least 8px so the pixmap call always succeeds; excess diff --git a/src/src/icondelegate.h b/src/src/icondelegate.h index 75c4746..f0e7e5c 100644 --- a/src/src/icondelegate.h +++ b/src/src/icondelegate.h @@ -48,7 +48,7 @@ protected: private: int m_column; int m_compactSize; - bool m_compact; + bool m_compact{false}; }; #endif // ICONDELEGATE_H diff --git a/src/src/iconfetcher.cpp b/src/src/iconfetcher.cpp index e73100f..d711b72 100644 --- a/src/src/iconfetcher.cpp +++ b/src/src/iconfetcher.cpp @@ -21,7 +21,7 @@ void IconFetcher::Waiter::wakeUp() m_wakeUp.notify_one(); } -IconFetcher::IconFetcher() : m_iconSize(16), m_stop(false) +IconFetcher::IconFetcher() : m_stop(false) { m_quickCache.file = getPixmapIcon(QFileIconProvider::File); m_quickCache.directory = getPixmapIcon(QFileIconProvider::Folder); diff --git a/src/src/iconfetcher.h b/src/src/iconfetcher.h index e0f3baf..f748090 100644 --- a/src/src/iconfetcher.h +++ b/src/src/iconfetcher.h @@ -45,7 +45,7 @@ private: bool m_queueAvailable = false; }; - const int m_iconSize; + const int m_iconSize{16}; QFileIconProvider m_provider; std::thread m_thread; std::atomic m_stop; diff --git a/src/src/installationmanager.cpp b/src/src/installationmanager.cpp index a59458d..d9e4b5c 100644 --- a/src/src/installationmanager.cpp +++ b/src/src/installationmanager.cpp @@ -75,8 +75,8 @@ QString storeMetaPath(const QString& value) } // namespace InstallationResult::InstallationResult(IPluginInstaller::EInstallResult result) - : m_result(result), m_name(), m_iniTweaks(false), m_backup(false), m_merged(false), - m_replaced(false) + : m_result(result) + {} template @@ -92,7 +92,7 @@ static T resolveFunction(QLibrary& lib, const char* name) return temp; } -InstallationManager::InstallationManager() : m_ParentWidget(nullptr), m_IsRunning(false) +InstallationManager::InstallationManager() { m_ArchiveHandler = CreateArchive(); if (!m_ArchiveHandler->isValid()) { @@ -835,7 +835,7 @@ InstallationResult InstallationManager::install(const QString& fileName, ((filesTree == nullptr) && installerCustom->isArchiveSupported(fileName)))) { std::set installerExt = installerCustom->supportedExtensions(); - if (installerExt.find(fileInfo.suffix()) != installerExt.end()) { + if (installerExt.contains(fileInfo.suffix())) { installResult.m_result = installerCustom->install(modName, gameName, fileName, version, modID); unsigned int idx = ModInfo::getIndex(modName); diff --git a/src/src/installationmanager.h b/src/src/installationmanager.h index 26a9bca..ee7f216 100644 --- a/src/src/installationmanager.h +++ b/src/src/installationmanager.h @@ -73,10 +73,10 @@ private: QString m_name; - bool m_iniTweaks; - bool m_backup; - bool m_merged; - bool m_replaced; + bool m_iniTweaks{false}; + bool m_backup{false}; + bool m_merged{false}; + bool m_replaced{false}; }; class InstallationManager : public QObject, public MOBase::IInstallationManager @@ -91,7 +91,7 @@ public: **/ explicit InstallationManager(); - virtual ~InstallationManager(); + ~InstallationManager() override; void setParentWidget(QWidget* widget); @@ -333,9 +333,9 @@ private: // The plugin container, mostly to check if installer are enabled or not. const PluginContainer* m_PluginContainer; - bool m_IsRunning; + bool m_IsRunning{false}; - QWidget* m_ParentWidget; + QWidget* m_ParentWidget{nullptr}; QString m_ModsDirectory; QString m_DownloadsDirectory; diff --git a/src/src/instancemanager.cpp b/src/src/instancemanager.cpp index 4b6d4f2..ae746a9 100644 --- a/src/src/instancemanager.cpp +++ b/src/src/instancemanager.cpp @@ -47,7 +47,7 @@ along with Mod Organizer. If not, see . using namespace MOBase; Instance::Instance(QString dir, bool portable, QString profileName) - : m_dir(std::move(dir)), m_portable(portable), m_plugin(nullptr), + : m_dir(std::move(dir)), m_portable(portable), m_profile(std::move(profileName)) { // Ensure portable instances have a ModOrganizer.sh launcher script. diff --git a/src/src/instancemanager.h b/src/src/instancemanager.h index e4bf7a3..c761865 100644 --- a/src/src/instancemanager.h +++ b/src/src/instancemanager.h @@ -193,7 +193,7 @@ private: QString m_dir; bool m_portable; QString m_gameName, m_gameDir, m_gameVariant, m_baseDir; - MOBase::IPluginGame* m_plugin; + MOBase::IPluginGame* m_plugin{nullptr}; QString m_profile; // figures out the game plugin for this instance diff --git a/src/src/instancemanagerdialog.cpp b/src/src/instancemanagerdialog.cpp index 96511cc..1dc42a2 100644 --- a/src/src/instancemanagerdialog.cpp +++ b/src/src/instancemanagerdialog.cpp @@ -159,8 +159,8 @@ QString getInstanceName(QWidget* parent, const QString& title, const QString& mo InstanceManagerDialog::~InstanceManagerDialog() = default; InstanceManagerDialog::InstanceManagerDialog(PluginContainer& pc, QWidget* parent) - : QDialog(parent), ui(new Ui::InstanceManagerDialog), m_pc(pc), m_model(nullptr), - m_restartOnSelect(true) + : QDialog(parent), ui(new Ui::InstanceManagerDialog), m_pc(pc) + { ui->setupUi(this); diff --git a/src/src/instancemanagerdialog.h b/src/src/instancemanagerdialog.h index fec48ff..6660eb2 100644 --- a/src/src/instancemanagerdialog.h +++ b/src/src/instancemanagerdialog.h @@ -21,7 +21,7 @@ class InstanceManagerDialog : public QDialog public: explicit InstanceManagerDialog(PluginContainer& pc, QWidget* parent = nullptr); - ~InstanceManagerDialog(); + ~InstanceManagerDialog() override; // selects the instance having the given index in the list // @@ -97,8 +97,8 @@ private: PluginContainer& m_pc; std::vector> m_instances; MOBase::FilterWidget m_filter; - QStandardItemModel* m_model; - bool m_restartOnSelect; + QStandardItemModel* m_model{nullptr}; + bool m_restartOnSelect{true}; // refreshes the list instances from disk // diff --git a/src/src/lcdnumber.h b/src/src/lcdnumber.h index 573d79a..bb79967 100644 --- a/src/src/lcdnumber.h +++ b/src/src/lcdnumber.h @@ -25,7 +25,7 @@ class LCDNumber : public QLCDNumber public: LCDNumber(QWidget* parent = nullptr); - void mousePressEvent(QMouseEvent* event); + void mousePressEvent(QMouseEvent* event) override; public slots: void showToolTip(); diff --git a/src/src/listdialog.cpp b/src/src/listdialog.cpp index 8084a0b..964e050 100644 --- a/src/src/listdialog.cpp +++ b/src/src/listdialog.cpp @@ -20,7 +20,7 @@ along with Mod Organizer. If not, see . #include "ui_listdialog.h" ListDialog::ListDialog(QWidget* parent) - : QDialog(parent), ui(new Ui::ListDialog), m_Choices() + : QDialog(parent), ui(new Ui::ListDialog) { ui->setupUi(this); ui->filterEdit->setFocus(); @@ -47,7 +47,7 @@ void ListDialog::setChoices(QStringList choices) QString ListDialog::getChoice() const { - if (ui->choiceList->selectedItems().length()) { + if (!ui->choiceList->selectedItems().empty()) { return ui->choiceList->currentItem()->text(); } else { return ""; diff --git a/src/src/listdialog.h b/src/src/listdialog.h index ec2556b..af937cd 100644 --- a/src/src/listdialog.h +++ b/src/src/listdialog.h @@ -14,7 +14,7 @@ class ListDialog : public QDialog public: explicit ListDialog(QWidget* parent = nullptr); - ~ListDialog(); + ~ListDialog() override; // also saves and restores geometry // diff --git a/src/src/loghighlighter.h b/src/src/loghighlighter.h index d807004..06db2fd 100644 --- a/src/src/loghighlighter.h +++ b/src/src/loghighlighter.h @@ -30,14 +30,14 @@ class LogHighlighter : public QSyntaxHighlighter { Q_OBJECT public: - explicit LogHighlighter(QObject* parent = 0); + explicit LogHighlighter(QObject* parent = nullptr); signals: public slots: protected: - virtual void highlightBlock(const QString& text); + void highlightBlock(const QString& text) override; }; #endif // LOGHIGHLIGHTER_H diff --git a/src/src/loglist.cpp b/src/src/loglist.cpp index eb6d757..d324f32 100644 --- a/src/src/loglist.cpp +++ b/src/src/loglist.cpp @@ -174,7 +174,7 @@ QVariant LogModel::headerData(int, Qt::Orientation, int) const } LogList::LogList(QWidget* parent) - : QTreeView(parent), m_core(nullptr), m_copyFilter(this, [=](auto&& index) { + : QTreeView(parent), m_copyFilter(this, [=](auto&& index) { return LogModel::instance().formattedMessage(index); }) { diff --git a/src/src/loglist.h b/src/src/loglist.h index 93eb78a..bea56f6 100644 --- a/src/src/loglist.h +++ b/src/src/loglist.h @@ -76,7 +76,7 @@ public: QMenu* createMenu(QWidget* parent = nullptr); private: - OrganizerCore* m_core; + OrganizerCore* m_core{nullptr}; QTimer m_timer; CopyEventFilter m_copyFilter; diff --git a/src/src/mainwindow.cpp b/src/src/mainwindow.cpp index 95540a7..16e0a0a 100644 --- a/src/src/mainwindow.cpp +++ b/src/src/mainwindow.cpp @@ -237,14 +237,12 @@ void setFilterShortcuts(QWidget* widget, QLineEdit* edit) MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore, PluginContainer& pluginContainer, QWidget* parent) - : QMainWindow(parent), ui(new Ui::MainWindow), m_WasVisible(false), - m_FirstPaint(true), m_linksSeparator(nullptr), m_Tutorial(this, "MainWindow"), - m_OldProfileIndex(-1), m_OldExecutableIndex(-1), + : QMainWindow(parent), ui(new Ui::MainWindow), m_Tutorial(this, "MainWindow"), + m_CategoryFactory(CategoryFactory::instance()), m_OrganizerCore(organizerCore), m_PluginContainer(pluginContainer), m_ArchiveListWriter(std::bind(&MainWindow::saveArchiveList, this)), - m_LinkToolbar(nullptr), m_LinkDesktop(nullptr), m_LinkStartMenu(nullptr), - m_SystemTrayManager(nullptr), m_NumberOfProblems(0), + m_NumberOfProblems(0), m_ProblemsCheckRequired(false) { // disables incredibly slow menu fade in effect that looks and feels like crap. @@ -1728,7 +1726,7 @@ void MainWindow::updateModPageMenu() } // Add a separator if needed - if (registeredSources.length() > 0) + if (!registeredSources.empty()) ui->actionModPage->menu()->addSeparator(); // Add the secondary games (sorted) @@ -1741,7 +1739,7 @@ void MainWindow::updateModPageMenu() // No mod page plugin and the menu was visible bool keepOriginalAction = - modPagePlugins.size() == 0 && registeredSources.length() <= 1; + modPagePlugins.empty() && registeredSources.length() <= 1; if (keepOriginalAction) { ui->toolBar->insertAction(ui->actionAdd_Profile, ui->actionNexus); } else { @@ -2112,7 +2110,7 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives, QList items = ui->bsaList->findItems(modName, Qt::MatchFixedString); QTreeWidgetItem* subItem = nullptr; - if (items.length() > 0) { + if (!items.empty()) { subItem = items.at(0); } else { subItem = new QTreeWidgetItem(QStringList(modName)); diff --git a/src/src/mainwindow.h b/src/src/mainwindow.h index 161ef5c..f048cb1 100644 --- a/src/src/mainwindow.h +++ b/src/src/mainwindow.h @@ -125,8 +125,8 @@ class MainWindow : public QMainWindow, public IUserInterface public: explicit MainWindow(Settings& settings, OrganizerCore& organizerCore, - PluginContainer& pluginContainer, QWidget* parent = 0); - ~MainWindow(); + PluginContainer& pluginContainer, QWidget* parent = nullptr); + ~MainWindow() override; void processUpdates(); @@ -134,11 +134,11 @@ public: bool addProfile(); void updateBSAList(const QStringList& defaultArchives, - const QStringList& activeArchives); + const QStringList& activeArchives) override; void saveArchiveList(); - void installTranslator(const QString& name); + void installTranslator(const QString& name) override; void displayModInformation(ModInfo::Ptr modInfo, unsigned int modIndex, ModInfoTabIDs tabID) override; @@ -146,10 +146,10 @@ public: bool canExit(); void onBeforeClose(); - virtual bool closeWindow(); - virtual void setWindowEnabled(bool enabled); + bool closeWindow() override; + void setWindowEnabled(bool enabled) override; - virtual MOBase::DelayedFileWriterBase& archivesWriter() override + MOBase::DelayedFileWriterBase& archivesWriter() override { return m_ArchiveListWriter; } @@ -199,7 +199,7 @@ private: void setToolbarSize(const QSize& s); void setToolbarButtonStyle(Qt::ToolButtonStyle s); - void registerModPage(MOBase::IPluginModPage* modPage); + void registerModPage(MOBase::IPluginModPage* modPage) override; bool registerNexusPage(const QString& gameName); void registerPluginTool(MOBase::IPluginTool* tool, QString name = QString(), QMenu* menu = nullptr); @@ -259,12 +259,12 @@ private: private: Ui::MainWindow* ui; - bool m_WasVisible; - bool m_FirstPaint; + bool m_WasVisible{false}; + bool m_FirstPaint{true}; // last separator on the toolbar, used to add spacer for right-alignment and // as an insert point for executables - QAction* m_linksSeparator; + QAction* m_linksSeparator{nullptr}; MOBase::TutorialControl m_Tutorial; @@ -272,14 +272,14 @@ private: std::unique_ptr m_DownloadsTab; std::unique_ptr m_SavesTab; - int m_OldProfileIndex; + int m_OldProfileIndex{-1}; std::vector m_ModNameList; // the mod-list to go with the directory structure QStringList m_DefaultArchives; - int m_OldExecutableIndex; + int m_OldExecutableIndex{-1}; QAction* m_ContextAction; @@ -305,11 +305,11 @@ private: MOBase::DelayedFileWriter m_ArchiveListWriter; - QAction* m_LinkToolbar; - QAction* m_LinkDesktop; - QAction* m_LinkStartMenu; + QAction* m_LinkToolbar{nullptr}; + QAction* m_LinkDesktop{nullptr}; + QAction* m_LinkStartMenu{nullptr}; - SystemTrayManager* m_SystemTrayManager; + SystemTrayManager* m_SystemTrayManager{nullptr}; // icon set by the stylesheet, used to remember its original appearance // when painting the count diff --git a/src/src/messagedialog.h b/src/src/messagedialog.h index 7c102f8..17e42ab 100644 --- a/src/src/messagedialog.h +++ b/src/src/messagedialog.h @@ -46,7 +46,7 @@ public: explicit MessageDialog(const QString& text, QWidget* reference); - ~MessageDialog(); + ~MessageDialog() override; /** * factory function for message dialogs. This can be used as a fire-and-forget. The @@ -64,7 +64,7 @@ public: bool bringToFront = true); protected: - virtual void resizeEvent(QResizeEvent* event); + void resizeEvent(QResizeEvent* event) override; private: Ui::MessageDialog* ui; diff --git a/src/src/moapplication.cpp b/src/src/moapplication.cpp index 7230536..99d65fa 100644 --- a/src/src/moapplication.cpp +++ b/src/src/moapplication.cpp @@ -63,7 +63,7 @@ using namespace MOShared; class ProxyStyle : public QProxyStyle { public: - ProxyStyle(QStyle* baseStyle = 0) : QProxyStyle(baseStyle) {} + ProxyStyle(QStyle* baseStyle = nullptr) : QProxyStyle(baseStyle) {} void drawPrimitive(PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const override diff --git a/src/src/modidlineedit.h b/src/src/modidlineedit.h index cf70659..20fb363 100644 --- a/src/src/modidlineedit.h +++ b/src/src/modidlineedit.h @@ -8,11 +8,11 @@ class ModIDLineEdit : public QLineEdit Q_OBJECT public: - explicit ModIDLineEdit(QWidget* parent = 0); - explicit ModIDLineEdit(const QString& text, QWidget* parent = 0); + explicit ModIDLineEdit(QWidget* parent = nullptr); + explicit ModIDLineEdit(const QString& text, QWidget* parent = nullptr); public: - virtual bool event(QEvent* event) override; + bool event(QEvent* event) override; signals: void linkClicked(QString); diff --git a/src/src/modinfo.cpp b/src/src/modinfo.cpp index d10abfd..340794c 100644 --- a/src/src/modinfo.cpp +++ b/src/src/modinfo.cpp @@ -306,7 +306,7 @@ void ModInfo::updateIndices() } } -ModInfo::ModInfo(OrganizerCore& core) : m_PrimaryCategory(-1), m_Core(core) {} +ModInfo::ModInfo(OrganizerCore& core) : m_Core(core) {} bool ModInfo::checkAllForUpdate(PluginContainer* pluginContainer, QObject* receiver) { @@ -477,7 +477,7 @@ void ModInfo::manualUpdateCheck(QObject* receiver, std::multimap I return a->getLastNexusUpdate() < b->getLastNexusUpdate(); }); - if (mods.size()) { + if (!mods.empty()) { log::info("Checking updates for {} mods...", mods.size()); for (auto mod : mods) { diff --git a/src/src/modinfo.h b/src/src/modinfo.h index 6475523..6133e5a 100644 --- a/src/src/modinfo.h +++ b/src/src/modinfo.h @@ -253,22 +253,22 @@ public: // IModInterface implementations / Re-declaration /** * @return the name of the mod. */ - virtual QString name() const = 0; + QString name() const override = 0; /** * @return the absolute path to the mod to be used in file system operations. */ - virtual QString absolutePath() const = 0; + QString absolutePath() const override = 0; /** * @return the comments for this mod, if any. */ - virtual QString comments() const = 0; + QString comments() const override = 0; /** * @return the notes for this mod, if any. */ - virtual QString notes() const = 0; + QString notes() const override = 0; /** * @brief Retrieve the short name of the game associated with this mod. This may @@ -277,41 +277,41 @@ public: // IModInterface implementations / Re-declaration * * @return the name of the game associated with this mod. */ - virtual QString gameName() const = 0; + QString gameName() const override = 0; /** * @return the name of the repository from which this mod was installed. */ - virtual QString repository() const override { return ""; } + QString repository() const override { return ""; } /** * @return the nexus ID of this mod on the repository. */ - virtual int nexusId() const = 0; + int nexusId() const override = 0; /** * @return the current version of this mod. */ - virtual MOBase::VersionInfo version() const override { return m_Version; } + MOBase::VersionInfo version() const override { return m_Version; } /** * @return the newest version of thid mod (as known by MO2). If this matches * version(), then the mod is up-to-date. */ - virtual MOBase::VersionInfo newestVersion() const = 0; + MOBase::VersionInfo newestVersion() const override = 0; /** * @return the ignored version of this mod (for update), or an invalid version if the * user did not ignore version for this mod. */ - virtual MOBase::VersionInfo ignoredVersion() const = 0; + MOBase::VersionInfo ignoredVersion() const override = 0; /** * @return the absolute path to the file that was used to install this mod. */ - virtual QString installationFile() const = 0; + QString installationFile() const override = 0; - virtual std::set> installedFiles() const = 0; + std::set> installedFiles() const override = 0; /** * @return true if this mod was marked as converted by the user. @@ -319,7 +319,7 @@ public: // IModInterface implementations / Re-declaration * @note When a mod is for a different game, a flag is shown to users to warn them, * but they can mark mods as converted to remove this flag. */ - virtual bool converted() const = 0; + bool converted() const override = 0; /** * @return true if th is mod was marked as containing valid game data. @@ -328,18 +328,18 @@ public: // IModInterface implementations / Re-declaration * fail, in which case mods are incorrectly marked as 'not containing valid games * data'. Users can choose to mark these mods as valid to hide the warning / flag. */ - virtual bool validated() const = 0; + bool validated() const override = 0; /** * @return the color of the 'Notes' column chosen by the user. */ - virtual QColor color() const override { return QColor(); } + QColor color() const override { return QColor(); } /** * @return the URL of this mod, or an empty QString() if no URL is associated * with this mod. */ - virtual QString url() const override { return ""; } + QString url() const override { return ""; } /** * @return the ID of the primary category of this mod. @@ -349,27 +349,27 @@ public: // IModInterface implementations / Re-declaration /** * @return the list of categories this mod belongs to. */ - virtual QStringList categories() const override; + QStringList categories() const override; /** * @return the author of the mod. */ - virtual QString author() const = 0; + QString author() const override = 0; /** * @return the name of the uploader of this mod. */ - virtual QString uploader() const = 0; + QString uploader() const override = 0; /** * @return the URL of the uploader of this mod's profile. */ - virtual QString uploaderUrl() const = 0; + QString uploaderUrl() const override = 0; /** * @return the tracked state of this mod. */ - virtual MOBase::TrackedState trackedState() const override + MOBase::TrackedState trackedState() const override { return MOBase::TrackedState::TRACKED_FALSE; } @@ -377,7 +377,7 @@ public: // IModInterface implementations / Re-declaration /** * @return the endorsement state of this mod. */ - virtual MOBase::EndorsedState endorsedState() const override + MOBase::EndorsedState endorsedState() const override { return MOBase::EndorsedState::ENDORSED_NEVER; } @@ -391,7 +391,7 @@ public: // IModInterface implementations / Re-declaration * * @return a file tree representing the content of this mod. */ - virtual std::shared_ptr fileTree() const = 0; + std::shared_ptr fileTree() const override = 0; /** * @return true if this object represents a regular mod. @@ -401,22 +401,22 @@ public: // IModInterface implementations / Re-declaration /** * @return true if this object represents the overwrite mod. */ - virtual bool isOverwrite() const { return false; } + bool isOverwrite() const override { return false; } /** * @return true if this object represents a backup. */ - virtual bool isBackup() const { return false; } + bool isBackup() const override { return false; } /** * @return true if this object represents a separator. */ - virtual bool isSeparator() const { return false; } + bool isSeparator() const override { return false; } /** * @return true if this object represents a foreign mod. */ - virtual bool isForeign() const { return false; } + bool isForeign() const override { return false; } public: // Mutable operations: /** @@ -424,35 +424,35 @@ public: // Mutable operations: * * @param version New version of the mod. */ - virtual void setVersion(const MOBase::VersionInfo& version) override; + void setVersion(const MOBase::VersionInfo& version) override; /** * @brief Sets the installation file for this mod. * * @param fileName archive file name. */ - virtual void setInstallationFile(const QString& fileName) = 0; + void setInstallationFile(const QString& fileName) override = 0; /** * @brief Sets or changes the latest known version of this mod. * * @param version Newest known version of the mod. */ - virtual void setNewestVersion(const MOBase::VersionInfo& version) = 0; + void setNewestVersion(const MOBase::VersionInfo& version) override = 0; /** * @brief Sets endorsement state of the mod. * * @param endorsed New endorsement state. */ - virtual void setIsEndorsed(bool endorsed) = 0; + void setIsEndorsed(bool endorsed) override = 0; /** * @brief Sets the mod id on nexus for this mod. * * @param nexusID The new Nexus id to set. */ - virtual void setNexusID(int nexusID) = 0; + void setNexusID(int nexusID) override = 0; /** * @brief Sets the category id from a nexus category id. Conversion to MO id happens @@ -462,7 +462,7 @@ public: // Mutable operations: * * @note If a mapping is not possible, the category is set to the default value. */ - virtual void addNexusCategory(int categoryID) = 0; + void addNexusCategory(int categoryID) override = 0; /** * @brief Assigns a category to the mod. If the named category does not exist it is @@ -470,7 +470,7 @@ public: // Mutable operations: * * @param categoryName Name of the new category. */ - virtual void addCategory(const QString& categoryName) override; + void addCategory(const QString& categoryName) override; /** * @brief Unassigns a category from this mod. @@ -480,14 +480,14 @@ public: // Mutable operations: * @return true if the category was removed successfully, false if no such category * was assigned. */ - virtual bool removeCategory(const QString& categoryName) override; + bool removeCategory(const QString& categoryName) override; /** * @brief Sets or changes the source game of this mod. * * @param gameName The source game short name. */ - virtual void setGameName(const QString& gameName) = 0; + void setGameName(const QString& gameName) override = 0; /** * @brief Sets the name of this mod. @@ -1010,7 +1010,7 @@ protected: // the index of the mod in s_Collection, only valid after updateIndices() int m_Index; - int m_PrimaryCategory; + int m_PrimaryCategory{-1}; std::set m_Categories; MOBase::VersionInfo m_Version; bool m_PluginSelected = false; diff --git a/src/src/modinfobackup.h b/src/src/modinfobackup.h index b8ccc0e..917314d 100644 --- a/src/src/modinfobackup.h +++ b/src/src/modinfobackup.h @@ -11,44 +11,44 @@ class ModInfoBackup : public ModInfoRegular friend class ModInfo; public: - virtual bool updateAvailable() const override { return false; } - virtual bool updateIgnored() const override { return false; } - virtual bool downgradeAvailable() const override { return false; } - virtual bool updateNXMInfo() override { return false; } - virtual void setGameName(const QString& gameName) override {} - virtual void setNexusID(int) override {} - virtual void endorse(bool) override {} - virtual void ignoreUpdate(bool) override {} - virtual bool alwaysDisabled() const override { return true; } - virtual bool canBeUpdated() const override { return false; } - virtual QDateTime getExpires() const override { return QDateTime(); } - virtual bool canBeEnabled() const override { return false; } - virtual std::vector getIniTweaks() const override + bool updateAvailable() const override { return false; } + bool updateIgnored() const override { return false; } + bool downgradeAvailable() const override { return false; } + bool updateNXMInfo() override { return false; } + void setGameName(const QString& gameName) override {} + void setNexusID(int) override {} + void endorse(bool) override {} + void ignoreUpdate(bool) override {} + bool alwaysDisabled() const override { return true; } + bool canBeUpdated() const override { return false; } + QDateTime getExpires() const override { return QDateTime(); } + bool canBeEnabled() const override { return false; } + std::vector getIniTweaks() const override { return std::vector(); } - virtual std::vector getFlags() const override; - virtual QString getDescription() const override; - virtual int getNexusFileStatus() const override { return 0; } - virtual void setNexusFileStatus(int) override {} - virtual QDateTime getLastNexusQuery() const override { return QDateTime(); } - virtual void setLastNexusQuery(QDateTime) override {} - virtual QDateTime getLastNexusUpdate() const override { return QDateTime(); } - virtual void setLastNexusUpdate(QDateTime) override {} - virtual QDateTime getNexusLastModified() const override { return QDateTime(); } - virtual void setNexusLastModified(QDateTime) override {} - virtual QString getNexusDescription() const override { return QString(); } - virtual void setNexusCategory(int) override {} - virtual int getNexusCategory() const override { return 0; } - virtual QString author() const override { return QString(); } - virtual void setAuthor(const QString&) override {} - virtual QString uploader() const override { return QString(); } - virtual void setUploader(const QString&) override {} - virtual QString uploaderUrl() const override { return QString(); } - virtual void setUploaderUrl(const QString&) override {} - virtual bool isBackup() const override { return true; } - - virtual void addInstalledFile(int, int) override {} + std::vector getFlags() const override; + QString getDescription() const override; + int getNexusFileStatus() const override { return 0; } + void setNexusFileStatus(int) override {} + QDateTime getLastNexusQuery() const override { return QDateTime(); } + void setLastNexusQuery(QDateTime) override {} + QDateTime getLastNexusUpdate() const override { return QDateTime(); } + void setLastNexusUpdate(QDateTime) override {} + QDateTime getNexusLastModified() const override { return QDateTime(); } + void setNexusLastModified(QDateTime) override {} + QString getNexusDescription() const override { return QString(); } + void setNexusCategory(int) override {} + int getNexusCategory() const override { return 0; } + QString author() const override { return QString(); } + void setAuthor(const QString&) override {} + QString uploader() const override { return QString(); } + void setUploader(const QString&) override {} + QString uploaderUrl() const override { return QString(); } + void setUploaderUrl(const QString&) override {} + bool isBackup() const override { return true; } + + void addInstalledFile(int, int) override {} private: ModInfoBackup(const QDir& path, OrganizerCore& core); diff --git a/src/src/modinfodialog.cpp b/src/src/modinfodialog.cpp index eac6a0f..ff00f3a 100644 --- a/src/src/modinfodialog.cpp +++ b/src/src/modinfodialog.cpp @@ -156,7 +156,7 @@ FileRenamer::RenameResults restoreHiddenFilesRecursive(FileRenamer& renamer, } ModInfoDialog::TabInfo::TabInfo(std::unique_ptr tab) - : tab(std::move(tab)), realPos(-1), widget(nullptr) + : tab(std::move(tab)) {} bool ModInfoDialog::TabInfo::isVisible() const @@ -168,8 +168,8 @@ ModInfoDialog::ModInfoDialog(OrganizerCore& core, PluginContainer& plugin, ModInfo::Ptr mod, ModListView* modListView, QWidget* parent) : TutorableDialog("ModInfoDialog", parent), ui(new Ui::ModInfoDialog), m_core(core), - m_plugin(plugin), m_modListView(modListView), m_initialTab(ModInfoTabIDs::None), - m_arrangingTabs(false) + m_plugin(plugin), m_modListView(modListView) + { ui->setupUi(this); diff --git a/src/src/modinfodialog.h b/src/src/modinfodialog.h index b322079..7d7063b 100644 --- a/src/src/modinfodialog.h +++ b/src/src/modinfodialog.h @@ -59,7 +59,7 @@ public: ModInfoDialog(OrganizerCore& core, PluginContainer& plugin, ModInfo::Ptr mod, ModListView* view, QWidget* parent = nullptr); - ~ModInfoDialog(); + ~ModInfoDialog() override; // switches to the tab with the given id // @@ -82,7 +82,7 @@ signals: protected: // forwards to tryClose() // - void closeEvent(QCloseEvent* e); + void closeEvent(QCloseEvent* e) override; private: // represents a single tab @@ -93,7 +93,7 @@ private: std::unique_ptr tab; // actual position in the tab bar, updated every time a tab is moved - int realPos; + int realPos{-1}; // widget used by the QTabWidget for this tab // @@ -106,7 +106,7 @@ private: // // `widget` is also used figure out which tab is where when they're // re-ordered - QWidget* widget; + QWidget* widget{nullptr}; // caption for this tab, see `widget` QString caption; @@ -130,7 +130,7 @@ private: // initial tab requested by the main window when the dialog is opened; whether // the request can be honoured depends on what tabs are present - ModInfoTabIDs m_initialTab; + ModInfoTabIDs m_initialTab{ModInfoTabIDs::None}; // set to true when tabs are being removed and re-added while navigating // between mods; since the current index changes while this is happening, @@ -138,7 +138,7 @@ private: // // however, it will check this flag and ignore the event so first activations // are not fired incorrectly - bool m_arrangingTabs; + bool m_arrangingTabs{false}; // creates all the tabs and connects events // diff --git a/src/src/modinfodialogcategories.cpp b/src/src/modinfodialogcategories.cpp index 24cd815..6c4c9b5 100644 --- a/src/src/modinfodialogcategories.cpp +++ b/src/src/modinfodialogcategories.cpp @@ -61,7 +61,7 @@ void CategoriesTab::add(const CategoryFactory& factory, newItem->setFlags(newItem->flags() | Qt::ItemIsUserCheckable); newItem->setCheckState(0, - enabledCategories.find(categoryID) != enabledCategories.end() + enabledCategories.contains(categoryID) ? Qt::Checked : Qt::Unchecked); diff --git a/src/src/modinfodialogconflictsmodels.cpp b/src/src/modinfodialogconflictsmodels.cpp index 7594af6..e5790da 100644 --- a/src/src/modinfodialogconflictsmodels.cpp +++ b/src/src/modinfodialogconflictsmodels.cpp @@ -84,8 +84,8 @@ bool ConflictItem::canExplore() const } ConflictListModel::ConflictListModel(QTreeView* tree, std::vector columns) - : m_tree(tree), m_columns(std::move(columns)), m_sortColumn(-1), - m_sortOrder(Qt::AscendingOrder) + : m_tree(tree), m_columns(std::move(columns)) + { m_tree->setModel(this); } diff --git a/src/src/modinfodialogconflictsmodels.h b/src/src/modinfodialogconflictsmodels.h index 46feb57..4216bda 100644 --- a/src/src/modinfodialogconflictsmodels.h +++ b/src/src/modinfodialogconflictsmodels.h @@ -60,9 +60,9 @@ public: int rowCount(const QModelIndex& parent = {}) const override; int columnCount(const QModelIndex& = {}) const override; QVariant data(const QModelIndex& index, int role) const override; - QVariant headerData(int col, Qt::Orientation, int role) const; + QVariant headerData(int col, Qt::Orientation, int role) const override; - void sort(int colIndex, Qt::SortOrder order = Qt::AscendingOrder); + void sort(int colIndex, Qt::SortOrder order = Qt::AscendingOrder) override; void add(ConflictItem item); void finished(); @@ -73,8 +73,8 @@ private: QTreeView* m_tree; std::vector m_columns; std::vector m_items; - int m_sortColumn; - Qt::SortOrder m_sortOrder; + int m_sortColumn{-1}; + Qt::SortOrder m_sortOrder{Qt::AscendingOrder}; const ConflictItem* itemFromIndex(const QModelIndex& index) const; QModelIndex indexFromItem(const ConflictItem* item, int col); diff --git a/src/src/modinfodialogesps.cpp b/src/src/modinfodialogesps.cpp index b2f19e2..3e19664 100644 --- a/src/src/modinfodialogesps.cpp +++ b/src/src/modinfodialogesps.cpp @@ -11,7 +11,7 @@ class ESPItem { public: ESPItem(QString rootPath, QString relativePath) - : m_rootPath(std::move(rootPath)), m_active(false) + : m_rootPath(std::move(rootPath)) { if (relativePath.contains('/') || relativePath.contains('\\')) { m_inactivePath = relativePath; @@ -85,7 +85,7 @@ private: QString m_inactivePath; QString m_filename; QFileInfo m_fileInfo; - bool m_active; + bool m_active{false}; void pathChanged() { diff --git a/src/src/modinfodialogesps.h b/src/src/modinfodialogesps.h index 53b1651..5b27866 100644 --- a/src/src/modinfodialogesps.h +++ b/src/src/modinfodialogesps.h @@ -15,7 +15,7 @@ public: void clear() override; bool feedFile(const QString& rootPath, const QString& fullPath) override; - void update(); + void update() override; void saveState(Settings& s) override; void restoreState(const Settings& s) override; diff --git a/src/src/modinfodialogfiletree.cpp b/src/src/modinfodialogfiletree.cpp index 30b37ee..5b231a4 100644 --- a/src/src/modinfodialogfiletree.cpp +++ b/src/src/modinfodialogfiletree.cpp @@ -15,7 +15,7 @@ namespace shell = MOBase::shell; const int max_scan_for_context_menu = 50; FileTreeTab::FileTreeTab(ModInfoDialogTabContext cx) - : ModInfoDialogTab(std::move(cx)), m_fs(nullptr) + : ModInfoDialogTab(std::move(cx)) { m_fs = new QFileSystemModel(this); m_fs->setReadOnly(false); @@ -134,7 +134,7 @@ void FileTreeTab::onCreateDirectory() QModelIndex selection; - if (selectedRows.size() == 0) { + if (selectedRows.empty()) { selection = m_fs->index(m_fs->rootPath(), 0); } else { selection = selectedRows[0]; @@ -423,7 +423,7 @@ void FileTreeTab::onContextMenu(const QPoint& pos) bool enableHide = false; bool enableUnhide = false; - if (selection.size() == 0) { + if (selection.empty()) { // no selection, only new folder and explore enableNewFolder = true; enableExplore = true; diff --git a/src/src/modinfodialogfiletree.h b/src/src/modinfodialogfiletree.h index f73280c..06e1cb6 100644 --- a/src/src/modinfodialogfiletree.h +++ b/src/src/modinfodialogfiletree.h @@ -12,8 +12,8 @@ public: FileTreeTab(ModInfoDialogTabContext cx); void clear() override; - void saveState(Settings& s); - void restoreState(const Settings& s); + void saveState(Settings& s) override; + void restoreState(const Settings& s) override; void update() override; bool deleteRequested() override; @@ -31,7 +31,7 @@ private: QAction* unhide = nullptr; }; - QFileSystemModel* m_fs; + QFileSystemModel* m_fs{nullptr}; Actions m_actions; void onCreateDirectory(); diff --git a/src/src/modinfodialogfwd.h b/src/src/modinfodialogfwd.h index 88df4f7..46ee1ab 100644 --- a/src/src/modinfodialogfwd.h +++ b/src/src/modinfodialogfwd.h @@ -42,7 +42,7 @@ public: using QStyledItemDelegate::QStyledItemDelegate; protected: - void initStyleOption(QStyleOptionViewItem* o, const QModelIndex& i) const + void initStyleOption(QStyleOptionViewItem* o, const QModelIndex& i) const override { QStyledItemDelegate::initStyleOption(o, i); o->textElideMode = Qt::ElideLeft; diff --git a/src/src/modinfodialogimages.cpp b/src/src/modinfodialogimages.cpp index 2715c60..53038a1 100644 --- a/src/src/modinfodialogimages.cpp +++ b/src/src/modinfodialogimages.cpp @@ -32,8 +32,7 @@ QString dimensionString(const QSize& s) } ImagesTab::ImagesTab(ModInfoDialogTabContext cx) - : ModInfoDialogTab(std::move(cx)), m_image(new ScalableImage), - m_ddsAvailable(false), m_ddsEnabled(false) + : ModInfoDialogTab(std::move(cx)), m_image(new ScalableImage) { getSupportedFormats(); @@ -135,7 +134,7 @@ void ImagesTab::update() ui->imagesThumbnails->update(); - setHasData(m_files.size() > 0); + setHasData(!m_files.empty()); } void ImagesTab::saveState(Settings& s) @@ -602,7 +601,7 @@ void ImagesTab::onFilterChanged() void ImagesTab::updateScrollbar() { - if (m_files.size() == 0) { + if (m_files.empty()) { ui->imagesScrollerVBar->setRange(0, 0); ui->imagesScrollerVBar->setEnabled(false); return; @@ -693,7 +692,7 @@ bool ThumbnailsWidget::event(QEvent* e) return QWidget::event(e); } -ScalableImage::ScalableImage(QString path) : m_path(std::move(path)), m_border(1) +ScalableImage::ScalableImage(QString path) : m_path(std::move(path)) { auto sp = sizePolicy(); sp.setHeightForWidth(true); @@ -780,7 +779,7 @@ void ScalableImage::paintEvent(QPaintEvent* e) } Metrics::Metrics() - : margins(3), border(1), padding(0), spacing(5), textSpacing(2), textHeight(0) + {} Geometry::Geometry(QSize widgetSize, Metrics metrics) @@ -882,7 +881,7 @@ QSize Geometry::scaledImageSize(const QSize& originalSize) const return resizeWithAspectRatio(originalSize, availableSize); } -File::File(QString path) : m_path(std::move(path)), m_failed(false) {} +File::File(QString path) : m_path(std::move(path)) {} void File::ensureOriginalLoaded() { @@ -970,7 +969,7 @@ void File::load(const Geometry& geo) } } -Files::Files() : m_selection(BadIndex), m_filtered(false) {} +Files::Files() : m_selection(BadIndex) {} void Files::clear() { @@ -1090,7 +1089,7 @@ bool Files::isFiltered() const } PaintContext::PaintContext(QWidget* w, Geometry geo) - : painter(w), geo(geo), file(nullptr), thumbIndex(0), fileIndex(0) + : painter(w), geo(geo) {} } // namespace ImagesTabHelpers diff --git a/src/src/modinfodialogimages.h b/src/src/modinfodialogimages.h index 665be50..2069212 100644 --- a/src/src/modinfodialogimages.h +++ b/src/src/modinfodialogimages.h @@ -56,7 +56,7 @@ protected: // forwards to ImagesTab::thumbnailAreaWheelEvent() // - void wheelEvent(QWheelEvent* e); + void wheelEvent(QWheelEvent* e) override; // forwards to ImagesTab::scrollAreaResized() // @@ -103,7 +103,7 @@ protected: private: QString m_path; QImage m_original, m_scaled; - int m_border; + int m_border{1}; QColor m_borderColor, m_backgroundColor; }; @@ -117,22 +117,22 @@ struct Theme struct Metrics { // space outside the thumbnail border - int margins; + int margins{3}; // size of the border - int border; + int border{1}; // space between the border and the image - int padding; + int padding{0}; // spacing between the thumbnail and the text - int textSpacing; + int textSpacing{2}; // height of the text - int textHeight; + int textHeight{0}; // spacing between thumbnails - int spacing; + int spacing{5}; Metrics(); }; @@ -246,7 +246,7 @@ private: QString m_path; mutable QString m_filename; QImage m_original, m_thumbnail; - bool m_failed; + bool m_failed{false}; bool needsLoad(const Geometry& geo) const; void load(const Geometry& geo); @@ -285,16 +285,16 @@ private: std::vector m_allFiles; std::vector m_filteredFiles; std::size_t m_selection; - bool m_filtered; + bool m_filtered{false}; }; struct PaintContext { mutable QPainter painter; Geometry geo; - File* file; - std::size_t thumbIndex; - std::size_t fileIndex; + File* file{nullptr}; + std::size_t thumbIndex{0}; + std::size_t fileIndex{0}; PaintContext(QWidget* w, Geometry geo); }; @@ -336,7 +336,7 @@ private: std::vector m_supportedFormats; Files m_files; FilterWidget m_filter; - bool m_ddsAvailable, m_ddsEnabled; + bool m_ddsAvailable{false}, m_ddsEnabled{false}; Theme m_theme; Metrics m_metrics; diff --git a/src/src/modinfodialognexus.cpp b/src/src/modinfodialognexus.cpp index c27f42e..0287887 100644 --- a/src/src/modinfodialognexus.cpp +++ b/src/src/modinfodialognexus.cpp @@ -16,7 +16,7 @@ bool isValidModID(int id) } NexusTab::NexusTab(ModInfoDialogTabContext cx) - : ModInfoDialogTab(std::move(cx)), m_requestStarted(false), m_loading(false) + : ModInfoDialogTab(std::move(cx)) { ui->modID->setValidator(new QIntValidator(ui->modID)); ui->endorse->setVisible(core().settings().nexus().endorsementIntegration()); @@ -101,7 +101,7 @@ void NexusTab::update() ui->sourceGame->addItem(core().managedGame()->gameName(), core().managedGame()->gameShortName()); - if (core().managedGame()->validShortNames().size() == 0) { + if (core().managedGame()->validShortNames().empty()) { ui->sourceGame->setDisabled(true); } else { for (auto game : plugin().plugins()) { diff --git a/src/src/modinfodialognexus.h b/src/src/modinfodialognexus.h index 3eec02c..a0dfdb1 100644 --- a/src/src/modinfodialognexus.h +++ b/src/src/modinfodialognexus.h @@ -34,7 +34,7 @@ class NexusTab : public ModInfoDialogTab public: NexusTab(ModInfoDialogTabContext cx); - ~NexusTab(); + ~NexusTab() override; void clear() override; void update() override; @@ -44,8 +44,8 @@ public: private: QMetaObject::Connection m_modConnection; - bool m_requestStarted; - bool m_loading; + bool m_requestStarted{false}; + bool m_loading{false}; void cleanup(); void updateVersionColor(); diff --git a/src/src/modinfodialogtab.cpp b/src/src/modinfodialogtab.cpp index 862c44e..7848a36 100644 --- a/src/src/modinfodialogtab.cpp +++ b/src/src/modinfodialogtab.cpp @@ -6,7 +6,7 @@ ModInfoDialogTab::ModInfoDialogTab(ModInfoDialogTabContext cx) : ui(cx.ui), m_core(cx.core), m_plugin(cx.plugin), m_parent(cx.parent), - m_origin(cx.origin), m_tabID(cx.id), m_hasData(false), m_firstActivation(true) + m_origin(cx.origin), m_tabID(cx.id) {} void ModInfoDialogTab::activated() diff --git a/src/src/modinfodialogtab.h b/src/src/modinfodialogtab.h index deb5936..ddc93cb 100644 --- a/src/src/modinfodialogtab.h +++ b/src/src/modinfodialogtab.h @@ -75,7 +75,7 @@ public: ModInfoDialogTab& operator=(const ModInfoDialogTab&) = delete; ModInfoDialogTab(ModInfoDialogTab&&) = default; ModInfoDialogTab& operator=(ModInfoDialogTab&&) = default; - virtual ~ModInfoDialogTab() = default; + ~ModInfoDialogTab() override = default; // called by ModInfoDialog every time this tab is selected; this will call // firstActivation() the first time it's called, until resetFirstActivation() @@ -266,10 +266,10 @@ private: ModInfoTabIDs m_tabID; // whether the tab has data - bool m_hasData; + bool m_hasData{false}; // true if the tab has never been selected for the current mod - bool m_firstActivation; + bool m_firstActivation{true}; }; // the Notes tab diff --git a/src/src/modinfoforeign.h b/src/src/modinfoforeign.h index 60d03ea..580f719 100644 --- a/src/src/modinfoforeign.h +++ b/src/src/modinfoforeign.h @@ -13,91 +13,91 @@ class ModInfoForeign : public ModInfoWithConflictInfo friend class ModInfo; public: - virtual bool updateAvailable() const override { return false; } - virtual bool updateIgnored() const override { return false; } - virtual bool downgradeAvailable() const override { return false; } - virtual bool updateNXMInfo() override { return false; } - virtual void setCategory(int, bool) override {} - virtual bool setName(const QString&) override { return false; } - virtual void setComments(const QString&) override {} - virtual void setNotes(const QString&) override {} - virtual void setGameName(const QString& gameName) override {} - virtual void setNexusID(int) override {} - virtual void setNewestVersion(const MOBase::VersionInfo&) override {} - virtual void ignoreUpdate(bool) override {} - virtual void setNexusDescription(const QString&) override {} - virtual void setInstallationFile(const QString&) override {} - virtual void addNexusCategory(int) override {} - virtual void setIsEndorsed(bool) override {} - virtual void setNeverEndorse() override {} - virtual void setIsTracked(bool) override {} - virtual void endorse(bool) override {} - virtual void track(bool) override {} - virtual bool isEmpty() const override { return false; } - virtual QString name() const override { return m_Name; } - virtual QString internalName() const override { return m_InternalName; } - virtual QString comments() const override { return ""; } - virtual QString notes() const override { return ""; } - virtual QDateTime creationTime() const override; - virtual QString absolutePath() const override { return m_BaseDirectory; } - virtual MOBase::VersionInfo newestVersion() const override { return QString(); } - virtual MOBase::VersionInfo ignoredVersion() const override { return QString(); } - virtual QString installationFile() const override { return ""; } - virtual bool converted() const override { return false; } - virtual bool validated() const override { return false; } - virtual QString gameName() const override { return ""; } - virtual int nexusId() const override { return -1; } - virtual bool isForeign() const override { return true; } - virtual QDateTime getExpires() const override { return QDateTime(); } - virtual std::vector getIniTweaks() const override + bool updateAvailable() const override { return false; } + bool updateIgnored() const override { return false; } + bool downgradeAvailable() const override { return false; } + bool updateNXMInfo() override { return false; } + void setCategory(int, bool) override {} + bool setName(const QString&) override { return false; } + void setComments(const QString&) override {} + void setNotes(const QString&) override {} + void setGameName(const QString& gameName) override {} + void setNexusID(int) override {} + void setNewestVersion(const MOBase::VersionInfo&) override {} + void ignoreUpdate(bool) override {} + void setNexusDescription(const QString&) override {} + void setInstallationFile(const QString&) override {} + void addNexusCategory(int) override {} + void setIsEndorsed(bool) override {} + void setNeverEndorse() override {} + void setIsTracked(bool) override {} + void endorse(bool) override {} + void track(bool) override {} + bool isEmpty() const override { return false; } + QString name() const override { return m_Name; } + QString internalName() const override { return m_InternalName; } + QString comments() const override { return ""; } + QString notes() const override { return ""; } + QDateTime creationTime() const override; + QString absolutePath() const override { return m_BaseDirectory; } + MOBase::VersionInfo newestVersion() const override { return QString(); } + MOBase::VersionInfo ignoredVersion() const override { return QString(); } + QString installationFile() const override { return ""; } + bool converted() const override { return false; } + bool validated() const override { return false; } + QString gameName() const override { return ""; } + int nexusId() const override { return -1; } + bool isForeign() const override { return true; } + QDateTime getExpires() const override { return QDateTime(); } + std::vector getIniTweaks() const override { return std::vector(); } - virtual std::vector getFlags() const override; - virtual int getHighlight() const override; - virtual QString getDescription() const override; - virtual int getNexusFileStatus() const override { return 0; } - virtual void setNexusFileStatus(int) override {} - virtual QDateTime getLastNexusUpdate() const override { return QDateTime(); } - virtual void setLastNexusUpdate(QDateTime) override {} - virtual int getNexusCategory() const override { return 0; } - virtual void setNexusCategory(int) override {} - virtual QDateTime getLastNexusQuery() const override { return QDateTime(); } - virtual void setLastNexusQuery(QDateTime) override {} - virtual QDateTime getNexusLastModified() const override { return QDateTime(); } - virtual void setNexusLastModified(QDateTime) override {} - virtual QString getNexusDescription() const override { return QString(); } - virtual QString author() const override { return QString(); } - virtual void setAuthor(const QString&) override {} - virtual QString uploader() const override { return QString(); } - virtual void setUploader(const QString&) override {} - virtual QString uploaderUrl() const override { return QString(); } - virtual void setUploaderUrl(const QString&) override {} - virtual QStringList archives(bool = false) override { return m_Archives; } - virtual QStringList stealFiles() const override + std::vector getFlags() const override; + int getHighlight() const override; + QString getDescription() const override; + int getNexusFileStatus() const override { return 0; } + void setNexusFileStatus(int) override {} + QDateTime getLastNexusUpdate() const override { return QDateTime(); } + void setLastNexusUpdate(QDateTime) override {} + int getNexusCategory() const override { return 0; } + void setNexusCategory(int) override {} + QDateTime getLastNexusQuery() const override { return QDateTime(); } + void setLastNexusQuery(QDateTime) override {} + QDateTime getNexusLastModified() const override { return QDateTime(); } + void setNexusLastModified(QDateTime) override {} + QString getNexusDescription() const override { return QString(); } + QString author() const override { return QString(); } + void setAuthor(const QString&) override {} + QString uploader() const override { return QString(); } + void setUploader(const QString&) override {} + QString uploaderUrl() const override { return QString(); } + void setUploaderUrl(const QString&) override {} + QStringList archives(bool = false) override { return m_Archives; } + QStringList stealFiles() const override { return m_Archives + QStringList(m_ReferenceFile); } - virtual bool alwaysEnabled() const override { return true; } - virtual void addInstalledFile(int, int) override {} - virtual std::set> installedFiles() const override { return {}; } + bool alwaysEnabled() const override { return true; } + void addInstalledFile(int, int) override {} + std::set> installedFiles() const override { return {}; } - virtual QVariant pluginSetting(const QString& pluginName, const QString& key, + QVariant pluginSetting(const QString& pluginName, const QString& key, const QVariant& defaultValue) const override { return defaultValue; } - virtual std::map + std::map pluginSettings(const QString& pluginName) const override { return {}; } - virtual bool setPluginSetting(const QString& pluginName, const QString& key, + bool setPluginSetting(const QString& pluginName, const QString& key, const QVariant& value) override { return false; } - virtual std::map + std::map clearPluginSettings(const QString& pluginName) override { return {}; diff --git a/src/src/modinfooverwrite.h b/src/src/modinfooverwrite.h index 0d7660e..919f00d 100644 --- a/src/src/modinfooverwrite.h +++ b/src/src/modinfooverwrite.h @@ -15,87 +15,87 @@ class ModInfoOverwrite : public ModInfoWithConflictInfo friend class ModInfo; public: - virtual bool updateAvailable() const override { return false; } - virtual bool updateIgnored() const override { return false; } - virtual bool downgradeAvailable() const override { return false; } - virtual bool updateNXMInfo() override { return false; } - virtual void setCategory(int, bool) override {} - virtual bool setName(const QString&) override { return false; } - virtual void setComments(const QString&) override {} - virtual void setNotes(const QString&) override {} - virtual void setGameName(const QString& gameName) override {} - virtual void setNexusID(int) override {} - virtual void setNewestVersion(const MOBase::VersionInfo&) override {} - virtual void ignoreUpdate(bool) override {} - virtual void setNexusDescription(const QString&) override {} - virtual void setInstallationFile(const QString&) override {} - virtual void addNexusCategory(int) override {} - virtual void setIsEndorsed(bool) override {} - virtual void setNeverEndorse() override {} - virtual void setIsTracked(bool) override {} - virtual void endorse(bool) override {} - virtual void track(bool) override {} - virtual bool alwaysEnabled() const override { return true; } - virtual bool isEmpty() const override; - virtual QString name() const override { return "Overwrite"; } - virtual QString comments() const override { return ""; } - virtual QString notes() const override { return ""; } - virtual QDateTime creationTime() const override { return QDateTime(); } - virtual QString absolutePath() const override; - virtual MOBase::VersionInfo newestVersion() const override { return QString(); } - virtual MOBase::VersionInfo ignoredVersion() const override { return QString(); } - virtual QString installationFile() const override { return ""; } - virtual bool converted() const override { return false; } - virtual bool validated() const override { return false; } - virtual QString gameName() const override { return ""; } - virtual int nexusId() const override { return -1; } - virtual bool isOverwrite() const override { return true; } - virtual QDateTime getExpires() const override { return QDateTime(); } - virtual std::vector getIniTweaks() const override + bool updateAvailable() const override { return false; } + bool updateIgnored() const override { return false; } + bool downgradeAvailable() const override { return false; } + bool updateNXMInfo() override { return false; } + void setCategory(int, bool) override {} + bool setName(const QString&) override { return false; } + void setComments(const QString&) override {} + void setNotes(const QString&) override {} + void setGameName(const QString& gameName) override {} + void setNexusID(int) override {} + void setNewestVersion(const MOBase::VersionInfo&) override {} + void ignoreUpdate(bool) override {} + void setNexusDescription(const QString&) override {} + void setInstallationFile(const QString&) override {} + void addNexusCategory(int) override {} + void setIsEndorsed(bool) override {} + void setNeverEndorse() override {} + void setIsTracked(bool) override {} + void endorse(bool) override {} + void track(bool) override {} + bool alwaysEnabled() const override { return true; } + bool isEmpty() const override; + QString name() const override { return "Overwrite"; } + QString comments() const override { return ""; } + QString notes() const override { return ""; } + QDateTime creationTime() const override { return QDateTime(); } + QString absolutePath() const override; + MOBase::VersionInfo newestVersion() const override { return QString(); } + MOBase::VersionInfo ignoredVersion() const override { return QString(); } + QString installationFile() const override { return ""; } + bool converted() const override { return false; } + bool validated() const override { return false; } + QString gameName() const override { return ""; } + int nexusId() const override { return -1; } + bool isOverwrite() const override { return true; } + QDateTime getExpires() const override { return QDateTime(); } + std::vector getIniTweaks() const override { return std::vector(); } - virtual std::vector getFlags() const override; - virtual std::vector getConflictFlags() const override; - virtual int getHighlight() const override; - virtual QString getDescription() const override; - virtual int getNexusFileStatus() const override { return 0; } - virtual void setNexusFileStatus(int) override {} - virtual QDateTime getLastNexusUpdate() const override { return QDateTime(); } - virtual void setLastNexusUpdate(QDateTime) override {} - virtual QDateTime getLastNexusQuery() const override { return QDateTime(); } - virtual void setLastNexusQuery(QDateTime) override {} - virtual QDateTime getNexusLastModified() const override { return QDateTime(); } - virtual void setNexusLastModified(QDateTime) override {} - virtual QString getNexusDescription() const override { return QString(); } - virtual void setNexusCategory(int) override {} - virtual int getNexusCategory() const override { return 0; } - virtual QString author() const override { return QString(); } - virtual void setAuthor(const QString&) override {} - virtual QString uploader() const override { return QString(); } - virtual void setUploader(const QString&) override {} - virtual QString uploaderUrl() const override { return QString(); } - virtual void setUploaderUrl(const QString&) override {} - virtual QStringList archives(bool checkOnDisk = false) override; - virtual void addInstalledFile(int, int) override {} - virtual std::set> installedFiles() const override { return {}; } + std::vector getFlags() const override; + std::vector getConflictFlags() const override; + int getHighlight() const override; + QString getDescription() const override; + int getNexusFileStatus() const override { return 0; } + void setNexusFileStatus(int) override {} + QDateTime getLastNexusUpdate() const override { return QDateTime(); } + void setLastNexusUpdate(QDateTime) override {} + QDateTime getLastNexusQuery() const override { return QDateTime(); } + void setLastNexusQuery(QDateTime) override {} + QDateTime getNexusLastModified() const override { return QDateTime(); } + void setNexusLastModified(QDateTime) override {} + QString getNexusDescription() const override { return QString(); } + void setNexusCategory(int) override {} + int getNexusCategory() const override { return 0; } + QString author() const override { return QString(); } + void setAuthor(const QString&) override {} + QString uploader() const override { return QString(); } + void setUploader(const QString&) override {} + QString uploaderUrl() const override { return QString(); } + void setUploaderUrl(const QString&) override {} + QStringList archives(bool checkOnDisk = false) override; + void addInstalledFile(int, int) override {} + std::set> installedFiles() const override { return {}; } - virtual QVariant pluginSetting(const QString& pluginName, const QString& key, + QVariant pluginSetting(const QString& pluginName, const QString& key, const QVariant& defaultValue) const override { return defaultValue; } - virtual std::map + std::map pluginSettings(const QString& pluginName) const override { return {}; } - virtual bool setPluginSetting(const QString& pluginName, const QString& key, + bool setPluginSetting(const QString& pluginName, const QString& key, const QVariant& value) override { return false; } - virtual std::map + std::map clearPluginSettings(const QString& pluginName) override { return {}; diff --git a/src/src/modinforegular.cpp b/src/src/modinforegular.cpp index 4804ea0..49204f0 100644 --- a/src/src/modinforegular.cpp +++ b/src/src/modinforegular.cpp @@ -58,11 +58,8 @@ QString storeMetaPath(const QString& value) ModInfoRegular::ModInfoRegular(const QDir& path, OrganizerCore& core) : ModInfoWithConflictInfo(core), m_Name(path.dirName()), - m_Path(path.absolutePath()), m_Repository(), - m_GameName(core.managedGame()->gameShortName()), m_IsAlternate(false), - m_Converted(false), m_Validated(false), m_MetaInfoChanged(false), - m_EndorsedState(EndorsedState::ENDORSED_UNKNOWN), - m_TrackedState(TrackedState::TRACKED_UNKNOWN), + m_Path(path.absolutePath()), + m_GameName(core.managedGame()->gameShortName()), m_NexusBridge(&core.pluginContainer()) { m_CreationTime = QFileInfo(path.absolutePath()).birthTime(); @@ -487,7 +484,7 @@ void ModInfoRegular::setCategory(int categoryID, bool active) m_Categories.erase(iter); } if (categoryID == m_PrimaryCategory) { - if (m_Categories.size() == 0) { + if (m_Categories.empty()) { m_PrimaryCategory = -1; } else { m_PrimaryCategory = *(m_Categories.begin()); diff --git a/src/src/modinforegular.h b/src/src/modinforegular.h index f2df4fc..3f32781 100644 --- a/src/src/modinforegular.h +++ b/src/src/modinforegular.h @@ -21,11 +21,11 @@ class ModInfoRegular : public ModInfoWithConflictInfo friend class ModInfo; public: - ~ModInfoRegular(); + ~ModInfoRegular() override; - virtual bool isRegular() const override { return true; } + bool isRegular() const override { return true; } - virtual bool isEmpty() const override; + bool isEmpty() const override; bool isAlternate() { return m_IsAlternate; } bool isConverted() { return m_Converted; } @@ -46,7 +46,7 @@ public: /** * @return true if the current update is being ignored */ - virtual bool updateIgnored() const override + bool updateIgnored() const override { return m_IgnoredVersion.isValid() && m_IgnoredVersion == m_NewestVersion; } @@ -116,7 +116,7 @@ public: * * @param gameName the source game shortName */ - virtual void setGameName(const QString& gameName) override; + void setGameName(const QString& gameName) override; /** * @brief set/change the nexus mod id of this mod @@ -151,9 +151,9 @@ public: * @brief changes/updates the nexus description text * @param description the current description text */ - virtual void setNexusDescription(const QString& description) override; + void setNexusDescription(const QString& description) override; - virtual void setInstallationFile(const QString& fileName) override; + void setInstallationFile(const QString& fileName) override; /** * @brief sets the category id from a nexus category id. Conversion to MO id happens @@ -161,13 +161,13 @@ public: * @param categoryID the nexus category id * @note if a mapping is not possible, the category is set to the default value */ - virtual void addNexusCategory(int categoryID) override; + void addNexusCategory(int categoryID) override; /** * @brief sets the new primary category of the mod * @param categoryID the category to set */ - virtual void setPrimaryCategory(int categoryID) override + void setPrimaryCategory(int categoryID) override { m_PrimaryCategory = categoryID; m_MetaInfoChanged = true; @@ -177,7 +177,7 @@ public: * @brief sets the download repository * @param repository */ - virtual void setRepository(const QString& repository) override + void setRepository(const QString& repository) override { m_Repository = repository; } @@ -187,46 +187,46 @@ public: * buffered state, it does not sync with Nexus * @param endorsed the new endorsement state */ - virtual void setIsEndorsed(bool endorsed) override; + void setIsEndorsed(bool endorsed) override; /** * set the mod to "i don't intend to endorse". The mod will not show as unendorsed but * can still be endorsed */ - virtual void setNeverEndorse() override; + void setNeverEndorse() override; /** * update the tracked state for the mod. This only changes the * buffered state. It does not sync with Nexus * @param tracked the new tracked state */ - virtual void setIsTracked(bool tracked) override; + void setIsTracked(bool tracked) override; /** * @brief endorse or un-endorse the mod * @param doEndorse if true, the mod is endorsed, if false, it's un-endorsed. * @note if doEndorse doesn't differ from the current value, nothing happens. */ - virtual void endorse(bool doEndorse) override; + void endorse(bool doEndorse) override; /** * @brief track or untrack the mod. This will sync with nexus! * @param doTrack if true, the mod is tracked, if false, it's untracked. * @note if doTrack doesn't differ from the current value, nothing happens. */ - virtual void track(bool doTrack) override; + void track(bool doTrack) override; /** * @brief updates the mod to flag it as converted in order to ignore the alternate * game warning */ - virtual void markConverted(bool converted) override; + void markConverted(bool converted) override; /** * @brief updates the mod to flag it as valid in order to ignore the invalid game data * flag */ - virtual void markValidated(bool validated) override; + void markValidated(bool validated) override; /** * @brief getter for the mod name @@ -271,27 +271,27 @@ public: /** * @return true if the mod can be updated */ - virtual bool canBeUpdated() const override; + bool canBeUpdated() const override; /** * @return the update expiration date based on the last updated date from Nexus */ - virtual QDateTime getExpires() const override; + QDateTime getExpires() const override; /** * @return true if the mod can be enabled/disabled */ - virtual bool canBeEnabled() const override { return true; } + bool canBeEnabled() const override { return true; } /** * @return a list of flags for this mod */ - virtual std::vector getFlags() const override; + std::vector getFlags() const override; /** * @return an indicator if and how this mod should be highlighted by the UI */ - virtual int getHighlight() const override; + int getHighlight() const override; /** * @return list of names of ini tweaks @@ -301,33 +301,33 @@ public: /** * @return a description about the mod, to be displayed in the ui */ - virtual QString getDescription() const override; + QString getDescription() const override; /** * @return the nexus file status (aka category ID) */ - virtual int getNexusFileStatus() const override; + int getNexusFileStatus() const override; /** * @brief sets the file status (category ID) from Nexus * @param status the status id of the installed file */ - virtual void setNexusFileStatus(int status) override; + void setNexusFileStatus(int status) override; /** * @return comments for this mod */ - virtual QString comments() const override; + QString comments() const override; /** * @return manually set notes for this mod */ - virtual QString notes() const override; + QString notes() const override; /** * @return time this mod was created (file time of the directory) */ - virtual QDateTime creationTime() const override; + QDateTime creationTime() const override; /** * @return nexus description of the mod (html) @@ -337,125 +337,125 @@ public: /** * @return repository from which the file was downloaded */ - virtual QString repository() const override; + QString repository() const override; /** * @return true if the file has been endorsed on nexus */ - virtual MOBase::EndorsedState endorsedState() const override; + MOBase::EndorsedState endorsedState() const override; /** * @return true if the file is being tracked on nexus */ - virtual MOBase::TrackedState trackedState() const override; + MOBase::TrackedState trackedState() const override; /** * @brief get the last time nexus was checked for file updates on this mod */ - virtual QDateTime getLastNexusUpdate() const override; + QDateTime getLastNexusUpdate() const override; /** * @brief set the last time nexus was checked for file updates on this mod */ - virtual void setLastNexusUpdate(QDateTime time) override; + void setLastNexusUpdate(QDateTime time) override; /** * @return last time nexus was queried for infos on this mod */ - virtual QDateTime getLastNexusQuery() const override; + QDateTime getLastNexusQuery() const override; /** * @brief set the last time nexus was queried for info on this mod */ - virtual void setLastNexusQuery(QDateTime time) override; + void setLastNexusQuery(QDateTime time) override; /** * @return last time the mod was updated on Nexus */ - virtual QDateTime getNexusLastModified() const override; + QDateTime getNexusLastModified() const override; /** * @brief set the last time the mod was updated on Nexus */ - virtual void setNexusLastModified(QDateTime time) override; + void setNexusLastModified(QDateTime time) override; /** * @return the assigned nexus category ID */ - virtual int getNexusCategory() const override; + int getNexusCategory() const override; /** * @brief Assigns the given Nexus category ID */ - virtual void setNexusCategory(int category) override; + void setNexusCategory(int category) override; /** * @return the author of the mod. */ - virtual QString author() const override; + QString author() const override; /** * @brief Set the author of the mod. */ - virtual void setAuthor(const QString&) override; + void setAuthor(const QString&) override; /** * @return the name of the uploader of this mod. */ - virtual QString uploader() const override; + QString uploader() const override; /** * @brief Set the name of the uploader of this mod. */ - virtual void setUploader(const QString&) override; + void setUploader(const QString&) override; /** * @return the URL of the uploader of this mod's profile. */ - virtual QString uploaderUrl() const override; + QString uploaderUrl() const override; /** * @brief Set the URL of the uploader of this mod's profile. */ - virtual void setUploaderUrl(const QString&) override; + void setUploaderUrl(const QString&) override; - virtual QStringList archives(bool checkOnDisk = false) override; + QStringList archives(bool checkOnDisk = false) override; - virtual void setColor(QColor color) override; + void setColor(QColor color) override; - virtual QColor color() const override; + QColor color() const override; - virtual void addInstalledFile(int modId, int fileId) override; + void addInstalledFile(int modId, int fileId) override; /** * @brief stores meta information back to disk */ - virtual void saveMeta() override; + void saveMeta() override; void readMeta() override; - virtual void setHasCustomURL(bool b) override; - virtual bool hasCustomURL() const override; - virtual void setCustomURL(QString const&) override; - virtual QString url() const override; + void setHasCustomURL(bool b) override; + bool hasCustomURL() const override; + void setCustomURL(QString const&) override; + QString url() const override; - virtual QString gameName() const override { return m_GameName; } - virtual QString installationFile() const override { return m_InstallationFile; } - virtual bool converted() const override { return m_Converted; } - virtual bool validated() const override { return m_Validated; } - virtual std::set> installedFiles() const override + QString gameName() const override { return m_GameName; } + QString installationFile() const override { return m_InstallationFile; } + bool converted() const override { return m_Converted; } + bool validated() const override { return m_Validated; } + std::set> installedFiles() const override { return m_InstalledFileIDs; } public: // Plugin operations: - virtual QVariant pluginSetting(const QString& pluginName, const QString& key, + QVariant pluginSetting(const QString& pluginName, const QString& key, const QVariant& defaultValue) const override; - virtual std::map + std::map pluginSettings(const QString& pluginName) const override; - virtual bool setPluginSetting(const QString& pluginName, const QString& key, + bool setPluginSetting(const QString& pluginName, const QString& key, const QVariant& value) override; - virtual std::map + std::map clearPluginSettings(const QString& pluginName) override; private: @@ -472,7 +472,7 @@ private slots: int errorCode, const QString& errorMessage); protected: - virtual std::set doGetContents() const override; + std::set doGetContents() const override; ModInfoRegular(const QDir& path, OrganizerCore& core); @@ -510,16 +510,16 @@ private: // List of plugin settings: std::map> m_PluginSettings; - bool m_MetaInfoChanged; - bool m_IsAlternate; - bool m_Converted; - bool m_Validated; + bool m_MetaInfoChanged{false}; + bool m_IsAlternate{false}; + bool m_Converted{false}; + bool m_Validated{false}; int m_NexusFileStatus; MOBase::VersionInfo m_NewestVersion; MOBase::VersionInfo m_IgnoredVersion; - MOBase::EndorsedState m_EndorsedState; - MOBase::TrackedState m_TrackedState; + MOBase::EndorsedState m_EndorsedState{EndorsedState::ENDORSED_UNKNOWN}; + MOBase::TrackedState m_TrackedState{TrackedState::TRACKED_UNKNOWN}; NexusBridge m_NexusBridge; diff --git a/src/src/modinfoseparator.h b/src/src/modinfoseparator.h index 394869a..513f3e8 100644 --- a/src/src/modinfoseparator.h +++ b/src/src/modinfoseparator.h @@ -10,56 +10,56 @@ class ModInfoSeparator : public ModInfoRegular friend class ModInfo; public: - virtual bool updateAvailable() const override { return false; } - virtual bool updateIgnored() const override { return false; } - virtual bool downgradeAvailable() const override { return false; } - virtual bool updateNXMInfo() override { return false; } - virtual bool isValid() const override { return true; } + bool updateAvailable() const override { return false; } + bool updateIgnored() const override { return false; } + bool downgradeAvailable() const override { return false; } + bool updateNXMInfo() override { return false; } + bool isValid() const override { return true; } // TODO: Fix renaming method to avoid priority reset - virtual bool setName(const QString& name); + bool setName(const QString& name) override; - virtual int nexusId() const override { return -1; } - virtual void setGameName(const QString& gameName) override {} - virtual void setNexusID(int /*modID*/) override {} - virtual void endorse(bool /*doEndorse*/) override {} - virtual void ignoreUpdate(bool /*ignore*/) override {} - virtual bool canBeUpdated() const override { return false; } - virtual QDateTime getExpires() const override { return QDateTime(); } - virtual bool canBeEnabled() const override { return false; } - virtual std::vector getIniTweaks() const override + int nexusId() const override { return -1; } + void setGameName(const QString& gameName) override {} + void setNexusID(int /*modID*/) override {} + void endorse(bool /*doEndorse*/) override {} + void ignoreUpdate(bool /*ignore*/) override {} + bool canBeUpdated() const override { return false; } + QDateTime getExpires() const override { return QDateTime(); } + bool canBeEnabled() const override { return false; } + std::vector getIniTweaks() const override { return std::vector(); } - virtual std::vector getFlags() const override; - virtual int getHighlight() const override; - virtual QString getDescription() const override; - virtual QString name() const override; - virtual QString gameName() const override { return ""; } - virtual QString installationFile() const override { return ""; } - virtual QString repository() const override { return ""; } - virtual int getNexusFileStatus() const override { return 0; } - virtual void setNexusFileStatus(int) override {} - virtual QDateTime getLastNexusUpdate() const override { return QDateTime(); } - virtual void setLastNexusUpdate(QDateTime) override {} - virtual QDateTime getLastNexusQuery() const override { return QDateTime(); } - virtual void setLastNexusQuery(QDateTime) override {} - virtual QDateTime getNexusLastModified() const override { return QDateTime(); } - virtual void setNexusLastModified(QDateTime) override {} - virtual int getNexusCategory() const override { return 0; } - virtual void setNexusCategory(int) override {} - virtual QDateTime creationTime() const override { return QDateTime(); } - virtual QString getNexusDescription() const override { return QString(); } - virtual QString author() const override { return QString(); } - virtual void setAuthor(const QString&) override {} - virtual QString uploader() const override { return QString(); } - virtual void setUploader(const QString&) override {} - virtual QString uploaderUrl() const override { return QString(); } - virtual void setUploaderUrl(const QString&) override {} - virtual void addInstalledFile(int /*modId*/, int /*fileId*/) override {} - virtual bool isSeparator() const override { return true; } + std::vector getFlags() const override; + int getHighlight() const override; + QString getDescription() const override; + QString name() const override; + QString gameName() const override { return ""; } + QString installationFile() const override { return ""; } + QString repository() const override { return ""; } + int getNexusFileStatus() const override { return 0; } + void setNexusFileStatus(int) override {} + QDateTime getLastNexusUpdate() const override { return QDateTime(); } + void setLastNexusUpdate(QDateTime) override {} + QDateTime getLastNexusQuery() const override { return QDateTime(); } + void setLastNexusQuery(QDateTime) override {} + QDateTime getNexusLastModified() const override { return QDateTime(); } + void setNexusLastModified(QDateTime) override {} + int getNexusCategory() const override { return 0; } + void setNexusCategory(int) override {} + QDateTime creationTime() const override { return QDateTime(); } + QString getNexusDescription() const override { return QString(); } + QString author() const override { return QString(); } + void setAuthor(const QString&) override {} + QString uploader() const override { return QString(); } + void setUploader(const QString&) override {} + QString uploaderUrl() const override { return QString(); } + void setUploaderUrl(const QString&) override {} + void addInstalledFile(int /*modId*/, int /*fileId*/) override {} + bool isSeparator() const override { return true; } protected: - virtual bool doIsValid() const override { return true; } + bool doIsValid() const override { return true; } private: ModInfoSeparator(const QDir& path, OrganizerCore& core); diff --git a/src/src/modinfowithconflictinfo.cpp b/src/src/modinfowithconflictinfo.cpp index 9ac5fbc..cfe0c03 100644 --- a/src/src/modinfowithconflictinfo.cpp +++ b/src/src/modinfowithconflictinfo.cpp @@ -155,7 +155,7 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co hasVisibleFiles = true; auto alternatives = file->getAlternatives(); - if ((alternatives.size() == 0) || + if ((alternatives.empty()) || std::find(dataIDs.begin(), dataIDs.end(), alternatives.back().originID()) != dataIDs.end()) { // no alternatives -> no conflict @@ -226,7 +226,7 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co } } - if (files.size() != 0) { + if (!files.empty()) { if (hasVisibleFiles && !providesAnything) conflicts.m_CurrentConflictState = CONFLICT_REDUNDANT; else if (!conflicts.m_OverwriteList.empty() && diff --git a/src/src/modinfowithconflictinfo.h b/src/src/modinfowithconflictinfo.h index 168432e..2fd1129 100644 --- a/src/src/modinfowithconflictinfo.h +++ b/src/src/modinfowithconflictinfo.h @@ -14,18 +14,18 @@ class ModInfoWithConflictInfo : public ModInfo public: std::vector getConflictFlags() const override; - virtual std::vector getFlags() const override; + std::vector getFlags() const override; /** * @return true if this mod is considered "valid", that is: it contains data used by *the game **/ - virtual bool isValid() const override; + bool isValid() const override; /** * @return a list of content types contained in a mod */ - virtual const std::set& getContents() const override; + const std::set& getContents() const override; /** * @brief Test if the mod contains the specified content. @@ -34,7 +34,7 @@ public: * * @return true if the content is there, false otherwise. */ - virtual bool hasContent(int content) const override; + bool hasContent(int content) const override; /** * @brief Retrieve a file tree corresponding to the underlying disk content @@ -83,7 +83,7 @@ public slots: /** * @brief Notify this mod that the content of the disk may have changed. */ - virtual void diskContentModified(); + void diskContentModified() override; protected: // check if the content of this mod is valid @@ -141,7 +141,7 @@ protected: * or getContents(). This method will only be called when first creating the mod * using multiple threads for all the mods. */ - virtual void prefetch() override; + void prefetch() override; private: struct Conflicts diff --git a/src/src/modlist.h b/src/src/modlist.h index e28a182..f1d0e30 100644 --- a/src/src/modlist.h +++ b/src/src/modlist.h @@ -110,7 +110,7 @@ public: **/ ModList(PluginContainer* pluginContainer, OrganizerCore* parent); - ~ModList(); + ~ModList() override; /** * @brief set the profile used for status information @@ -215,16 +215,16 @@ public: onModMoved(const std::function& func); public: // implementation of virtual functions of QAbstractItemModel - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex& index, const QVariant& value, - int role = Qt::EditRole); - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - virtual Qt::ItemFlags flags(const QModelIndex& modelIndex) const; - virtual bool removeRows(int row, int count, const QModelIndex& parent); + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + bool hasChildren(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex& index, const QVariant& value, + int role = Qt::EditRole) override; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + Qt::ItemFlags flags(const QModelIndex& modelIndex) const override; + bool removeRows(int row, int count, const QModelIndex& parent) override; Qt::DropActions supportedDropActions() const override { @@ -237,11 +237,11 @@ public: // implementation of virtual functions of QAbstractItemModel bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; - virtual QModelIndex index(int row, int column, - const QModelIndex& parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex& child) const; + QModelIndex index(int row, int column, + const QModelIndex& parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex& child) const override; - virtual QMap itemData(const QModelIndex& index) const; + QMap itemData(const QModelIndex& index) const override; public slots: @@ -378,14 +378,14 @@ private: struct TModInfo { TModInfo(unsigned int index, ModInfo::Ptr modInfo) - : modInfo(modInfo), nameOrder(index), priorityOrder(0), modIDOrder(0), - categoryOrder(0) + : modInfo(modInfo), nameOrder(index) + {} ModInfo::Ptr modInfo; unsigned int nameOrder; - unsigned int priorityOrder; - unsigned int modIDOrder; - unsigned int categoryOrder; + unsigned int priorityOrder{0}; + unsigned int modIDOrder{0}; + unsigned int categoryOrder{0}; }; struct TModInfoChange diff --git a/src/src/modlistbypriorityproxy.cpp b/src/src/modlistbypriorityproxy.cpp index 559378b..9bbbf09 100644 --- a/src/src/modlistbypriorityproxy.cpp +++ b/src/src/modlistbypriorityproxy.cpp @@ -222,10 +222,10 @@ QModelIndex ModListByPriorityProxy::parent(const QModelIndex& child) const bool ModListByPriorityProxy::hasChildren(const QModelIndex& parent) const { if (!parent.isValid()) { - return m_Root.children.size() > 0; + return !m_Root.children.empty(); } auto* item = static_cast(parent.internalPointer()); - return item->children.size() > 0; + return !item->children.empty(); } bool ModListByPriorityProxy::canDropMimeData(const QMimeData* data, diff --git a/src/src/modlistbypriorityproxy.h b/src/src/modlistbypriorityproxy.h index e861ba9..ba391b5 100644 --- a/src/src/modlistbypriorityproxy.h +++ b/src/src/modlistbypriorityproxy.h @@ -26,7 +26,7 @@ class ModListByPriorityProxy : public QAbstractProxyModel public: explicit ModListByPriorityProxy(Profile* profile, OrganizerCore& core, QObject* parent = nullptr); - ~ModListByPriorityProxy(); + ~ModListByPriorityProxy() override; void setProfile(Profile* profile); diff --git a/src/src/modlistcontextmenu.cpp b/src/src/modlistcontextmenu.cpp index 7c78b1f..aab6bd3 100644 --- a/src/src/modlistcontextmenu.cpp +++ b/src/src/modlistcontextmenu.cpp @@ -152,7 +152,7 @@ bool ModListChangeCategoryMenu::populate(QMenu* menu, CategoryFactory* factory, int id = factory->getCategoryID(i); auto checkBox = std::make_unique(targetMenu); - bool enabled = categories.find(id) != categories.end(); + bool enabled = categories.contains(id); checkBox->setText(factory->getCategoryName(i).replace('&', "&&")); if (enabled) { childEnabled = true; diff --git a/src/src/modlistdropinfo.cpp b/src/src/modlistdropinfo.cpp index dff9bb7..0941c00 100644 --- a/src/src/modlistdropinfo.cpp +++ b/src/src/modlistdropinfo.cpp @@ -3,7 +3,7 @@ #include "organizercore.h" ModListDropInfo::ModListDropInfo(const QMimeData* mimeData, OrganizerCore& core) - : m_rows{}, m_download{-1}, m_localUrls{}, m_url{} + { // this only check if the drop is valid, not if the content of the drop // matches the target, a drop is valid if either diff --git a/src/src/modlistdropinfo.h b/src/src/modlistdropinfo.h index 279d29a..d614f53 100644 --- a/src/src/modlistdropinfo.h +++ b/src/src/modlistdropinfo.h @@ -77,7 +77,7 @@ private: private: // rows for drag&drop between views std::vector m_rows; - int m_download; // -1 if invalid + int m_download{-1}; // -1 if invalid // local URLs from the data (relative path + origin name) std::vector m_localUrls; diff --git a/src/src/modlistsortproxy.h b/src/src/modlistsortproxy.h index b15606d..1f0238f 100644 --- a/src/src/modlistsortproxy.h +++ b/src/src/modlistsortproxy.h @@ -76,7 +76,7 @@ public: bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; - virtual void setSourceModel(QAbstractItemModel* sourceModel) override; + void setSourceModel(QAbstractItemModel* sourceModel) override; /** * @brief tests if a filtere matches for a mod @@ -102,7 +102,7 @@ public: * @param parent the node to test * @return true if there are child nodes */ - virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const + bool hasChildren(const QModelIndex& parent = QModelIndex()) const override { return rowCount(parent) > 0; } @@ -124,8 +124,8 @@ signals: void filterInvalidated(); protected: - virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const; - virtual bool filterAcceptsRow(int row, const QModelIndex& parent) const; + bool lessThan(const QModelIndex& left, const QModelIndex& right) const override; + bool filterAcceptsRow(int row, const QModelIndex& parent) const override; private: void refreshFilter(); diff --git a/src/src/modlistview.h b/src/src/modlistview.h index 597af4d..fd1508f 100644 --- a/src/src/modlistview.h +++ b/src/src/modlistview.h @@ -52,7 +52,7 @@ public: }; public: - explicit ModListView(QWidget* parent = 0); + explicit ModListView(QWidget* parent = nullptr); void setup(OrganizerCore& core, CategoryFactory& factory, MainWindow* mw, Ui::MainWindow* mwui); @@ -156,7 +156,7 @@ protected: // re-implemented to fake the return value to allow drag-and-drop on // itself for separators // - QModelIndexList selectedIndexes() const; + QModelIndexList selectedIndexes() const override; // drop from external folder // diff --git a/src/src/motddialog.h b/src/src/motddialog.h index 9f96470..6d3837f 100644 --- a/src/src/motddialog.h +++ b/src/src/motddialog.h @@ -33,8 +33,8 @@ class MotDDialog : public QDialog Q_OBJECT public: - explicit MotDDialog(const QString& message, QWidget* parent = 0); - ~MotDDialog(); + explicit MotDDialog(const QString& message, QWidget* parent = nullptr); + ~MotDDialog() override; private slots: void on_okButton_clicked(); diff --git a/src/src/multiprocess.h b/src/src/multiprocess.h index 38261c4..9c0d2d7 100644 --- a/src/src/multiprocess.h +++ b/src/src/multiprocess.h @@ -17,7 +17,7 @@ class MOMultiProcess : public QObject public: // `allowMultiple`: if another process is running, run this one // disconnected from the shared memory - explicit MOMultiProcess(bool allowMultiple, QObject* parent = 0); + explicit MOMultiProcess(bool allowMultiple, QObject* parent = nullptr); /** * @return true if this process's job is to forward data to the primary diff --git a/src/src/nexusinterface.h b/src/src/nexusinterface.h index cf11804..8823b28 100644 --- a/src/src/nexusinterface.h +++ b/src/src/nexusinterface.h @@ -67,7 +67,7 @@ public: * @param userData user data to be returned with the result * @param url the url to request from **/ - virtual void requestDescription(QString gameName, int modID, QVariant userData); + void requestDescription(QString gameName, int modID, QVariant userData) override; /** * @brief request a list of the files belonging to a mod @@ -75,7 +75,7 @@ public: * @param modID id of the mod caller is interested in * @param userData user data to be returned with the result **/ - virtual void requestFiles(QString gameName, int modID, QVariant userData); + void requestFiles(QString gameName, int modID, QVariant userData) override; /** * @brief request info about a single file of a mod @@ -84,8 +84,8 @@ public: * @param fileID id of the file the caller is interested in * @param userData user data to be returned with the result **/ - virtual void requestFileInfo(QString gameName, int modID, int fileID, - QVariant userData); + void requestFileInfo(QString gameName, int modID, int fileID, + QVariant userData) override; /** * @brief request the download url of a file @@ -94,16 +94,16 @@ public: * @param fileID id of the file the caller is interested in * @param userData user data to be returned with the result **/ - virtual void requestDownloadURL(QString gameName, int modID, int fileID, - QVariant userData); + void requestDownloadURL(QString gameName, int modID, int fileID, + QVariant userData) override; /** * @brief requestToggleEndorsement * @param modID id of the mod caller is interested in * @param userData user data to be returned with the result */ - virtual void requestToggleEndorsement(QString gameName, int modID, QString modVersion, - bool endorse, QVariant userData); + void requestToggleEndorsement(QString gameName, int modID, QString modVersion, + bool endorse, QVariant userData) override; /** * @brief requestToggleTracking @@ -189,7 +189,7 @@ public: static APILimits parseLimits(const QList& headers); NexusInterface(Settings* s); - ~NexusInterface(); + ~NexusInterface() override; static NexusInterface& instance(); diff --git a/src/src/nxmaccessmanager.h b/src/src/nxmaccessmanager.h index 2a511dc..ecc2de8 100644 --- a/src/src/nxmaccessmanager.h +++ b/src/src/nxmaccessmanager.h @@ -252,9 +252,9 @@ signals: void credentialsReceived(const APIUserAccount& user); protected: - virtual QNetworkReply* createRequest(QNetworkAccessManager::Operation operation, + QNetworkReply* createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest& request, - QIODevice* device); + QIODevice* device) override; private: enum States diff --git a/src/src/organizercore.h b/src/src/organizercore.h index e2c9127..ca73ba9 100644 --- a/src/src/organizercore.h +++ b/src/src/organizercore.h @@ -147,7 +147,7 @@ public: { for (const auto& content : m_Contents) { if ((includeFilter || !content.isOnlyForFilter()) && - ids.find(content.id()) != ids.end()) { + ids.contains(content.id())) { fn(content); } } @@ -170,7 +170,7 @@ public: { for (const auto& content : m_Contents) { if ((includeFilter || !content.isOnlyForFilter())) { - if (ids.find(content.id()) != ids.end()) { + if (ids.contains(content.id())) { fnIn(content); } else { fnOut(content); @@ -246,7 +246,7 @@ public: public: OrganizerCore(Settings& settings); - ~OrganizerCore(); + ~OrganizerCore() override; void setUserInterface(IUserInterface* ui); void connectPlugins(PluginContainer* container); @@ -440,11 +440,11 @@ public: RefreshCallbackMode mode); public: // IPluginDiagnose interface - virtual std::vector activeProblems() const; - virtual QString shortDescription(unsigned int key) const; - virtual QString fullDescription(unsigned int key) const; - virtual bool hasGuidedFix(unsigned int key) const; - virtual void startGuidedFix(unsigned int key) const; + std::vector activeProblems() const override; + QString shortDescription(unsigned int key) const override; + QString fullDescription(unsigned int key) const override; + bool hasGuidedFix(unsigned int key) const override; + void startGuidedFix(unsigned int key) const override; public slots: diff --git a/src/src/organizerproxy.h b/src/src/organizerproxy.h index ce52d39..1c2c81c 100644 --- a/src/src/organizerproxy.h +++ b/src/src/organizerproxy.h @@ -21,7 +21,7 @@ class OrganizerProxy : public MOBase::IOrganizer public: OrganizerProxy(OrganizerCore* organizer, PluginContainer* pluginContainer, MOBase::IPlugin* plugin); - ~OrganizerProxy(); + ~OrganizerProxy() override; public: /** @@ -49,7 +49,7 @@ public: // IOrganizer interface const QVariant& value, bool sync = true) override; QString pluginDataPath() const override; MOBase::IModInterface* installMod(const QString& fileName, - const QString& nameSuggestion = QString()); + const QString& nameSuggestion = QString()) override; QString resolvePath(const QString& fileName) const override; QStringList listDirectories(const QString& directoryName) const override; QStringList @@ -104,25 +104,25 @@ public: // IOrganizer interface std::function const& func) override; // Plugin related: - virtual bool isPluginEnabled(QString const& pluginName) const override; - virtual bool isPluginEnabled(MOBase::IPlugin* plugin) const override; - virtual QVariant pluginSetting(const QString& pluginName, + bool isPluginEnabled(QString const& pluginName) const override; + bool isPluginEnabled(MOBase::IPlugin* plugin) const override; + QVariant pluginSetting(const QString& pluginName, const QString& key) const override; - virtual void setPluginSetting(const QString& pluginName, const QString& key, + void setPluginSetting(const QString& pluginName, const QString& key, const QVariant& value) override; - virtual bool onPluginSettingChanged( + bool onPluginSettingChanged( std::function const& func) override; - virtual bool + bool onPluginEnabled(std::function const& func) override; - virtual bool onPluginEnabled(const QString& pluginName, + bool onPluginEnabled(const QString& pluginName, std::function const& func) override; - virtual bool + bool onPluginDisabled(std::function const& func) override; - virtual bool onPluginDisabled(const QString& pluginName, + bool onPluginDisabled(const QString& pluginName, std::function const& func) override; - virtual MOBase::IPluginGame const* managedGame() const; + MOBase::IPluginGame const* managedGame() const override; protected: // The container needs access to some callbacks to simulate startup. diff --git a/src/src/overwriteinfodialog.h b/src/src/overwriteinfodialog.h index e609802..ac54fa1 100644 --- a/src/src/overwriteinfodialog.h +++ b/src/src/overwriteinfodialog.h @@ -37,16 +37,16 @@ class OverwriteFileSystemModel : public QFileSystemModel public: OverwriteFileSystemModel(QObject* parent, OrganizerCore& organizer) - : QFileSystemModel(parent), m_Organizer(organizer), m_RegularColumnCount(0) + : QFileSystemModel(parent), m_Organizer(organizer) {} - virtual int columnCount(const QModelIndex& parent) const + int columnCount(const QModelIndex& parent) const override { m_RegularColumnCount = QFileSystemModel::columnCount(parent); return m_RegularColumnCount; } - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const + QVariant headerData(int section, Qt::Orientation orientation, int role) const override { if ((orientation == Qt::Horizontal) && (section >= m_RegularColumnCount)) { if (role == Qt::DisplayRole) { @@ -59,7 +59,7 @@ public: } } - virtual QVariant data(const QModelIndex& index, int role) const + QVariant data(const QModelIndex& index, int role) const override { if (index.column() == m_RegularColumnCount + 0) { if (role == Qt::DisplayRole) { @@ -72,8 +72,8 @@ public: } } - virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, - int column, const QModelIndex& parent) + bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, + int column, const QModelIndex& parent) override { ModListDropInfo dropInfo(data, m_Organizer); if (dropInfo.isLocalFileDrop()) { @@ -90,7 +90,7 @@ public: } private: - mutable int m_RegularColumnCount; + mutable int m_RegularColumnCount{0}; OrganizerCore& m_Organizer; }; @@ -101,8 +101,8 @@ class OverwriteInfoDialog : public QDialog public: explicit OverwriteInfoDialog(ModInfo::Ptr modInfo, OrganizerCore& organizer, - QWidget* parent = 0); - ~OverwriteInfoDialog(); + QWidget* parent = nullptr); + ~OverwriteInfoDialog() override; ModInfo::Ptr modInfo() const { return m_ModInfo; } diff --git a/src/src/plugincontainer.h b/src/src/plugincontainer.h index a11990a..c8c11a5 100644 --- a/src/src/plugincontainer.h +++ b/src/src/plugincontainer.h @@ -183,7 +183,7 @@ public: public: PluginContainer(OrganizerCore* organizer); - virtual ~PluginContainer(); + ~PluginContainer() override; /** * @brief Start the plugins. @@ -360,11 +360,11 @@ public: QStringList mergedProxyList(MOBase::IPluginProxy* proxy) const; public: // IPluginDiagnose interface - virtual std::vector activeProblems() const; - virtual QString shortDescription(unsigned int key) const; - virtual QString fullDescription(unsigned int key) const; - virtual bool hasGuidedFix(unsigned int key) const; - virtual void startGuidedFix(unsigned int key) const; + std::vector activeProblems() const override; + QString shortDescription(unsigned int key) const override; + QString fullDescription(unsigned int key) const override; + bool hasGuidedFix(unsigned int key) const override; + void startGuidedFix(unsigned int key) const override; signals: diff --git a/src/src/pluginlist.h b/src/src/pluginlist.h index 56745ff..0f4747c 100644 --- a/src/src/pluginlist.h +++ b/src/src/pluginlist.h @@ -117,7 +117,7 @@ public: **/ PluginList(OrganizerCore& organizer); - ~PluginList(); + ~PluginList() override; /** * @brief does a complete refresh of the list @@ -259,20 +259,20 @@ public: const std::function&)>& func); public: // implementation of the QAbstractTableModel interface - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex& index, const QVariant& value, - int role = Qt::EditRole); - virtual QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; - virtual Qt::ItemFlags flags(const QModelIndex& index) const; - virtual Qt::DropActions supportedDropActions() const { return Qt::MoveAction; } - virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, - int column, const QModelIndex& parent); - virtual QModelIndex index(int row, int column, - const QModelIndex& parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex& child) const; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex& index, const QVariant& value, + int role = Qt::EditRole) override; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + Qt::ItemFlags flags(const QModelIndex& index) const override; + Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; } + bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, + int column, const QModelIndex& parent) override; + QModelIndex index(int row, int column, + const QModelIndex& parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex& child) const override; public slots: diff --git a/src/src/previewdialog.h b/src/src/previewdialog.h index 1faf9df..9eacadf 100644 --- a/src/src/previewdialog.h +++ b/src/src/previewdialog.h @@ -13,8 +13,8 @@ class PreviewDialog : public QDialog Q_OBJECT public: - explicit PreviewDialog(const QString& fileName, QWidget* parent = 0); - ~PreviewDialog(); + explicit PreviewDialog(const QString& fileName, QWidget* parent = nullptr); + ~PreviewDialog() override; // also saves and restores geometry // diff --git a/src/src/problemsdialog.h b/src/src/problemsdialog.h index 89a8ee5..1f2fe09 100644 --- a/src/src/problemsdialog.h +++ b/src/src/problemsdialog.h @@ -17,8 +17,8 @@ class ProblemsDialog : public QDialog Q_OBJECT public: - explicit ProblemsDialog(PluginContainer const& pluginContainer, QWidget* parent = 0); - ~ProblemsDialog(); + explicit ProblemsDialog(PluginContainer const& pluginContainer, QWidget* parent = nullptr); + ~ProblemsDialog() override; // also saves and restores geometry // diff --git a/src/src/profile.h b/src/src/profile.h index 599ae58..0537c0f 100644 --- a/src/src/profile.h +++ b/src/src/profile.h @@ -87,7 +87,7 @@ public: Profile(const Profile& reference); - ~Profile(); + ~Profile() override; /** * Determines the default settings for the profile based on the current state of the @@ -126,7 +126,7 @@ public: * @note currently, invalidation is not supported if the relevant entry in the ini *file does not exist **/ - bool invalidationActive(bool* supported) const; + bool invalidationActive(bool* supported) const override; /** * @brief deactivate archive invalidation if it was active @@ -141,7 +141,7 @@ public: /** * @return true if this profile uses local save games */ - virtual bool localSavesEnabled() const override; + bool localSavesEnabled() const override; /** * @brief enables or disables the use of local save games for this profile @@ -154,7 +154,7 @@ public: /** * @return true if this profile uses local ini files */ - virtual bool localSettingsEnabled() const override; + bool localSettingsEnabled() const override; /** * @brief enables or disables the use of local ini files for this profile @@ -166,7 +166,7 @@ public: /** * @return name of the profile (this is identical to its directory name) **/ - virtual QString name() const override { return m_Directory.dirName(); } + QString name() const override { return m_Directory.dirName(); } /** * @return the path of the plugins file in this profile @@ -220,7 +220,7 @@ public: /** * @return path to this profile **/ - virtual QString absolutePath() const override; + QString absolutePath() const override; /** * @return path to this profile's save games @@ -376,11 +376,11 @@ private: friend class Profile; public: - ModStatus() : m_Enabled(false), m_Priority(-1) {} + ModStatus() {} private: - bool m_Enabled; - int m_Priority; + bool m_Enabled{false}; + int m_Priority{-1}; }; private: diff --git a/src/src/profilesdialog.h b/src/src/profilesdialog.h index a6cf081..c9cbc4c 100644 --- a/src/src/profilesdialog.h +++ b/src/src/profilesdialog.h @@ -58,8 +58,8 @@ public: * @param parent parent widget **/ explicit ProfilesDialog(const QString& profileName, OrganizerCore& organizer, - QWidget* parent = 0); - ~ProfilesDialog(); + QWidget* parent = nullptr); + ~ProfilesDialog() override; // also saves and restores geometry // @@ -94,7 +94,7 @@ signals: void profileRemoved(QString const& profileName); protected: - virtual void showEvent(QShowEvent* event); + void showEvent(QShowEvent* event) override; private slots: void on_localIniFilesBox_stateChanged(int state); diff --git a/src/src/qdirfiletree.h b/src/src/qdirfiletree.h index d97a1bf..d956b7a 100644 --- a/src/src/qdirfiletree.h +++ b/src/src/qdirfiletree.h @@ -52,9 +52,9 @@ public: protected: using IFileTree::IFileTree; - virtual bool + bool doPopulate(std::shared_ptr parent, - std::vector>& entries) const = 0; + std::vector>& entries) const override = 0; }; #endif diff --git a/src/src/qtgroupingproxy.h b/src/src/qtgroupingproxy.h index 1ada689..11868e8 100644 --- a/src/src/qtgroupingproxy.h +++ b/src/src/qtgroupingproxy.h @@ -50,30 +50,30 @@ public: explicit QtGroupingProxy(QModelIndex rootNode = QModelIndex(), int groupedColumn = -1, int groupedRole = Qt::DisplayRole, unsigned int flags = 0, int aggregateRole = Qt::DisplayRole); - ~QtGroupingProxy(); + ~QtGroupingProxy() override; void setSourceModel(QAbstractItemModel* model) override; void setGroupedColumn(int groupedColumn); /* QAbstractProxyModel methods */ - virtual QModelIndex index(int, int c = 0, - const QModelIndex& parent = QModelIndex()) const; - virtual Qt::ItemFlags flags(const QModelIndex& idx) const; - virtual QModelIndex parent(const QModelIndex& idx) const; - virtual int rowCount(const QModelIndex& idx = QModelIndex()) const; - virtual int columnCount(const QModelIndex& idx) const; - virtual QModelIndex mapToSource(const QModelIndex& idx) const; + QModelIndex index(int, int c = 0, + const QModelIndex& parent = QModelIndex()) const override; + Qt::ItemFlags flags(const QModelIndex& idx) const override; + QModelIndex parent(const QModelIndex& idx) const override; + int rowCount(const QModelIndex& idx = QModelIndex()) const override; + int columnCount(const QModelIndex& idx) const override; + QModelIndex mapToSource(const QModelIndex& idx) const override; virtual QModelIndexList mapToSource(const QModelIndexList& list) const; - virtual QModelIndex mapFromSource(const QModelIndex& idx) const; - virtual QVariant data(const QModelIndex& idx, int role) const; - virtual bool setData(const QModelIndex& index, const QVariant& value, - int role = Qt::EditRole); - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; - virtual bool canFetchMore(const QModelIndex& parent) const; - virtual void fetchMore(const QModelIndex& parent); - virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const; - virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, - int column, const QModelIndex& parent); + QModelIndex mapFromSource(const QModelIndex& idx) const override; + QVariant data(const QModelIndex& idx, int role) const override; + bool setData(const QModelIndex& index, const QVariant& value, + int role = Qt::EditRole) override; + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + bool canFetchMore(const QModelIndex& parent) const override; + void fetchMore(const QModelIndex& parent) override; + bool hasChildren(const QModelIndex& parent = QModelIndex()) const override; + bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, + int column, const QModelIndex& parent) override; /* QtGroupingProxy methods */ virtual QModelIndex addEmptyGroup(const RowData& data); diff --git a/src/src/queryoverwritedialog.h b/src/src/queryoverwritedialog.h index 6a88a5b..eab5c9b 100644 --- a/src/src/queryoverwritedialog.h +++ b/src/src/queryoverwritedialog.h @@ -47,7 +47,7 @@ public: public: QueryOverwriteDialog(QWidget* parent, Backup b); - ~QueryOverwriteDialog(); + ~QueryOverwriteDialog() override; bool backup() const; Action action() const { return m_Action; } private slots: diff --git a/src/src/selectiondialog.h b/src/src/selectiondialog.h index 31e35e6..5318bbd 100644 --- a/src/src/selectiondialog.h +++ b/src/src/selectiondialog.h @@ -33,10 +33,10 @@ class SelectionDialog : public QDialog Q_OBJECT public: - explicit SelectionDialog(const QString& description, QWidget* parent = 0, + explicit SelectionDialog(const QString& description, QWidget* parent = nullptr, const QSize& iconSize = QSize()); - ~SelectionDialog(); + ~SelectionDialog() override; /** * @brief add a choice to the dialog diff --git a/src/src/selfupdater.h b/src/src/selfupdater.h index cad48b8..cd7b3ea 100644 --- a/src/src/selfupdater.h +++ b/src/src/selfupdater.h @@ -79,7 +79,7 @@ public: **/ explicit SelfUpdater(NexusInterface* nexusInterface); - virtual ~SelfUpdater(); + ~SelfUpdater() override; void setUserInterface(QWidget* widget); diff --git a/src/src/settings.h b/src/src/settings.h index c1a1eb8..d6bb5f5 100644 --- a/src/src/settings.h +++ b/src/src/settings.h @@ -747,7 +747,7 @@ public: // singleton and asserts if it already exists // Settings(const QString& path, bool globalInstance = false); - ~Settings(); + ~Settings() override; // throws if there is no global Settings instance // diff --git a/src/src/settingsdialog.h b/src/src/settingsdialog.h index 3a2cba2..230939b 100644 --- a/src/src/settingsdialog.h +++ b/src/src/settingsdialog.h @@ -64,9 +64,9 @@ class SettingsDialog : public MOBase::TutorableDialog public: explicit SettingsDialog(PluginContainer* pluginContainer, Settings& settings, - QWidget* parent = 0); + QWidget* parent = nullptr); - ~SettingsDialog(); + ~SettingsDialog() override; /** * @brief get stylesheet of settings buttons with colored background @@ -83,7 +83,7 @@ public: int exec() override; public slots: - virtual void accept(); + void accept() override; private: Ui::SettingsDialog* ui; diff --git a/src/src/settingsdialognexus.h b/src/src/settingsdialognexus.h index 067638a..ffeb60c 100644 --- a/src/src/settingsdialognexus.h +++ b/src/src/settingsdialognexus.h @@ -54,7 +54,7 @@ class NexusSettingsTab : public SettingsTab { public: NexusSettingsTab(Settings& settings, SettingsDialog& dialog); - void update(); + void update() override; private: std::unique_ptr m_connectionUI; diff --git a/src/src/shared/fileregisterfwd.h b/src/src/shared/fileregisterfwd.h index cc1e2e9..940eb9c 100644 --- a/src/src/shared/fileregisterfwd.h +++ b/src/src/shared/fileregisterfwd.h @@ -48,7 +48,7 @@ public: int order() const { return order_; } const std::wstring& name() const { return name_; } - bool isValid() const { return name_.size() > 0; } + bool isValid() const { return !name_.empty(); } DataArchiveOrigin(std::wstring name, int order) : name_(std::move(name)), order_(order) diff --git a/src/src/statusbar.h b/src/src/statusbar.h index 8e085fd..0891fdd 100644 --- a/src/src/statusbar.h +++ b/src/src/statusbar.h @@ -49,8 +49,8 @@ public: void updateNormalMessage(OrganizerCore& core); protected: - void showEvent(QShowEvent* e); - void hideEvent(QHideEvent* e); + void showEvent(QShowEvent* e) override; + void hideEvent(QHideEvent* e) override; private: Ui::MainWindow* ui; diff --git a/src/src/texteditor.h b/src/src/texteditor.h index ed54056..d40c28d 100644 --- a/src/src/texteditor.h +++ b/src/src/texteditor.h @@ -155,7 +155,7 @@ signals: void editingFinished(); protected: - void focusOutEvent(QFocusEvent* e); + void focusOutEvent(QFocusEvent* e) override; private: }; diff --git a/src/src/vfs/mo2filesystem.h b/src/src/vfs/mo2filesystem.h index b343e3b..bcc34de 100644 --- a/src/src/vfs/mo2filesystem.h +++ b/src/src/vfs/mo2filesystem.h @@ -58,7 +58,7 @@ struct Mo2FsContext std::string name; bool is_dir = false; uint64_t size = 0; - std::chrono::system_clock::time_point mtime{}; + std::chrono::system_clock::time_point mtime; std::string real_path; mode_t cached_mode = 0; }; @@ -78,7 +78,7 @@ struct Mo2FsContext struct CachedAttr { struct stat st {}; - std::chrono::steady_clock::time_point expires_at{}; + std::chrono::steady_clock::time_point expires_at; bool valid = false; }; std::unordered_map attr_cache; diff --git a/src/src/vfs/vfstree.h b/src/src/vfs/vfstree.h index 2e33a9a..77df308 100644 --- a/src/src/vfs/vfstree.h +++ b/src/src/vfs/vfstree.h @@ -15,7 +15,7 @@ struct VfsFileInfo { std::string real_path; uint64_t size = 0; - std::chrono::system_clock::time_point mtime{}; + std::chrono::system_clock::time_point mtime; std::string origin; bool is_backing = false; mode_t cached_mode = 0; // permission bits from stat() at tree-build time @@ -25,7 +25,7 @@ struct CachedBaseFile { std::string relative_path; uint64_t size = 0; - std::chrono::system_clock::time_point mtime{}; + std::chrono::system_clock::time_point mtime; bool is_dir = false; }; -- cgit v1.3.1