From 4504259a634648d690c68231b29e88b3047a8658 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Tue, 28 Apr 2026 23:47:26 -0500 Subject: clang-tidy: third auto-fix pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sequentially applied a tighter set of safer checks: - modernize-return-braced-init-list - modernize-use-equals-default - modernize-use-noexcept - modernize-use-using - modernize-raw-string-literal - readability-enum-initial-value - readability-make-member-function-const - readability-convert-member-functions-to-static - readability-redundant-member-init - readability-container-contains - readability-container-size-empty One file (mainwindow.h) had to be hand-fixed: extractProgress was auto-marked static by readability-convert-member-functions-to-static, but it's bound via boost::bind(&MainWindow::extractProgress, this, ...) — making it static breaks the bind. Restored to a non-static member. Build verified. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/src/aboutdialog.h | 2 +- src/src/apiuseraccount.cpp | 2 +- src/src/bbcode.cpp | 94 +++++++++++++++++------------------ src/src/categories.cpp | 2 +- src/src/categories.h | 2 +- src/src/commandline.cpp | 2 +- src/src/commandline.h | 2 +- src/src/createinstancedialogpages.cpp | 2 +- src/src/createinstancedialogpages.h | 8 +-- src/src/csvbuilder.cpp | 6 +-- src/src/csvbuilder.h | 6 +-- src/src/datatab.cpp | 2 +- src/src/datatab.h | 2 +- src/src/directoryrefresher.h | 2 +- src/src/downloadlist.cpp | 12 ++--- src/src/downloadlistview.cpp | 2 +- src/src/downloadmanager.cpp | 8 +-- src/src/downloadmanager.h | 8 +-- src/src/editexecutablesdialog.h | 2 +- src/src/env.cpp | 8 +-- src/src/env.h | 8 +-- src/src/envfs.cpp | 2 +- src/src/envfs.h | 2 +- src/src/envmetrics.cpp | 8 +-- src/src/envmetrics.h | 6 +-- src/src/envmodule.cpp | 2 +- src/src/envmodule.h | 2 +- src/src/envsecurity.cpp | 2 +- src/src/envsecurity.h | 2 +- src/src/envshell.h | 2 +- src/src/envshortcut.cpp | 2 +- src/src/envshortcut.h | 2 +- src/src/envwindows.cpp | 8 +-- src/src/envwindows.h | 10 ++-- src/src/executableslist.cpp | 4 +- src/src/executableslist.h | 4 +- src/src/filetreemodel.cpp | 2 +- src/src/filetreemodel.h | 2 +- src/src/filterlist.cpp | 4 +- src/src/fluorineconfig.cpp | 4 +- src/src/fluorineconfig.h | 2 +- src/src/fluorineupdater.cpp | 4 +- src/src/fluorineupdater.h | 4 +- src/src/forcedloaddialogwidget.cpp | 2 +- src/src/forcedloaddialogwidget.h | 2 +- src/src/fuseconnector.h | 2 +- src/src/game_features.cpp | 2 +- src/src/github.cpp | 2 +- src/src/github.h | 8 +-- src/src/iconextractor.cpp | 2 +- src/src/iconfetcher.cpp | 2 +- src/src/iconfetcher.h | 2 +- src/src/installationmanager.cpp | 12 ++--- src/src/installationmanager.h | 2 +- src/src/instancemanager.cpp | 12 ++--- src/src/instancemanager.h | 18 +++---- src/src/instancemanagerdialog.cpp | 2 +- src/src/loglist.cpp | 6 +-- src/src/loglist.h | 4 +- src/src/mainwindow.cpp | 12 ++--- src/src/mainwindow.h | 26 +++++----- src/src/moapplication.cpp | 2 +- src/src/moapplication.h | 10 ++-- src/src/modconflicticondelegate.cpp | 4 +- src/src/modelutils.cpp | 4 +- src/src/modflagicondelegate.cpp | 10 ++-- src/src/modinfo.cpp | 2 +- src/src/modinfo.h | 6 +-- src/src/modinfobackup.h | 18 +++---- src/src/modinfodialogconflicts.cpp | 12 ++--- src/src/modinfodialogconflicts.h | 4 +- src/src/modinfodialogesps.h | 2 +- src/src/modinfodialogfwd.h | 16 +++--- src/src/modinfodialogimages.cpp | 18 +++---- src/src/modinfodialogimages.h | 4 +- src/src/modinfoforeign.h | 18 +++---- src/src/modinfooverwrite.h | 20 ++++---- src/src/modinforegular.cpp | 4 +- src/src/modinforegular.h | 6 +-- src/src/modinfoseparator.h | 20 ++++---- src/src/modlist.cpp | 66 ++++++++++++------------ src/src/modlist.h | 42 ++++++++-------- src/src/modlistbypriorityproxy.cpp | 12 ++--- src/src/modlistdropinfo.cpp | 2 +- src/src/modlistdropinfo.h | 2 +- src/src/modlistsortproxy.cpp | 10 ++-- src/src/modlistsortproxy.h | 10 ++-- src/src/modlistview.cpp | 18 +++---- src/src/modlistview.h | 10 ++-- src/src/modlistviewactions.cpp | 10 ++-- src/src/modlistviewactions.h | 12 ++--- src/src/motddialog.h | 2 +- src/src/nexusinterface.cpp | 2 +- src/src/nexusinterface.h | 4 +- src/src/nxmaccessmanager.cpp | 4 +- src/src/nxmaccessmanager.h | 4 +- src/src/nxmhandler_linux.cpp | 2 +- src/src/nxmhandler_linux.h | 2 +- src/src/organizercore.cpp | 8 +-- src/src/organizercore.h | 10 ++-- src/src/organizerproxy.cpp | 2 +- src/src/overwriteinfodialog.h | 4 +- src/src/plugincontainer.cpp | 6 +-- src/src/plugincontainer.h | 6 +-- src/src/pluginlist.cpp | 24 ++++----- src/src/pluginlist.h | 22 ++++---- src/src/prefixsetuprunner.cpp | 8 +-- src/src/prefixsetuprunner.h | 8 +-- src/src/problemsdialog.h | 2 +- src/src/profile.cpp | 10 ++-- src/src/profile.h | 6 +-- src/src/protonlauncher.cpp | 4 +- src/src/qtgroupingproxy.cpp | 30 +++++------ src/src/qtgroupingproxy.h | 4 +- src/src/savestab.cpp | 4 +- src/src/selectiondialog.cpp | 4 +- src/src/selfupdater.cpp | 2 +- src/src/settings.cpp | 16 +++--- src/src/settings.h | 8 +-- src/src/settingsdialog.cpp | 6 +-- src/src/settingsdialog.h | 2 +- src/src/settingsdialogpaths.h | 2 +- src/src/settingsdialogplugins.cpp | 2 +- src/src/settingsdialogplugins.h | 2 +- src/src/settingsdialogproton.h | 4 +- src/src/settingsdialogtheme.h | 2 +- src/src/settingsdialogworkarounds.h | 2 +- src/src/shared/util.cpp | 4 +- src/src/shared/windows_error.h | 2 +- src/src/statusbar.cpp | 2 +- src/src/statusbar.h | 2 +- src/src/texteditor.cpp | 2 +- src/src/transfersavesdialog.h | 2 +- src/src/uilocker.cpp | 4 +- src/src/uilocker.h | 2 +- src/src/vfs/overwritemanager.cpp | 14 +++--- src/src/vfs/overwritemanager.h | 14 +++--- 137 files changed, 516 insertions(+), 516 deletions(-) (limited to 'src') diff --git a/src/src/aboutdialog.h b/src/src/aboutdialog.h index 7c8d572..524b238 100644 --- a/src/src/aboutdialog.h +++ b/src/src/aboutdialog.h @@ -71,7 +71,7 @@ private: private slots: void on_creditsList_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous); - void on_sourceText_linkActivated(const QString& link); + static void on_sourceText_linkActivated(const QString& link); private: Ui::AboutDialog* ui; diff --git a/src/src/apiuseraccount.cpp b/src/src/apiuseraccount.cpp index a511e88..a4907e8 100644 --- a/src/src/apiuseraccount.cpp +++ b/src/src/apiuseraccount.cpp @@ -15,7 +15,7 @@ QString localizedUserAccountType(APIUserAccountTypes t) } } -APIUserAccount::APIUserAccount() {} +APIUserAccount::APIUserAccount() = default; bool APIUserAccount::isValid() const { diff --git a/src/src/bbcode.cpp b/src/src/bbcode.cpp index 5567fb0..234e505 100644 --- a/src/src/bbcode.cpp +++ b/src/src/bbcode.cpp @@ -30,7 +30,7 @@ namespace log = MOBase::log; class BBCodeMap { - typedef std::map> TagMap; + using TagMap = std::map>; public: static BBCodeMap& instance() @@ -59,7 +59,7 @@ public: if (tagName == "*") { // ends at the next bullet point closeTagPos = - input.indexOf(QRegularExpression("(\\[\\*\\]|)", + input.indexOf(QRegularExpression(R"((\[\*\]|))", QRegularExpression::CaseInsensitiveOption), 3); // leave closeTagLength at 0 because we don't want to "eat" the next bullet @@ -117,7 +117,7 @@ public: } } else { if (tagName == "*") { - temp.remove(QRegularExpression("(\\[/\\*\\])?(
)?$")); + temp.remove(QRegularExpression(R"((\[/\*\])?(
)?$)")); } return temp.replace(tagIter->second.first, tagIter->second.second); } @@ -126,103 +126,103 @@ public: // or the expression is log::warn("{} doesn't match the expression for {}", temp, tagName); length = 0; - return QString(); + return {}; } } } // not a recognized tag or tag invalid length = 0; - return QString(); + return {}; } private: BBCodeMap() : m_TagNameExp("[a-zA-Z*]*=?") { m_TagMap["b"] = - std::make_pair(QRegularExpression("\\[b\\](.*)\\[/b\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[b\](.*)\[/b\])"), "\\1"); m_TagMap["i"] = - std::make_pair(QRegularExpression("\\[i\\](.*)\\[/i\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[i\](.*)\[/i\])"), "\\1"); m_TagMap["u"] = - std::make_pair(QRegularExpression("\\[u\\](.*)\\[/u\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[u\](.*)\[/u\])"), "\\1"); m_TagMap["s"] = - std::make_pair(QRegularExpression("\\[s\\](.*)\\[/s\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[s\](.*)\[/s\])"), "\\1"); m_TagMap["sub"] = - std::make_pair(QRegularExpression("\\[sub\\](.*)\\[/sub\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[sub\](.*)\[/sub\])"), "\\1"); m_TagMap["sup"] = - std::make_pair(QRegularExpression("\\[sup\\](.*)\\[/sup\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[sup\](.*)\[/sup\])"), "\\1"); m_TagMap["size="] = - std::make_pair(QRegularExpression("\\[size=([^\\]]*)\\](.*)\\[/size\\]"), - "\\2"); + std::make_pair(QRegularExpression(R"(\[size=([^\]]*)\](.*)\[/size\])"), + R"(\2)"); m_TagMap["color="] = - std::make_pair(QRegularExpression("\\[color=([^\\]]*)\\](.*)\\[/color\\]"), ""); + std::make_pair(QRegularExpression(R"(\[color=([^\]]*)\](.*)\[/color\])"), ""); m_TagMap["font="] = - std::make_pair(QRegularExpression("\\[font=([^\\]]*)\\](.*)\\[/font\\]"), - "\\2"); + std::make_pair(QRegularExpression(R"(\[font=([^\]]*)\](.*)\[/font\])"), + R"(\2)"); m_TagMap["center"] = - std::make_pair(QRegularExpression("\\[center\\](.*)\\[/center\\]"), - "
\\1
"); + std::make_pair(QRegularExpression(R"(\[center\](.*)\[/center\])"), + R"(
\1
)"); m_TagMap["right"] = - std::make_pair(QRegularExpression("\\[right\\](.*)\\[/right\\]"), - "
\\1
"); + std::make_pair(QRegularExpression(R"(\[right\](.*)\[/right\])"), + R"(
\1
)"); m_TagMap["quote"] = - std::make_pair(QRegularExpression("\\[quote\\](.*)\\[/quote\\]"), - "
\\1
"); + std::make_pair(QRegularExpression(R"(\[quote\](.*)\[/quote\])"), + R"(
\1
)"); m_TagMap["quote="] = - std::make_pair(QRegularExpression("\\[quote=([^\\]]*)\\](.*)\\[/quote\\]"), - "
\\2
"); + std::make_pair(QRegularExpression(R"(\[quote=([^\]]*)\](.*)\[/quote\])"), + R"(
\2
)"); m_TagMap["spoiler"] = - std::make_pair(QRegularExpression("\\[spoiler\\](.*)\\[/spoiler\\]"), + std::make_pair(QRegularExpression(R"(\[spoiler\](.*)\[/spoiler\])"), "
Spoiler:
Show
\\1
"); - m_TagMap["code"] = std::make_pair(QRegularExpression("\\[code\\](.*)\\[/code\\]"), + m_TagMap["code"] = std::make_pair(QRegularExpression(R"(\[code\](.*)\[/code\])"), "\\1"); m_TagMap["heading"] = - std::make_pair(QRegularExpression("\\[heading\\](.*)\\[/heading\\]"), + std::make_pair(QRegularExpression(R"(\[heading\](.*)\[/heading\])"), "

\\1

"); m_TagMap["line"] = std::make_pair(QRegularExpression("\\[line\\]"), "
"); // lists m_TagMap["list"] = - std::make_pair(QRegularExpression("\\[list\\](.*)\\[/list\\]"), "
    \\1
"); + std::make_pair(QRegularExpression(R"(\[list\](.*)\[/list\])"), "
    \\1
"); m_TagMap["list="] = std::make_pair( - QRegularExpression("\\[list.*\\](.*)\\[/list\\]"), "
    \\1
"); + QRegularExpression(R"(\[list.*\](.*)\[/list\])"), "
    \\1
"); m_TagMap["ul"] = - std::make_pair(QRegularExpression("\\[ul\\](.*)\\[/ul\\]"), "
    \\1
"); + std::make_pair(QRegularExpression(R"(\[ul\](.*)\[/ul\])"), "
    \\1
"); m_TagMap["ol"] = - std::make_pair(QRegularExpression("\\[ol\\](.*)\\[/ol\\]"), "
    \\1
"); + std::make_pair(QRegularExpression(R"(\[ol\](.*)\[/ol\])"), "
    \\1
"); m_TagMap["li"] = - std::make_pair(QRegularExpression("\\[li\\](.*)\\[/li\\]"), "
  • \\1
  • "); + std::make_pair(QRegularExpression(R"(\[li\](.*)\[/li\])"), "
  • \\1
  • "); // tables m_TagMap["table"] = std::make_pair( - QRegularExpression("\\[table\\](.*)\\[/table\\]"), "\\1
    "); + QRegularExpression(R"(\[table\](.*)\[/table\])"), "\\1
    "); m_TagMap["tr"] = - std::make_pair(QRegularExpression("\\[tr\\](.*)\\[/tr\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[tr\](.*)\[/tr\])"), "\\1"); m_TagMap["th"] = - std::make_pair(QRegularExpression("\\[th\\](.*)\\[/th\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[th\](.*)\[/th\])"), "\\1"); m_TagMap["td"] = - std::make_pair(QRegularExpression("\\[td\\](.*)\\[/td\\]"), "\\1"); + std::make_pair(QRegularExpression(R"(\[td\](.*)\[/td\])"), "\\1"); // web content - m_TagMap["url"] = std::make_pair(QRegularExpression("\\[url\\](.*)\\[/url\\]"), - "\\1"); + m_TagMap["url"] = std::make_pair(QRegularExpression(R"(\[url\](.*)\[/url\])"), + R"(\1)"); m_TagMap["url="] = - std::make_pair(QRegularExpression("\\[url=([^\\]]*)\\](.*)\\[/url\\]"), - "\\2"); + std::make_pair(QRegularExpression(R"(\[url=([^\]]*)\](.*)\[/url\])"), + R"(\2)"); m_TagMap["img"] = std::make_pair( QRegularExpression( - "\\[img(?:\\s*width=\\d+\\s*,?\\s*height=\\d+)?\\](.*)\\[/img\\]"), - ""); + R"(\[img(?:\s*width=\d+\s*,?\s*height=\d+)?\](.*)\[/img\])"), + R"()"); m_TagMap["img="] = - std::make_pair(QRegularExpression("\\[img=([^\\]]*)\\](.*)\\[/img\\]"), - "\"\\1\""); + std::make_pair(QRegularExpression(R"(\[img=([^\]]*)\](.*)\[/img\])"), + R"(\1)"); m_TagMap["email="] = std::make_pair( QRegularExpression("\\[email=\"?([^\\]]*)\"?\\](.*)\\[/email\\]"), - "\\2"); + R"(\2)"); m_TagMap["youtube"] = - std::make_pair(QRegularExpression("\\[youtube\\](.*)\\[/youtube\\]"), + std::make_pair(QRegularExpression(R"(\[youtube\](.*)\[/youtube\])"), "https://" "www.youtube.com/watch?v=\\1"); @@ -235,7 +235,7 @@ private: } // this tag is in fact greedy - m_TagMap["*"] = std::make_pair(QRegularExpression("\\[\\*\\](.*)"), "
  • \\1
  • "); + m_TagMap["*"] = std::make_pair(QRegularExpression(R"(\[\*\](.*))"), "
  • \\1
  • "); m_ColorMap.insert(std::make_pair("red", "FF0000")); m_ColorMap.insert(std::make_pair("green", "00FF00")); diff --git a/src/src/categories.cpp b/src/src/categories.cpp index 78e7b53..7bf25ed 100644 --- a/src/src/categories.cpp +++ b/src/src/categories.cpp @@ -413,7 +413,7 @@ QString CategoryFactory::getCategoryName(unsigned int index) const return m_Categories[index].name(); } -QString CategoryFactory::getSpecialCategoryName(SpecialCategories type) const +QString CategoryFactory::getSpecialCategoryName(SpecialCategories type) { QString label; switch (type) { diff --git a/src/src/categories.h b/src/src/categories.h index 99e3d55..3144973 100644 --- a/src/src/categories.h +++ b/src/src/categories.h @@ -192,7 +192,7 @@ public: * @return QString name of the category **/ QString getCategoryName(unsigned int index) const; - QString getSpecialCategoryName(SpecialCategories type) const; + static QString getSpecialCategoryName(SpecialCategories type) ; QString getCategoryNameByID(int id) const; /** diff --git a/src/src/commandline.cpp b/src/src/commandline.cpp index d33b5c5..249353c 100644 --- a/src/src/commandline.cpp +++ b/src/src/commandline.cpp @@ -441,7 +441,7 @@ const QStringList& CommandLine::untouched() const return m_untouched; } -std::string CommandLine::more() const +std::string CommandLine::more() { return "Multiple processes\n" " A note on terminology: 'instance' can either mean an MO process\n" diff --git a/src/src/commandline.h b/src/src/commandline.h index 1a7535e..8dcc23a 100644 --- a/src/src/commandline.h +++ b/src/src/commandline.h @@ -393,7 +393,7 @@ private: std::wstring m_originalLine; void createOptions(); - std::string more() const; + static std::string more() ; template void add() diff --git a/src/src/createinstancedialogpages.cpp b/src/src/createinstancedialogpages.cpp index 1207e6c..df7a32e 100644 --- a/src/src/createinstancedialogpages.cpp +++ b/src/src/createinstancedialogpages.cpp @@ -1327,7 +1327,7 @@ QString ConfirmationPage::makeReview() const return lines.join("\n"); } -QString ConfirmationPage::dirLine(const QString& caption, const QString& path) const +QString ConfirmationPage::dirLine(const QString& caption, const QString& path) { return QString(" - %1: %2").arg(caption).arg(path); } diff --git a/src/src/createinstancedialogpages.h b/src/src/createinstancedialogpages.h index e4c3a2e..c97b0e3 100644 --- a/src/src/createinstancedialogpages.h +++ b/src/src/createinstancedialogpages.h @@ -294,7 +294,7 @@ private: // updates the given button on the ui, sets the text, icon, etc. // - void updateButton(Game* g); + static void updateButton(Game* g); // game buttons are toggles, this creates the button for the given game if // it doesn't exist and toggles it on @@ -351,7 +351,7 @@ private: // detects if the given path likely contains a Microsoft Store game // - bool detectMicrosoftStore(const QString& path); + static bool detectMicrosoftStore(const QString& path); // tells the user that the path probably contains a Microsoft Store game that // is not supported, returns true if the user decides to accept anyway. @@ -558,7 +558,7 @@ private: // sets the given textbox to the path if it's empty or if `force` is true // - void setIfEmpty(QLineEdit* e, const QString& path, bool force); + static void setIfEmpty(QLineEdit* e, const QString& path, bool force); }; // default settings for profiles page; allow the user to set their preferred @@ -623,7 +623,7 @@ private: // returns a log line with the given caption and path, something like // " - caption: path" // - QString dirLine(const QString& caption, const QString& path) const; + static QString dirLine(const QString& caption, const QString& path) ; }; } // namespace cid diff --git a/src/src/csvbuilder.cpp b/src/src/csvbuilder.cpp index 11cd112..03c4763 100644 --- a/src/src/csvbuilder.cpp +++ b/src/src/csvbuilder.cpp @@ -10,7 +10,7 @@ CSVBuilder::CSVBuilder(QIODevice* target) m_QuoteMode[TYPE_STRING] = QUOTE_ONDEMAND; } -CSVBuilder::~CSVBuilder() {} +CSVBuilder::~CSVBuilder() = default; void CSVBuilder::setFieldSeparator(char sep) { @@ -209,7 +209,7 @@ void CSVBuilder::addRow(const std::map& data) writeData(data, true); } -void CSVBuilder::checkFields(const std::vector& fields) +void CSVBuilder::checkFields(const std::vector& fields) const { for (auto iter = fields.begin(); iter != fields.end(); ++iter) { if (iter->contains(m_Separator) || iter->contains('\r') || iter->contains('\n') || @@ -248,7 +248,7 @@ const char* CSVBuilder::lineBreak() } } -const char CSVBuilder::separator() +const char CSVBuilder::separator() const { return m_Separator; } diff --git a/src/src/csvbuilder.h b/src/src/csvbuilder.h index 01f7b93..48d0dd3 100644 --- a/src/src/csvbuilder.h +++ b/src/src/csvbuilder.h @@ -12,7 +12,7 @@ class CSVException : public std::exception public: CSVException(const QString& text) : m_Message(text.toLocal8Bit()) {} - const char* what() const throw() override { return m_Message.constData(); } + const char* what() const noexcept override { return m_Message.constData(); } private: QByteArray m_Message; @@ -62,10 +62,10 @@ public: private: const char* lineBreak(); - const char separator(); + const char separator() const; void fieldValid(); - void checkFields(const std::vector& fields); + void checkFields(const std::vector& fields) const; void checkValue(const QString& field, const QVariant& value); void writeData(const std::map& data, bool check); diff --git a/src/src/datatab.cpp b/src/src/datatab.cpp index 61ded81..f793493 100644 --- a/src/src/datatab.cpp +++ b/src/src/datatab.cpp @@ -109,7 +109,7 @@ void DataTab::saveState(Settings& s) const s.widgets().saveChecked(ui.hiddenFiles); } -void DataTab::restoreState(const Settings& s) +void DataTab::restoreState(const Settings& s) const { s.geometry().restoreState(ui.tree->header()); diff --git a/src/src/datatab.h b/src/src/datatab.h index 632a45a..96555ba 100644 --- a/src/src/datatab.h +++ b/src/src/datatab.h @@ -32,7 +32,7 @@ public: Ui::MainWindow* ui); void saveState(Settings& s) const; - void restoreState(const Settings& s); + void restoreState(const Settings& s) const; void activated(); // if the data tab is currently visible, trigger an update of the diff --git a/src/src/directoryrefresher.h b/src/src/directoryrefresher.h index 09ecdfa..d0085fb 100644 --- a/src/src/directoryrefresher.h +++ b/src/src/directoryrefresher.h @@ -157,7 +157,7 @@ private: std::size_t m_threadCount; std::size_t m_lastFileCount{0}; - void stealModFilesIntoStructure(MOShared::DirectoryEntry* directoryStructure, + static void stealModFilesIntoStructure(MOShared::DirectoryEntry* directoryStructure, const QString& modName, int priority, const QString& directory, const QStringList& stealFiles); diff --git a/src/src/downloadlist.cpp b/src/src/downloadlist.cpp index 5f4a89d..045d248 100644 --- a/src/src/downloadlist.cpp +++ b/src/src/downloadlist.cpp @@ -62,7 +62,7 @@ QModelIndex DownloadList::index(int row, int column, const QModelIndex&) const QModelIndex DownloadList::parent(const QModelIndex&) const { - return QModelIndex(); + return {}; } QVariant DownloadList::headerData(int section, Qt::Orientation orientation, @@ -87,7 +87,7 @@ QVariant DownloadList::headerData(int section, Qt::Orientation orientation, case COL_SOURCEGAME: return tr("Source Game"); default: - return QVariant(); + return {}; } } else { return QAbstractItemModel::headerData(section, orientation, role); @@ -109,7 +109,7 @@ QMimeData* DownloadList::mimeData(const QModelIndexList& indexes) const QVariant DownloadList::data(const QModelIndex& index, int role) const { if (!index.isValid() || index.row() < 0 || index.row() >= rowCount()) - return QVariant(); + return {}; bool pendingDownload = index.row() >= m_manager.numTotalDownloads(); if (role == Qt::DisplayRole) { @@ -236,11 +236,11 @@ QVariant DownloadList::data(const QModelIndex& index, int role) const return QIcon(":/MO/gui/warning_16"); } else if (role == Qt::TextAlignmentRole) { if (index.column() == COL_SIZE) - return QVariant(Qt::AlignVCenter | Qt::AlignRight); + return {Qt::AlignVCenter | Qt::AlignRight}; else - return QVariant(Qt::AlignVCenter | Qt::AlignLeft); + return {Qt::AlignVCenter | Qt::AlignLeft}; } - return QVariant(); + return {}; } void DownloadList::aboutToUpdate() diff --git a/src/src/downloadlistview.cpp b/src/src/downloadlistview.cpp index cfb9468..6666dd3 100644 --- a/src/src/downloadlistview.cpp +++ b/src/src/downloadlistview.cpp @@ -144,7 +144,7 @@ DownloadListView::DownloadListView(QWidget* parent) : QTreeView(parent) SLOT(onCustomContextMenu(QPoint))); } -DownloadListView::~DownloadListView() {} +DownloadListView::~DownloadListView() = default; void DownloadListView::setManager(DownloadManager* manager) { diff --git a/src/src/downloadmanager.cpp b/src/src/downloadmanager.cpp index add1da7..49dc7d5 100644 --- a/src/src/downloadmanager.cpp +++ b/src/src/downloadmanager.cpp @@ -222,7 +222,7 @@ void DownloadManager::DownloadInfo::setName(QString newName, bool renameFile) } if (renameFile) { if ((newName != m_Output.fileName()) && !m_Output.rename(newName)) { - reportError(tr("failed to rename \"%1\" to \"%2\"") + reportError(tr(R"(failed to rename "%1" to "%2")") .arg(m_Output.fileName()) .arg(newName)); return; @@ -238,7 +238,7 @@ void DownloadManager::DownloadInfo::setName(QString newName, bool renameFile) } } -bool DownloadManager::DownloadInfo::isPausedState() +bool DownloadManager::DownloadInfo::isPausedState() const { return m_State == STATE_PAUSED || m_State == STATE_ERROR; } @@ -1662,7 +1662,7 @@ QString DownloadManager::getFileNameFromNetworkReply(QNetworkReply* reply) } } - return QString(); + return {}; } void DownloadManager::setState(DownloadManager::DownloadInfo* info, @@ -2061,7 +2061,7 @@ int DownloadManager::startDownloadNexusFile(const QString& gameName, int modID, return newID; } -QString DownloadManager::downloadPath(int id) +QString DownloadManager::downloadPath(int id) const { return getFilePath(id); } diff --git a/src/src/downloadmanager.h b/src/src/downloadmanager.h index 8b63153..b061788 100644 --- a/src/src/downloadmanager.h +++ b/src/src/downloadmanager.h @@ -132,9 +132,9 @@ private: **/ void setName(QString newName, bool renameFile); - unsigned int downloadID() { return m_DownloadID; } + unsigned int downloadID() const { return m_DownloadID; } - bool isPausedState(); + bool isPausedState() const; QString currentURL(); @@ -410,7 +410,7 @@ public: public: // IDownloadManager interface: int startDownloadURLs(const QStringList& urls); int startDownloadNexusFile(const QString& gameName, int modID, int fileID); - QString downloadPath(int id); + QString downloadPath(int id) const; boost::signals2::connection onDownloadComplete(const std::function& callback); @@ -581,7 +581,7 @@ private: bool ByName(int LHS, int RHS); - QString getFileNameFromNetworkReply(QNetworkReply* reply); + static QString getFileNameFromNetworkReply(QNetworkReply* reply); void setState(DownloadInfo* info, DownloadManager::DownloadState state); diff --git a/src/src/editexecutablesdialog.h b/src/src/editexecutablesdialog.h index 88b241c..30215e9 100644 --- a/src/src/editexecutablesdialog.h +++ b/src/src/editexecutablesdialog.h @@ -211,7 +211,7 @@ private: Executable* selectedExe(); void fillList(); - QListWidgetItem* createListItem(const Executable& exe); + static QListWidgetItem* createListItem(const Executable& exe); void updateUI(const QListWidgetItem* item, const Executable* e); void clearEdits(); void setEdits(const Executable& e); diff --git a/src/src/env.cpp b/src/src/env.cpp index 7f1a141..e69b83c 100644 --- a/src/src/env.cpp +++ b/src/src/env.cpp @@ -63,7 +63,7 @@ void ModuleNotification::fire(QString path, std::size_t fileSize) } } -Environment::Environment() {} +Environment::Environment() = default; // anchor Environment::~Environment() = default; @@ -77,7 +77,7 @@ const std::vector& Environment::loadedModules() const return m_modules; } -std::vector Environment::runningProcesses() const +std::vector Environment::runningProcesses() { return getRunningProcesses(); } @@ -109,7 +109,7 @@ const Metrics& Environment::metrics() const return *m_metrics; } -QString Environment::timezone() const +QString Environment::timezone() { QTimeZone tz = QTimeZone::systemTimeZone(); if (!tz.isValid()) { @@ -164,7 +164,7 @@ void Environment::dump(const Settings& s) const dumpDisks(s); } -void Environment::dumpDisks(const Settings& s) const +void Environment::dumpDisks(const Settings& s) { std::set rootPaths; diff --git a/src/src/env.h b/src/src/env.h index 5e5978c..7812745 100644 --- a/src/src/env.h +++ b/src/src/env.h @@ -95,7 +95,7 @@ public: // list of running processes; not cached // - std::vector runningProcesses() const; + static std::vector runningProcesses() ; // information about the operating system // @@ -111,12 +111,12 @@ public: // timezone // - QString timezone() const; + static QString timezone() ; // will call `f` on the same thread `o` is running on every time a module // is loaded in the process // - std::unique_ptr onModuleLoaded(QObject* o, + static std::unique_ptr onModuleLoaded(QObject* o, std::function f); // logs the environment @@ -131,7 +131,7 @@ private: // dumps all the disks involved in the settings // - void dumpDisks(const Settings& s) const; + static void dumpDisks(const Settings& s) ; }; // environment variables diff --git a/src/src/envfs.cpp b/src/src/envfs.cpp index 5493f0a..03e48d0 100644 --- a/src/src/envfs.cpp +++ b/src/src/envfs.cpp @@ -18,7 +18,7 @@ File::File(std::wstring_view n, FILETIME ft, uint64_t s) size(s) {} -Directory::Directory() {} +Directory::Directory() = default; Directory::Directory(std::wstring_view n) : name(n.begin(), n.end()), lcname(MOShared::ToLowerCopy(name)) diff --git a/src/src/envfs.h b/src/src/envfs.h index f6da750..9214ed8 100644 --- a/src/src/envfs.h +++ b/src/src/envfs.h @@ -174,7 +174,7 @@ void setHandleCloserThreadCount(std::size_t n); class DirectoryWalker { public: - void forEachEntry(const std::wstring& path, void* cx, DirStartF* dirStartF, + static void forEachEntry(const std::wstring& path, void* cx, DirStartF* dirStartF, DirEndF* dirEndF, FileF* fileF); private: diff --git a/src/src/envmetrics.cpp b/src/src/envmetrics.cpp index e04652c..6de6521 100644 --- a/src/src/envmetrics.cpp +++ b/src/src/envmetrics.cpp @@ -24,7 +24,7 @@ const QString& Display::monitorDevice() const return m_monitorDevice; } -bool Display::primary() +bool Display::primary() const { return m_primary; } @@ -39,7 +39,7 @@ int Display::resY() const return m_resY; } -int Display::dpi() +int Display::dpi() const { return m_dpi; } @@ -93,12 +93,12 @@ const std::vector& Metrics::displays() const return m_displays; } -QRect Metrics::desktopGeometry() const +QRect Metrics::desktopGeometry() { if (auto* primary = QGuiApplication::primaryScreen()) { return primary->virtualGeometry(); } - return QRect(); + return {}; } void Metrics::getDisplays() diff --git a/src/src/envmetrics.h b/src/src/envmetrics.h index 44efb9d..9e2cdc3 100644 --- a/src/src/envmetrics.h +++ b/src/src/envmetrics.h @@ -24,7 +24,7 @@ public: // whether this monitor is the primary // - bool primary(); + bool primary() const; // resolution // @@ -33,7 +33,7 @@ public: // dpi // - int dpi(); + int dpi() const; // refresh rate in hz // @@ -67,7 +67,7 @@ public: // full resolution // - QRect desktopGeometry() const; + static QRect desktopGeometry() ; private: std::vector m_displays; diff --git a/src/src/envmodule.cpp b/src/src/envmodule.cpp index 1400e91..f93b419 100644 --- a/src/src/envmodule.cpp +++ b/src/src/envmodule.cpp @@ -112,7 +112,7 @@ QString Module::toString() const return sl.join(", "); } -Module::FileInfo Module::getFileInfo() const +Module::FileInfo Module::getFileInfo() { // ELF .so files don't carry the equivalent of a Win32 PE version resource. return {}; diff --git a/src/src/envmodule.h b/src/src/envmodule.h index 6b41aef..32dcf16 100644 --- a/src/src/envmodule.h +++ b/src/src/envmodule.h @@ -85,7 +85,7 @@ private: QString m_versionString; QString m_md5; - FileInfo getFileInfo() const; + static FileInfo getFileInfo() ; QDateTime getTimestamp() const; QString getMD5() const; }; diff --git a/src/src/envsecurity.cpp b/src/src/envsecurity.cpp index 33066a0..71d47dd 100644 --- a/src/src/envsecurity.cpp +++ b/src/src/envsecurity.cpp @@ -67,7 +67,7 @@ QString SecurityProduct::toString() const return s; } -QString SecurityProduct::providerToString() const +QString SecurityProduct::providerToString() { return "n/a"; } diff --git a/src/src/envsecurity.h b/src/src/envsecurity.h index b76d970..aa80f70 100644 --- a/src/src/envsecurity.h +++ b/src/src/envsecurity.h @@ -45,7 +45,7 @@ private: bool m_active; bool m_upToDate; - QString providerToString() const; + static QString providerToString() ; }; std::vector getSecurityProducts(); diff --git a/src/src/envshell.h b/src/src/envshell.h index c672949..408d854 100644 --- a/src/src/envshell.h +++ b/src/src/envshell.h @@ -23,7 +23,7 @@ public: ShellMenu& operator=(ShellMenu&&) = default; void addFile(QFileInfo) {} - int fileCount() const { return 0; } + static int fileCount() { return 0; } void exec(const QPoint&) {} }; diff --git a/src/src/envshortcut.cpp b/src/src/envshortcut.cpp index 1a36cf4..d54a173 100644 --- a/src/src/envshortcut.cpp +++ b/src/src/envshortcut.cpp @@ -516,7 +516,7 @@ QString Shortcut::shortcutPath(Locations loc) const return dir + "/" + shortcutFilename(); } -QString Shortcut::shortcutDirectory(Locations loc) const +QString Shortcut::shortcutDirectory(Locations loc) { if (loc == Desktop) { // XDG desktop directory diff --git a/src/src/envshortcut.h b/src/src/envshortcut.h index 2048d7f..4c9675b 100644 --- a/src/src/envshortcut.h +++ b/src/src/envshortcut.h @@ -95,7 +95,7 @@ private: // returns the directory where the shortcut file should be saved // - QString shortcutDirectory(Locations loc) const; + static QString shortcutDirectory(Locations loc) ; // returns the filename of the shortcut file that should be used when saving // diff --git a/src/src/envwindows.cpp b/src/src/envwindows.cpp index b2c1656..a806df9 100644 --- a/src/src/envwindows.cpp +++ b/src/src/envwindows.cpp @@ -22,7 +22,7 @@ WindowsInfo::WindowsInfo() m_elevated = getElevated(); } -WindowsInfo::Version WindowsInfo::getKernelVersion() const +WindowsInfo::Version WindowsInfo::getKernelVersion() { struct utsname uts; if (uname(&uts) != 0) { @@ -52,7 +52,7 @@ WindowsInfo::Version WindowsInfo::getKernelVersion() const return v; } -WindowsInfo::Release WindowsInfo::getRelease() const +WindowsInfo::Release WindowsInfo::getRelease() { Release r; @@ -82,12 +82,12 @@ WindowsInfo::Release WindowsInfo::getRelease() const return r; } -std::optional WindowsInfo::getElevated() const +std::optional WindowsInfo::getElevated() { return (geteuid() == 0); } -bool WindowsInfo::compatibilityMode() const +bool WindowsInfo::compatibilityMode() { return false; } diff --git a/src/src/envwindows.h b/src/src/envwindows.h index a10fd6b..524bc2f 100644 --- a/src/src/envwindows.h +++ b/src/src/envwindows.h @@ -41,14 +41,14 @@ public: // some sub-build number, may be empty uint32_t UBR{0}; - Release() {} + Release() = default; }; WindowsInfo(); // tries to guess whether this process is running in compatibility mode // - bool compatibilityMode() const; + static bool compatibilityMode() ; // returns the OS version // @@ -76,15 +76,15 @@ private: std::optional m_elevated; // uses uname() to get the kernel version - Version getKernelVersion() const; + static Version getKernelVersion() ; // gets various information from the registry (Windows) or /etc/os-release (Linux) // - Release getRelease() const; + static Release getRelease() ; // gets whether the process is elevated // - std::optional getElevated() const; + static std::optional getElevated() ; }; } // namespace env diff --git a/src/src/executableslist.cpp b/src/src/executableslist.cpp index 459d25c..9fdf9ca 100644 --- a/src/src/executableslist.cpp +++ b/src/src/executableslist.cpp @@ -144,7 +144,7 @@ void ExecutablesList::store(Settings& s) } std::vector -ExecutablesList::getPluginExecutables(MOBase::IPluginGame const* game) const +ExecutablesList::getPluginExecutables(MOBase::IPluginGame const* game) { Q_ASSERT(game != nullptr); @@ -308,7 +308,7 @@ void ExecutablesList::remove(const QString& title) } } -std::optional ExecutablesList::makeNonConflictingTitle(const QString& prefix) +std::optional ExecutablesList::makeNonConflictingTitle(const QString& prefix) const { const int max = 100; diff --git a/src/src/executableslist.h b/src/src/executableslist.h index 1824d67..8ec8cbb 100644 --- a/src/src/executableslist.h +++ b/src/src/executableslist.h @@ -190,7 +190,7 @@ public: * returns a title that starts with the given prefix and does not clash with * an existing executable, may fail */ - std::optional makeNonConflictingTitle(const QString& prefix); + std::optional makeNonConflictingTitle(const QString& prefix) const; private: enum SetFlags @@ -221,7 +221,7 @@ private: /** * returns the executables provided by the game plugin **/ - std::vector getPluginExecutables(MOBase::IPluginGame const* game) const; + static std::vector getPluginExecutables(MOBase::IPluginGame const* game) ; /** * called when MO is still using the old custom executables from 2.2.0 diff --git a/src/src/filetreemodel.cpp b/src/src/filetreemodel.cpp index 87eadce..0724ff0 100644 --- a/src/src/filetreemodel.cpp +++ b/src/src/filetreemodel.cpp @@ -1060,7 +1060,7 @@ bool FileTreeModel::shouldShowFolder(const DirectoryEntry& dir, return false; } -QVariant FileTreeModel::displayData(const FileTreeItem* item, int column) const +QVariant FileTreeModel::displayData(const FileTreeItem* item, int column) { switch (column) { case FileName: { diff --git a/src/src/filetreemodel.h b/src/src/filetreemodel.h index 7cd764e..add8403 100644 --- a/src/src/filetreemodel.h +++ b/src/src/filetreemodel.h @@ -155,7 +155,7 @@ private: void updateFileItem(FileTreeItem& item, const MOShared::FileEntry& file); - QVariant displayData(const FileTreeItem* item, int column) const; + static QVariant displayData(const FileTreeItem* item, int column) ; std::wstring makeModName(const MOShared::FileEntry& file, int originID) const; void ensureLoaded(FileTreeItem* item) const; diff --git a/src/src/filterlist.cpp b/src/src/filterlist.cpp index e50740a..defe7e2 100644 --- a/src/src/filterlist.cpp +++ b/src/src/filterlist.cpp @@ -25,8 +25,8 @@ public: FirstState = 0, Inactive = FirstState, - Active, - Inverted, + Active = 1, + Inverted = 2, LastState = Inverted }; diff --git a/src/src/fluorineconfig.cpp b/src/src/fluorineconfig.cpp index 9608267..3440765 100644 --- a/src/src/fluorineconfig.cpp +++ b/src/src/fluorineconfig.cpp @@ -89,7 +89,7 @@ bool FluorineConfig::save() const return written >= 0; } -void FluorineConfig::deleteConfig() const +void FluorineConfig::deleteConfig() { const QString path = configFilePath(); if (QFile::exists(path)) { @@ -112,7 +112,7 @@ bool FluorineConfig::prefixExists() const QString FluorineConfig::compatDataPath() const { if (prefix_path.isEmpty()) { - return QString(); + return {}; } QDir prefixDir(prefix_path); diff --git a/src/src/fluorineconfig.h b/src/src/fluorineconfig.h index 92f8561..8480b04 100644 --- a/src/src/fluorineconfig.h +++ b/src/src/fluorineconfig.h @@ -17,7 +17,7 @@ public: static std::optional load(); bool save() const; - void deleteConfig() const; + static void deleteConfig() ; bool prefixExists() const; QString compatDataPath() const; void destroyPrefix() const; diff --git a/src/src/fluorineupdater.cpp b/src/src/fluorineupdater.cpp index 0d11786..c930a56 100644 --- a/src/src/fluorineupdater.cpp +++ b/src/src/fluorineupdater.cpp @@ -206,7 +206,7 @@ void FluorineUpdater::onReplyFinished() } bool FluorineUpdater::parseStableRelease(const QJsonObject& obj, - ReleaseInfo& out) const + ReleaseInfo& out) { out.tagName = obj.value(QStringLiteral("tag_name")).toString(); out.name = obj.value(QStringLiteral("name")).toString(); @@ -246,7 +246,7 @@ bool FluorineUpdater::parseStableRelease(const QJsonObject& obj, } bool FluorineUpdater::parseBetaRelease(const QJsonObject& obj, - ReleaseInfo& out) const + ReleaseInfo& out) { out.tagName = obj.value(QStringLiteral("tag_name")).toString(); out.name = obj.value(QStringLiteral("name")).toString(); diff --git a/src/src/fluorineupdater.h b/src/src/fluorineupdater.h index a573584..4c4c918 100644 --- a/src/src/fluorineupdater.h +++ b/src/src/fluorineupdater.h @@ -64,8 +64,8 @@ private slots: void onReplyFinished(); private: - bool parseBetaRelease(const QJsonObject& obj, ReleaseInfo& out) const; - bool parseStableRelease(const QJsonObject& obj, ReleaseInfo& out) const; + static bool parseBetaRelease(const QJsonObject& obj, ReleaseInfo& out) ; + static bool parseStableRelease(const QJsonObject& obj, ReleaseInfo& out) ; QNetworkAccessManager* m_net; QNetworkReply* m_reply = nullptr; diff --git a/src/src/forcedloaddialogwidget.cpp b/src/src/forcedloaddialogwidget.cpp index 1567bdf..1eadf1b 100644 --- a/src/src/forcedloaddialogwidget.cpp +++ b/src/src/forcedloaddialogwidget.cpp @@ -22,7 +22,7 @@ bool ForcedLoadDialogWidget::getEnabled() return ui->enabledBox->isChecked(); } -bool ForcedLoadDialogWidget::getForced() +bool ForcedLoadDialogWidget::getForced() const { return m_Forced; } diff --git a/src/src/forcedloaddialogwidget.h b/src/src/forcedloaddialogwidget.h index ceb931f..7c7ac94 100644 --- a/src/src/forcedloaddialogwidget.h +++ b/src/src/forcedloaddialogwidget.h @@ -19,7 +19,7 @@ public: ~ForcedLoadDialogWidget() override; bool getEnabled(); - bool getForced(); + bool getForced() const; QString getLibraryPath(); QString getProcess(); diff --git a/src/src/fuseconnector.h b/src/src/fuseconnector.h index 29601c6..fcff0d8 100644 --- a/src/src/fuseconnector.h +++ b/src/src/fuseconnector.h @@ -22,7 +22,7 @@ public: : m_Message(text.toLocal8Bit()) {} - const char* what() const throw() override { return m_Message.constData(); } + const char* what() const noexcept override { return m_Message.constData(); } private: QByteArray m_Message; diff --git a/src/src/game_features.cpp b/src/src/game_features.cpp index 7bb1f8f..0efa0cf 100644 --- a/src/src/game_features.cpp +++ b/src/src/game_features.cpp @@ -172,7 +172,7 @@ GameFeatures::GameFeatures(OrganizerCore* core, PluginContainer* plugins) }); } -GameFeatures::~GameFeatures() {} +GameFeatures::~GameFeatures() = default; GameFeatures::CombinedModDataChecker& GameFeatures::modDataChecker() const { diff --git a/src/src/github.cpp b/src/src/github.cpp index dcbfaf1..59acdc9 100644 --- a/src/src/github.cpp +++ b/src/src/github.cpp @@ -56,7 +56,7 @@ QJsonDocument GitHub::handleReply(QNetworkReply* reply) QByteArray data = reply->readAll(); if (data.isNull() || data.isEmpty() || (strcmp(data.constData(), "null") == 0)) { - return QJsonDocument(); + return {}; } QJsonParseError parseError; diff --git a/src/src/github.h b/src/src/github.h index 36a17f3..f44ff6e 100644 --- a/src/src/github.h +++ b/src/src/github.h @@ -17,9 +17,9 @@ public: initMessage(errorObj); } - ~GitHubException() throw() override {} + ~GitHubException() noexcept override = default; - const char* what() const throw() override { return m_Message.constData(); } + const char* what() const noexcept override { return m_Message.constData(); } private: void initMessage(const QJsonObject& obj) @@ -81,7 +81,7 @@ private: const std::function& callback, bool relative); - QJsonDocument handleReply(QNetworkReply* reply); + static QJsonDocument handleReply(QNetworkReply* reply); QNetworkReply* genReply(Method method, const QString& path, const QByteArray& data, bool relative); @@ -102,7 +102,7 @@ private: void onFinished(const Request& req); void onError(const Request& req, QNetworkReply::NetworkError error); - void onTimeout(const Request& req); + static void onTimeout(const Request& req); void deleteReply(QNetworkReply* reply); }; diff --git a/src/src/iconextractor.cpp b/src/src/iconextractor.cpp index fb29742..6cc7d45 100644 --- a/src/src/iconextractor.cpp +++ b/src/src/iconextractor.cpp @@ -72,7 +72,7 @@ QByteArray getResourceData(const char* resBase, uint32_t dataEntryOffset, int64_t off = rvaToOffset(dataRva, sections, numSections); if (off < 0 || off + dataSize > fileSize) return {}; - return QByteArray(fileData + off, static_cast(dataSize)); + return {fileData + off, static_cast(dataSize)}; } /// Build an ICO file from a GRPICONDIR and RT_ICON resources. diff --git a/src/src/iconfetcher.cpp b/src/src/iconfetcher.cpp index d711b72..5f860f7 100644 --- a/src/src/iconfetcher.cpp +++ b/src/src/iconfetcher.cpp @@ -69,7 +69,7 @@ QPixmap IconFetcher::genericDirectoryIcon() const return m_quickCache.directory; } -bool IconFetcher::hasOwnIcon(const QString& path) const +bool IconFetcher::hasOwnIcon(const QString& path) { static const QString exe = ".exe"; static const QString lnk = ".lnk"; diff --git a/src/src/iconfetcher.h b/src/src/iconfetcher.h index f748090..c38a639 100644 --- a/src/src/iconfetcher.h +++ b/src/src/iconfetcher.h @@ -55,7 +55,7 @@ private: mutable Cache m_fileCache; mutable Waiter m_waiter; - bool hasOwnIcon(const QString& path) const; + static bool hasOwnIcon(const QString& path) ; template QPixmap getPixmapIcon(T&& t) const diff --git a/src/src/installationmanager.cpp b/src/src/installationmanager.cpp index d9e4b5c..7883e3a 100644 --- a/src/src/installationmanager.cpp +++ b/src/src/installationmanager.cpp @@ -123,7 +123,7 @@ InstallationManager::InstallationManager() &InstallationManager::queryPassword, Qt::BlockingQueuedConnection); } -InstallationManager::~InstallationManager() {} +InstallationManager::~InstallationManager() = default; void InstallationManager::setParentWidget(QWidget* widget) { @@ -300,7 +300,7 @@ QStringList InstallationManager::extractFiles( } if (!extractFiles(QDir::tempPath(), tr("Extracting files"), false, silent)) { - return QStringList(); + return {}; } return result; @@ -318,7 +318,7 @@ InstallationManager::createFile(std::shared_ptr ent // Open/Close the file so that installer can use it properly: if (!tempFile.open()) { - return QString(); + return {}; } tempFile.close(); @@ -372,7 +372,7 @@ InstallationManager::installArchive(GuessedValue& modName, return install(archiveName, modName, modId).result(); } -QString InstallationManager::generateBackupName(const QString& directoryName) const +QString InstallationManager::generateBackupName(const QString& directoryName) { QString backupName = directoryName + "_backup"; if (QDir(backupName).exists()) { @@ -649,7 +649,7 @@ InstallationResult InstallationManager::install(const QString& fileName, QFileInfo fileInfo(fileName); if (!getSupportedExtensions().contains(fileInfo.suffix(), Qt::CaseInsensitive)) { reportError(tr("File format \"%1\" not supported").arg(fileInfo.suffix())); - return InstallationResult(IPluginInstaller::RESULT_FAILED); + return {IPluginInstaller::RESULT_FAILED}; } modName.setFilter(&fixDirectoryName); @@ -933,7 +933,7 @@ QStringList InstallationManager::getSupportedExtensions() const } } } - return QStringList(supportedExtensions.begin(), supportedExtensions.end()); + return {supportedExtensions.begin(), supportedExtensions.end()}; } void InstallationManager::notifyInstallationStart(QString const& archive, diff --git a/src/src/installationmanager.h b/src/src/installationmanager.h index ee7f216..9e99e9b 100644 --- a/src/src/installationmanager.h +++ b/src/src/installationmanager.h @@ -259,7 +259,7 @@ public: */ InstallationResult testOverwrite(MOBase::GuessedValue& modName); - QString generateBackupName(const QString& directoryName) const; + static QString generateBackupName(const QString& directoryName) ; private: // actually perform the installation (write files to the disk, etc.), returns the diff --git a/src/src/instancemanager.cpp b/src/src/instancemanager.cpp index ae746a9..11a82c0 100644 --- a/src/src/instancemanager.cpp +++ b/src/src/instancemanager.cpp @@ -617,14 +617,14 @@ QString InstanceManager::instancePath(const QString& instanceName) const return QDir::fromNativeSeparators(globalInstancesRootPath() + "/" + instanceName); } -QString InstanceManager::globalInstancesRootPath() const +QString InstanceManager::globalInstancesRootPath() { // Use the shared Fluorine data dir so the path is the same in native and // Flatpak builds (QStandardPaths is remapped inside a Flatpak sandbox). return QDir::fromNativeSeparators(fluorineDataDir()); } -QString InstanceManager::iniPath(const QString& instanceDir) const +QString InstanceManager::iniPath(const QString& instanceDir) { return QDir(instanceDir).filePath(QString::fromStdWString(AppConfig::iniFileName())); } @@ -654,18 +654,18 @@ bool InstanceManager::hasAnyInstances() const return portableInstanceExists() || !globalInstancePaths().empty(); } -QString InstanceManager::portablePath() const +QString InstanceManager::portablePath() { return AppConfig::basePath(); } -bool InstanceManager::portableInstanceExists() const +bool InstanceManager::portableInstanceExists() { return QFile::exists(AppConfig::basePath() + "/" + QString::fromStdWString(AppConfig::iniFileName())); } -bool InstanceManager::allowedToChangeInstance() const +bool InstanceManager::allowedToChangeInstance() { const auto lockFile = qApp->applicationDirPath() + "/" + QString::fromStdWString(AppConfig::portableLockFileName()); @@ -762,7 +762,7 @@ bool InstanceManager::instanceExists(const QString& instanceName) const return root.exists(instanceName); } -QStringList InstanceManager::registeredPortablePaths() const +QStringList InstanceManager::registeredPortablePaths() { return GlobalSettings::portableInstances(); } diff --git a/src/src/instancemanager.h b/src/src/instancemanager.h index c761865..0d3becd 100644 --- a/src/src/instancemanager.h +++ b/src/src/instancemanager.h @@ -264,17 +264,17 @@ public: // sets the instance name in the registry so the same instance is opened next // time MO runs // - void setCurrentInstance(const QString& name); + static void setCurrentInstance(const QString& name); // whether MO should allow the user to change the current instance from the // user interface // - bool allowedToChangeInstance() const; + static bool allowedToChangeInstance() ; // whether a portable instance exists; this basically checks for an INI in // the application directory // - bool portableInstanceExists() const; + static bool portableInstanceExists() ; // whether any instance exists, whether global or portable // @@ -283,12 +283,12 @@ public: // returns the absolute path to the portable instance, regardless of whether // one exists // - QString portablePath() const; + static QString portablePath() ; // returns the absolute path to the directory that contains global instances // (typically AppData/Local/ModOrganizer) // - QString globalInstancesRootPath() const; + static QString globalInstancesRootPath() ; // returns the list of absolute path to all existing global instances; this // does not include the portable instance @@ -315,13 +315,13 @@ public: // returns the absolute path to the INI file for the given instance directory; // the file may not exist // - QString iniPath(const QString& instanceDir) const; + static QString iniPath(const QString& instanceDir) ; // persistent registry of portable instance paths (stored in GlobalSettings) // - QStringList registeredPortablePaths() const; - void registerPortableInstance(const QString& path); - void unregisterPortableInstance(const QString& path); + static QStringList registeredPortablePaths() ; + static void registerPortableInstance(const QString& path); + static void unregisterPortableInstance(const QString& path); private: InstanceManager(); diff --git a/src/src/instancemanagerdialog.cpp b/src/src/instancemanagerdialog.cpp index 1dc42a2..f25645f 100644 --- a/src/src/instancemanagerdialog.cpp +++ b/src/src/instancemanagerdialog.cpp @@ -528,7 +528,7 @@ void InstanceManagerDialog::rename() if (!r) { QMessageBox::critical(this, tr("Error"), - tr("Failed to rename \"%1\" to \"%2\": %3") + tr(R"(Failed to rename "%1" to "%2": %3)") .arg(src) .arg(dest) .arg(r.toString())); diff --git a/src/src/loglist.cpp b/src/src/loglist.cpp index d324f32..72e96a4 100644 --- a/src/src/loglist.cpp +++ b/src/src/loglist.cpp @@ -32,7 +32,7 @@ static std::unique_ptr m_console; static bool m_stdout = false; static std::mutex m_stdoutMutex; -LogModel::LogModel() {} +LogModel::LogModel() = default; void LogModel::create() { @@ -104,7 +104,7 @@ QModelIndex LogModel::index(int row, int column, const QModelIndex&) const QModelIndex LogModel::parent(const QModelIndex&) const { - return QModelIndex(); + return {}; } int LogModel::rowCount(const QModelIndex& parent) const @@ -165,7 +165,7 @@ QVariant LogModel::data(const QModelIndex& index, int role) const } } - return QVariant(); + return {}; } QVariant LogModel::headerData(int, Qt::Orientation, int) const diff --git a/src/src/loglist.h b/src/src/loglist.h index bea56f6..ff94335 100644 --- a/src/src/loglist.h +++ b/src/src/loglist.h @@ -69,9 +69,9 @@ public: void setCore(OrganizerCore& core); - void copyToClipboard(); + static void copyToClipboard(); void clear(); - void openLogsFolder(); + static void openLogsFolder(); QMenu* createMenu(QWidget* parent = nullptr); diff --git a/src/src/mainwindow.cpp b/src/src/mainwindow.cpp index 16e0a0a..cb95026 100644 --- a/src/src/mainwindow.cpp +++ b/src/src/mainwindow.cpp @@ -1164,7 +1164,7 @@ void MainWindow::createHelpMenu() QMenu* tutorialMenu = new QMenu(tr("Tutorials"), menu); - typedef std::vector> ActionList; + using ActionList = std::vector>; ActionList tutorials; @@ -1252,7 +1252,7 @@ void MainWindow::hookUpWindowTutorials() } } -bool MainWindow::shouldStartTutorial() const +bool MainWindow::shouldStartTutorial() { if (GlobalSettings::hideTutorialQuestion()) { return false; @@ -2684,7 +2684,7 @@ void MainWindow::fileMoved(const QString& filePath, const QString& oldOriginName filePtr->removeOrigin(oldOrigin.getID()); } } catch (const std::exception& e) { - reportError(tr("failed to move \"%1\" from mod \"%2\" to \"%3\": %4") + reportError(tr(R"(failed to move "%1" from mod "%2" to "%3": %4)") .arg(filePath) .arg(oldOriginName) .arg(newOriginName) @@ -3930,7 +3930,7 @@ void MainWindow::on_showHiddenBox_toggled(bool checked) const char* MainWindow::PATTERN_BACKUP_GLOB = ".????_??_??_??_??_??"; const char* MainWindow::PATTERN_BACKUP_REGEX = - "\\.(\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d)"; + R"(\.(\d\d\d\d_\d\d_\d\d_\d\d_\d\d_\d\d))"; const char* MainWindow::PATTERN_BACKUP_DATE = "yyyy_MM_dd_hh_mm_ss"; bool MainWindow::createBackup(const QString& filePath, const QDateTime& time) @@ -3992,13 +3992,13 @@ QString MainWindow::queryRestore(const QString& filePath) if (dialog.numChoices() == 0) { QMessageBox::information(this, tr("No Backups"), tr("There are no backups to restore")); - return QString(); + return {}; } if (dialog.exec() == QDialog::Accepted) { return dialog.getChoiceData().toString(); } else { - return QString(); + return {}; } } diff --git a/src/src/mainwindow.h b/src/src/mainwindow.h index f048cb1..20a7286 100644 --- a/src/src/mainwindow.h +++ b/src/src/mainwindow.h @@ -228,7 +228,7 @@ private: void setCategoryListVisible(bool visible); - bool errorReported(QString& logFile); + static bool errorReported(QString& logFile); static void setupNetworkProxy(bool activate); void activateProxy(bool activate); @@ -326,14 +326,14 @@ private: private slots: void updateWindowTitle(const APIUserAccount& user); void showMessage(const QString& message); - void showError(const QString& message); + static void showError(const QString& message); // main window actions - void helpTriggered(); - void issueTriggered(); - void wikiTriggered(); + static void helpTriggered(); + static void issueTriggered(); + static void wikiTriggered(); void gameSupportTriggered(); - void discordTriggered(); + static void discordTriggered(); void tutorialTriggered(); void extractBSATriggered(QTreeWidgetItem* item); @@ -381,7 +381,7 @@ private slots: void nxmTrackedModsAvailable(QVariant userData, QVariant resultData, int); void nxmDownloadURLs(QString, int modID, int fileID, QVariant userData, QVariant resultData, int requestID); - void nxmGameInfoAvailable(QString gameName, QVariant, QVariant resultData, int); + static void nxmGameInfoAvailable(QString gameName, QVariant, QVariant resultData, int); void nxmRequestFailed(QString gameName, int modID, int fileID, QVariant userData, int requestID, int errorCode, const QString& errorString); @@ -389,12 +389,12 @@ private slots: void modRemoved(const QString& fileName); void hookUpWindowTutorials(); - bool shouldStartTutorial() const; + static bool shouldStartTutorial() ; - void openInstanceFolder(); - void openInstallFolder(); - void openPluginsFolder(); - void openStylesheetsFolder(); + static void openInstanceFolder(); + static void openInstallFolder(); + static void openPluginsFolder(); + static void openStylesheetsFolder(); void openDownloadsFolder(); void openModsFolder(); void openProfileFolder(); @@ -447,7 +447,7 @@ private slots: // ui slots void on_actionNotifications_triggered(); void on_actionSettings_triggered(); void on_actionUpdate_triggered(); - void on_actionExit_triggered(); + static void on_actionExit_triggered(); void on_actionMainMenuToggle_triggered(); void on_actionToolBarMainToggle_triggered(); void on_actionStatusBarToggle_triggered(); diff --git a/src/src/moapplication.cpp b/src/src/moapplication.cpp index 99d65fa..f1b6d45 100644 --- a/src/src/moapplication.cpp +++ b/src/src/moapplication.cpp @@ -939,7 +939,7 @@ void MOSplash::close() } QString MOSplash::getSplashPath(const Settings& settings, const QString& dataPath, - const MOBase::IPluginGame* game) const + const MOBase::IPluginGame* game) { if (!settings.useSplash()) { return {}; diff --git a/src/src/moapplication.h b/src/src/moapplication.h index ebe13d8..8487a80 100644 --- a/src/src/moapplication.h +++ b/src/src/moapplication.h @@ -88,9 +88,9 @@ private: std::unique_ptr m_core; void externalMessage(const QString& message); - std::unique_ptr getCurrentInstance(bool forceSelect); - std::optional setupInstanceLoop(Instance& currentInstance, PluginContainer& pc); - void purgeOldFiles(); + static std::unique_ptr getCurrentInstance(bool forceSelect); + static std::optional setupInstanceLoop(Instance& currentInstance, PluginContainer& pc); + static void purgeOldFiles(); }; class MOSplash @@ -104,8 +104,8 @@ public: private: std::unique_ptr ss_; - QString getSplashPath(const Settings& settings, const QString& dataPath, - const MOBase::IPluginGame* game) const; + static QString getSplashPath(const Settings& settings, const QString& dataPath, + const MOBase::IPluginGame* game) ; }; #endif // MOAPPLICATION_H diff --git a/src/src/modconflicticondelegate.cpp b/src/src/modconflicticondelegate.cpp index 1aaa06b..70c6d92 100644 --- a/src/src/modconflicticondelegate.cpp +++ b/src/src/modconflicticondelegate.cpp @@ -112,10 +112,10 @@ QString ModConflictIconDelegate::getFlagIcon(ModInfo::EConflictFlag flag) case ModInfo::FLAG_ARCHIVE_CONFLICT_OVERWRITTEN: return QStringLiteral(":/MO/gui/archive_conflict_loser"); case ModInfo::FLAG_OVERWRITE_CONFLICT: - return QString(); + return {}; default: log::warn("ModInfo flag {} has no defined icon", flag); - return QString(); + return {}; } } diff --git a/src/src/modelutils.cpp b/src/src/modelutils.cpp index fa87eb0..9bbc398 100644 --- a/src/src/modelutils.cpp +++ b/src/src/modelutils.cpp @@ -50,7 +50,7 @@ QModelIndex indexModelToView(const QModelIndex& index, const QAbstractItemView* } if (proxies.empty() || proxies.back()->sourceModel() != index.model()) { - return QModelIndex(); + return {}; } auto qindex = index; @@ -78,7 +78,7 @@ QModelIndex indexViewToModel(const QModelIndex& index, const QAbstractItemModel* } else if (auto* proxy = qobject_cast(index.model())) { return indexViewToModel(proxy->mapToSource(index), model); } else { - return QModelIndex(); + return {}; } } diff --git a/src/src/modflagicondelegate.cpp b/src/src/modflagicondelegate.cpp index 06601a9..842b90e 100644 --- a/src/src/modflagicondelegate.cpp +++ b/src/src/modflagicondelegate.cpp @@ -57,18 +57,18 @@ QString ModFlagIconDelegate::getFlagIcon(ModInfo::EFlag flag) case ModInfo::FLAG_ALTERNATE_GAME: return QStringLiteral(":/MO/gui/alternate_game"); case ModInfo::FLAG_FOREIGN: - return QString(); + return {}; case ModInfo::FLAG_SEPARATOR: - return QString(); + return {}; case ModInfo::FLAG_OVERWRITE: - return QString(); + return {}; case ModInfo::FLAG_PLUGIN_SELECTED: - return QString(); + return {}; case ModInfo::FLAG_TRACKED: return QStringLiteral(":/MO/gui/tracked"); default: log::warn("ModInfo flag {} has no defined icon", flag); - return QString(); + return {}; } } diff --git a/src/src/modinfo.cpp b/src/src/modinfo.cpp index 340794c..69cbd25 100644 --- a/src/src/modinfo.cpp +++ b/src/src/modinfo.cpp @@ -152,7 +152,7 @@ std::vector ModInfo::getByModID(QString game, int modID) } } if (match.empty()) { - return std::vector(); + return {}; } std::vector result; diff --git a/src/src/modinfo.h b/src/src/modinfo.h index 6133e5a..da5261b 100644 --- a/src/src/modinfo.h +++ b/src/src/modinfo.h @@ -63,7 +63,7 @@ class ModInfo : public QObject, public MOBase::IModInterface Q_OBJECT public: // Type definitions: - typedef QSharedPointer Ptr; + using Ptr = QSharedPointer; static QString s_HiddenExt; @@ -333,7 +333,7 @@ public: // IModInterface implementations / Re-declaration /** * @return the color of the 'Notes' column chosen by the user. */ - QColor color() const override { return QColor(); } + QColor color() const override { return {}; } /** * @return the URL of this mod, or an empty QString() if no URL is associated @@ -748,7 +748,7 @@ public: // Methods after this do not come from IModInterface: * @return the list of files that, if they exist in the data directory are treated as * files in THIS mod. */ - virtual QStringList stealFiles() const { return QStringList(); } + virtual QStringList stealFiles() const { return {}; } /** * @return the list of archives belonging to this mod (as absolute file paths). diff --git a/src/src/modinfobackup.h b/src/src/modinfobackup.h index 917314d..e5d9c20 100644 --- a/src/src/modinfobackup.h +++ b/src/src/modinfobackup.h @@ -21,30 +21,30 @@ public: void ignoreUpdate(bool) override {} bool alwaysDisabled() const override { return true; } bool canBeUpdated() const override { return false; } - QDateTime getExpires() const override { return QDateTime(); } + QDateTime getExpires() const override { return {}; } bool canBeEnabled() const override { return false; } std::vector getIniTweaks() const override { - return std::vector(); + return {}; } 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(); } + QDateTime getLastNexusQuery() const override { return {}; } void setLastNexusQuery(QDateTime) override {} - QDateTime getLastNexusUpdate() const override { return QDateTime(); } + QDateTime getLastNexusUpdate() const override { return {}; } void setLastNexusUpdate(QDateTime) override {} - QDateTime getNexusLastModified() const override { return QDateTime(); } + QDateTime getNexusLastModified() const override { return {}; } void setNexusLastModified(QDateTime) override {} - QString getNexusDescription() const override { return QString(); } + QString getNexusDescription() const override { return {}; } void setNexusCategory(int) override {} int getNexusCategory() const override { return 0; } - QString author() const override { return QString(); } + QString author() const override { return {}; } void setAuthor(const QString&) override {} - QString uploader() const override { return QString(); } + QString uploader() const override { return {}; } void setUploader(const QString&) override {} - QString uploaderUrl() const override { return QString(); } + QString uploaderUrl() const override { return {}; } void setUploaderUrl(const QString&) override {} bool isBackup() const override { return true; } diff --git a/src/src/modinfodialogconflicts.cpp b/src/src/modinfodialogconflicts.cpp index 27f85b4..ee6e461 100644 --- a/src/src/modinfodialogconflicts.cpp +++ b/src/src/modinfodialogconflicts.cpp @@ -727,16 +727,16 @@ ConflictItem GeneralConflictsTab::createOverwriteItem( auto origin = ToQString(ds.getOriginByID(alternatives.back().originID()).getName()); - return ConflictItem(ToQString(altString), std::move(relativeName), QString(), index, - std::move(fileName), true, std::move(origin), archive); + return {ToQString(altString), std::move(relativeName), QString(), index, + std::move(fileName), true, std::move(origin), archive}; } ConflictItem GeneralConflictsTab::createNoConflictItem(FileIndex index, bool archive, QString fileName, QString relativeName) { - return ConflictItem(QString(), std::move(relativeName), QString(), index, - std::move(fileName), false, QString(), archive); + return {QString(), std::move(relativeName), QString(), index, + std::move(fileName), false, QString(), archive}; } ConflictItem GeneralConflictsTab::createOverwrittenItem(FileIndex index, int fileOrigin, @@ -749,8 +749,8 @@ ConflictItem GeneralConflictsTab::createOverwrittenItem(FileIndex index, int fil QString after = ToQString(realOrigin.getName()); QString altOrigin = after; - return ConflictItem(QString(), std::move(relativeName), std::move(after), index, - std::move(fileName), true, std::move(altOrigin), archive); + return {QString(), std::move(relativeName), std::move(after), index, + std::move(fileName), true, std::move(altOrigin), archive}; } QString percent(int a, int b) diff --git a/src/src/modinfodialogconflicts.h b/src/src/modinfodialogconflicts.h index ea86905..01f9be4 100644 --- a/src/src/modinfodialogconflicts.h +++ b/src/src/modinfodialogconflicts.h @@ -74,7 +74,7 @@ private: QString fileName, QString relativeName, const MOShared::AlternativesVector& alternatives); - ConflictItem createNoConflictItem(MOShared::FileIndex index, bool archive, + static ConflictItem createNoConflictItem(MOShared::FileIndex index, bool archive, QString fileName, QString relativeName); ConflictItem createOverwrittenItem(MOShared::FileIndex index, int fileOrigin, @@ -131,7 +131,7 @@ public: void activateItems(QTreeView* tree); void openItems(QTreeView* tree, bool hooked); void previewItems(QTreeView* tree); - void exploreItems(QTreeView* tree); + static void exploreItems(QTreeView* tree); void openItem(const ConflictItem* item, bool hooked); void previewItem(const ConflictItem* item); diff --git a/src/src/modinfodialogesps.h b/src/src/modinfodialogesps.h index 5b27866..d0bb981 100644 --- a/src/src/modinfodialogesps.h +++ b/src/src/modinfodialogesps.h @@ -25,7 +25,7 @@ private: void onActivate(); void onDeactivate(); - void selectRow(QListView* list, int row); + static void selectRow(QListView* list, int row); }; #endif // MODINFODIALOGESPS_H diff --git a/src/src/modinfodialogfwd.h b/src/src/modinfodialogfwd.h index 46ee1ab..107724e 100644 --- a/src/src/modinfodialogfwd.h +++ b/src/src/modinfodialogfwd.h @@ -11,14 +11,14 @@ enum class ModInfoTabIDs { None = -1, TextFiles = 0, - IniFiles, - Images, - Esps, - Conflicts, - Categories, - Nexus, - Notes, - Filetree + IniFiles = 1, + Images = 2, + Esps = 3, + Conflicts = 4, + Categories = 5, + Nexus = 6, + Notes = 7, + Filetree = 8 }; class PluginContainer; diff --git a/src/src/modinfodialogimages.cpp b/src/src/modinfodialogimages.cpp index 53038a1..0bdfd95 100644 --- a/src/src/modinfodialogimages.cpp +++ b/src/src/modinfodialogimages.cpp @@ -21,9 +21,9 @@ QSize resizeWithAspectRatio(const QSize& original, const QSize& available) QRect centeredRect(const QRect& rect, const QSize& size) { - return QRect((rect.left() + rect.width() / 2) - size.width() / 2, + return {(rect.left() + rect.width() / 2) - size.width() / 2, (rect.top() + rect.height() / 2) - size.height() / 2, size.width(), - size.height()); + size.height()}; } QString dimensionString(const QSize& s) @@ -392,7 +392,7 @@ const File* ImagesTab::fileAtPos(const QPoint& p) const Geometry ImagesTab::makeGeometry() const { - return Geometry(ui->imagesThumbnails->size(), m_metrics); + return {ui->imagesThumbnails->size(), m_metrics}; } void ImagesTab::paintThumbnailsArea(QPaintEvent* e) @@ -436,7 +436,7 @@ void ImagesTab::paintThumbnailBackground(const PaintContext& cx) } } -void ImagesTab::paintThumbnailBorder(const PaintContext& cx) +void ImagesTab::paintThumbnailBorder(const PaintContext& cx) const { auto borderRect = cx.geo.borderRect(cx.thumbIndex); @@ -449,7 +449,7 @@ void ImagesTab::paintThumbnailBorder(const PaintContext& cx) cx.painter.drawRect(borderRect); } -void ImagesTab::paintThumbnailImage(const PaintContext& cx) +void ImagesTab::paintThumbnailImage(const PaintContext& cx) const { if (cx.file->failed()) { return; @@ -780,7 +780,7 @@ void ScalableImage::paintEvent(QPaintEvent* e) Metrics::Metrics() -{} += default; Geometry::Geometry(QSize widgetSize, Metrics metrics) : m_widgetSize(widgetSize), m_metrics(metrics), m_topRect(calcTopRect()) @@ -851,8 +851,8 @@ QRect Geometry::textRect(std::size_t i) const { const auto r = borderRect(i); - return QRect(r.left(), r.bottom() + m_metrics.textSpacing, r.width(), - m_metrics.textHeight); + return {r.left(), r.bottom() + m_metrics.textSpacing, r.width(), + m_metrics.textHeight}; } QRect Geometry::selectionRect(std::size_t i) const @@ -860,7 +860,7 @@ QRect Geometry::selectionRect(std::size_t i) const const auto br = borderRect(i); const auto tr = textRect(i); - return QRect(br.left(), br.top(), br.width(), tr.bottom() - br.top()); + return {br.left(), br.top(), br.width(), tr.bottom() - br.top()}; } std::size_t Geometry::indexAt(const QPoint& p) const diff --git a/src/src/modinfodialogimages.h b/src/src/modinfodialogimages.h index 2069212..3be96c4 100644 --- a/src/src/modinfodialogimages.h +++ b/src/src/modinfodialogimages.h @@ -367,8 +367,8 @@ private: void paintThumbnail(const PaintContext& cx); void paintThumbnailBackground(const PaintContext& cx); - void paintThumbnailBorder(const PaintContext& cx); - void paintThumbnailImage(const PaintContext& cx); + void paintThumbnailBorder(const PaintContext& cx) const; + void paintThumbnailImage(const PaintContext& cx) const; void paintThumbnailText(const PaintContext& cx); void checkFiltering(); diff --git a/src/src/modinfoforeign.h b/src/src/modinfoforeign.h index 580f719..e587a37 100644 --- a/src/src/modinfoforeign.h +++ b/src/src/modinfoforeign.h @@ -48,30 +48,30 @@ public: QString gameName() const override { return ""; } int nexusId() const override { return -1; } bool isForeign() const override { return true; } - QDateTime getExpires() const override { return QDateTime(); } + QDateTime getExpires() const override { return {}; } std::vector getIniTweaks() const override { - return std::vector(); + return {}; } 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(); } + QDateTime getLastNexusUpdate() const override { return {}; } void setLastNexusUpdate(QDateTime) override {} int getNexusCategory() const override { return 0; } void setNexusCategory(int) override {} - QDateTime getLastNexusQuery() const override { return QDateTime(); } + QDateTime getLastNexusQuery() const override { return {}; } void setLastNexusQuery(QDateTime) override {} - QDateTime getNexusLastModified() const override { return QDateTime(); } + QDateTime getNexusLastModified() const override { return {}; } void setNexusLastModified(QDateTime) override {} - QString getNexusDescription() const override { return QString(); } - QString author() const override { return QString(); } + QString getNexusDescription() const override { return {}; } + QString author() const override { return {}; } void setAuthor(const QString&) override {} - QString uploader() const override { return QString(); } + QString uploader() const override { return {}; } void setUploader(const QString&) override {} - QString uploaderUrl() const override { return QString(); } + QString uploaderUrl() const override { return {}; } void setUploaderUrl(const QString&) override {} QStringList archives(bool = false) override { return m_Archives; } QStringList stealFiles() const override diff --git a/src/src/modinfooverwrite.h b/src/src/modinfooverwrite.h index 919f00d..15422be 100644 --- a/src/src/modinfooverwrite.h +++ b/src/src/modinfooverwrite.h @@ -40,7 +40,7 @@ public: QString name() const override { return "Overwrite"; } QString comments() const override { return ""; } QString notes() const override { return ""; } - QDateTime creationTime() const override { return QDateTime(); } + QDateTime creationTime() const override { return {}; } QString absolutePath() const override; MOBase::VersionInfo newestVersion() const override { return QString(); } MOBase::VersionInfo ignoredVersion() const override { return QString(); } @@ -50,10 +50,10 @@ public: QString gameName() const override { return ""; } int nexusId() const override { return -1; } bool isOverwrite() const override { return true; } - QDateTime getExpires() const override { return QDateTime(); } + QDateTime getExpires() const override { return {}; } std::vector getIniTweaks() const override { - return std::vector(); + return {}; } std::vector getFlags() const override; std::vector getConflictFlags() const override; @@ -61,20 +61,20 @@ public: QString getDescription() const override; int getNexusFileStatus() const override { return 0; } void setNexusFileStatus(int) override {} - QDateTime getLastNexusUpdate() const override { return QDateTime(); } + QDateTime getLastNexusUpdate() const override { return {}; } void setLastNexusUpdate(QDateTime) override {} - QDateTime getLastNexusQuery() const override { return QDateTime(); } + QDateTime getLastNexusQuery() const override { return {}; } void setLastNexusQuery(QDateTime) override {} - QDateTime getNexusLastModified() const override { return QDateTime(); } + QDateTime getNexusLastModified() const override { return {}; } void setNexusLastModified(QDateTime) override {} - QString getNexusDescription() const override { return QString(); } + QString getNexusDescription() const override { return {}; } void setNexusCategory(int) override {} int getNexusCategory() const override { return 0; } - QString author() const override { return QString(); } + QString author() const override { return {}; } void setAuthor(const QString&) override {} - QString uploader() const override { return QString(); } + QString uploader() const override { return {}; } void setUploader(const QString&) override {} - QString uploaderUrl() const override { return QString(); } + QString uploaderUrl() const override { return {}; } void setUploaderUrl(const QString&) override {} QStringList archives(bool checkOnDisk = false) override; void addInstalledFile(int, int) override {} diff --git a/src/src/modinforegular.cpp b/src/src/modinforegular.cpp index 49204f0..dc85e10 100644 --- a/src/src/modinforegular.cpp +++ b/src/src/modinforegular.cpp @@ -745,7 +745,7 @@ std::set ModInfoRegular::doGetContents() const if (contentFeature) { auto result = contentFeature->getContentsFor(fileTree()); - return std::set(std::begin(result), std::end(result)); + return {std::begin(result), std::end(result)}; } return {}; @@ -771,7 +771,7 @@ QString ModInfoRegular::getDescription() const } else { const std::set& categories = getCategories(); if (categories.empty()) { - return QString(); + return {}; } std::wostringstream categoryString; categoryString << ToWString(tr("Categories:
    ")); diff --git a/src/src/modinforegular.h b/src/src/modinforegular.h index fb801fe..e492332 100644 --- a/src/src/modinforegular.h +++ b/src/src/modinforegular.h @@ -27,9 +27,9 @@ public: bool isEmpty() const override; - bool isAlternate() { return m_IsAlternate; } - bool isConverted() { return m_Converted; } - bool isValidated() { return m_Validated; } + bool isAlternate() const { return m_IsAlternate; } + bool isConverted() const { return m_Converted; } + bool isValidated() const { return m_Validated; } /** * @brief test if there is a newer version of the mod diff --git a/src/src/modinfoseparator.h b/src/src/modinfoseparator.h index 513f3e8..dea18c1 100644 --- a/src/src/modinfoseparator.h +++ b/src/src/modinfoseparator.h @@ -24,11 +24,11 @@ public: void endorse(bool /*doEndorse*/) override {} void ignoreUpdate(bool /*ignore*/) override {} bool canBeUpdated() const override { return false; } - QDateTime getExpires() const override { return QDateTime(); } + QDateTime getExpires() const override { return {}; } bool canBeEnabled() const override { return false; } std::vector getIniTweaks() const override { - return std::vector(); + return {}; } std::vector getFlags() const override; int getHighlight() const override; @@ -39,21 +39,21 @@ public: QString repository() const override { return ""; } int getNexusFileStatus() const override { return 0; } void setNexusFileStatus(int) override {} - QDateTime getLastNexusUpdate() const override { return QDateTime(); } + QDateTime getLastNexusUpdate() const override { return {}; } void setLastNexusUpdate(QDateTime) override {} - QDateTime getLastNexusQuery() const override { return QDateTime(); } + QDateTime getLastNexusQuery() const override { return {}; } void setLastNexusQuery(QDateTime) override {} - QDateTime getNexusLastModified() const override { return QDateTime(); } + QDateTime getNexusLastModified() const override { return {}; } 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(); } + QDateTime creationTime() const override { return {}; } + QString getNexusDescription() const override { return {}; } + QString author() const override { return {}; } void setAuthor(const QString&) override {} - QString uploader() const override { return QString(); } + QString uploader() const override { return {}; } void setUploader(const QString&) override {} - QString uploaderUrl() const override { return QString(); } + QString uploaderUrl() const override { return {}; } void setUploaderUrl(const QString&) override {} void addInstalledFile(int /*modId*/, int /*fileId*/) override {} bool isSeparator() const override { return true; } diff --git a/src/src/modlist.cpp b/src/src/modlist.cpp index def83e6..8faaaad 100644 --- a/src/src/modlist.cpp +++ b/src/src/modlist.cpp @@ -104,7 +104,7 @@ int ModList::columnCount(const QModelIndex&) const return COL_LASTCOLUMN + 1; } -QString ModList::getDisplayName(ModInfo::Ptr info) const +QString ModList::getDisplayName(ModInfo::Ptr info) { QString name = info->name(); if (info->isSeparator()) { @@ -113,7 +113,7 @@ QString ModList::getDisplayName(ModInfo::Ptr info) const return name; } -QString ModList::makeInternalName(ModInfo::Ptr info, QString name) const +QString ModList::makeInternalName(ModInfo::Ptr info, QString name) { if (info->isSeparator()) { name += "_separator"; @@ -121,7 +121,7 @@ QString ModList::makeInternalName(ModInfo::Ptr info, QString name) const return name; } -QString ModList::getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) const +QString ModList::getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) { switch (flag) { case ModInfo::FLAG_BACKUP: @@ -153,7 +153,7 @@ QString ModList::getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) const } QString ModList::getConflictFlagText(ModInfo::EConflictFlag flag, - ModInfo::Ptr modInfo) const + ModInfo::Ptr modInfo) { switch (flag) { case ModInfo::FLAG_CONFLICT_OVERWRITE: @@ -182,9 +182,9 @@ QString ModList::getConflictFlagText(ModInfo::EConflictFlag flag, QVariant ModList::data(const QModelIndex& modelIndex, int role) const { if (m_Profile == nullptr) - return QVariant(); + return {}; if (!modelIndex.isValid()) - return QVariant(); + return {}; unsigned int modIndex = modelIndex.row(); int column = modelIndex.column(); @@ -192,7 +192,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const if ((role == Qt::DisplayRole) || (role == Qt::EditRole)) { if ((column == COL_FLAGS) || (column == COL_CONTENT) || (column == COL_CONFLICTFLAGS)) { - return QVariant(); + return {}; } else if (column == COL_NAME) { return getDisplayName(modInfo); } else if (column == COL_VERSION) { @@ -206,7 +206,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const return version; } else if (column == COL_PRIORITY) { if (modInfo->hasAutomaticPriority()) { - return QVariant(); // hide priority for mods where it's fixed + return {}; // hide priority for mods where it's fixed } else { return QString::number(m_Profile->getModPriority(modIndex)); } @@ -215,7 +215,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const if (modID > 0) { return modID; } else { - return QVariant(); + return {}; } } else if (column == COL_GAME) { if (m_PluginContainer != nullptr) { @@ -247,7 +247,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const return QString(); } } else { - return QVariant(); + return {}; } } } else if (column == COL_AUTHOR) { @@ -259,7 +259,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const if (modInfo->creationTime().isValid()) { return modInfo->creationTime(); } else { - return QVariant(); + return {}; } } else if (column == COL_NOTES) { return modInfo->comments(); @@ -270,21 +270,21 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const if (modInfo->canBeEnabled()) { return m_Profile->modEnabled(modIndex) ? Qt::Checked : Qt::Unchecked; } else { - return QVariant(); + return {}; } } else if (role == Qt::TextAlignmentRole) { if (column == COL_NAME) { if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_CENTER) { - return QVariant(Qt::AlignCenter | Qt::AlignVCenter); + return {Qt::AlignCenter | Qt::AlignVCenter}; } else { - return QVariant(Qt::AlignLeft | Qt::AlignVCenter); + return {Qt::AlignLeft | Qt::AlignVCenter}; } } else if (column == COL_VERSION) { - return QVariant(Qt::AlignRight | Qt::AlignVCenter); + return {Qt::AlignRight | Qt::AlignVCenter}; } else if (column == COL_NOTES) { - return QVariant(Qt::AlignLeft | Qt::AlignVCenter); + return {Qt::AlignLeft | Qt::AlignVCenter}; } else { - return QVariant(Qt::AlignCenter | Qt::AlignVCenter); + return {Qt::AlignCenter | Qt::AlignVCenter}; } } else if (role == GroupingRole) { if (column == COL_CATEGORY) { @@ -298,7 +298,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const if (categoryNames.count() != 0) { return categoryNames; } else { - return QVariant(); + return {}; } } else { return modInfo->nexusId(); @@ -352,7 +352,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const return QIcon(":/MO/gui/version_date"); } } - return QVariant(); + return {}; } else if (role == Qt::ForegroundRole) { if (column == COL_NAME) { int highlight = modInfo->getHighlight(); @@ -363,14 +363,14 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const } } else if (column == COL_VERSION) { if (!modInfo->newestVersion().isValid()) { - return QVariant(); + return {}; } else if (modInfo->updateAvailable() || modInfo->downgradeAvailable()) { return QBrush(Qt::red); } else { return QBrush(Qt::darkGreen); } } - return QVariant(); + return {}; } else if (role == Qt::BackgroundRole || role == ScrollMarkRole) { if (column == COL_NOTES && modInfo->color().isValid()) { return modInfo->color(); @@ -379,7 +379,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const Settings::instance().colors().colorSeparatorScrollbar())) { return modInfo->color(); } else { - return QVariant(); + return {}; } } else if (role == Qt::ToolTipRole) { if (column == COL_FLAGS) { @@ -410,7 +410,7 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const return QString(); } } else if (column == COL_VERSION) { - QString text = tr("installed version: \"%1\", newest version: \"%2\"") + QString text = tr(R"(installed version: "%1", newest version: "%2")") .arg(modInfo->version().displayString(3)) .arg(modInfo->newestVersion().displayString(3)); if (modInfo->downgradeAvailable()) { @@ -475,10 +475,10 @@ QVariant ModList::data(const QModelIndex& modelIndex, int role) const } else if (column == COL_NOTES) { return getFlagText(ModInfo::FLAG_NOTES, modInfo); } else { - return QVariant(); + return {}; } } else { - return QVariant(); + return {}; } } @@ -606,7 +606,7 @@ QVariant ModList::headerData(int section, Qt::Orientation orientation, int role) } else if (role == Qt::ToolTipRole) { return getColumnToolTip(section); } else if (role == Qt::TextAlignmentRole) { - return QVariant(Qt::AlignCenter); + return {Qt::AlignCenter}; } else if (role == MOBase::EnabledColumnRole) { if (section == COL_CONTENT) { return !m_Organizer->modDataContents().empty(); @@ -830,7 +830,7 @@ IModList::ModStates ModList::state(unsigned int modIndex) const return result; } -QString ModList::displayName(const QString& internalName) const +QString ModList::displayName(const QString& internalName) { unsigned int modIndex = ModInfo::getIndex(internalName); if (modIndex == UINT_MAX) { @@ -841,7 +841,7 @@ QString ModList::displayName(const QString& internalName) const } } -QStringList ModList::allMods() const +QStringList ModList::allMods() { QStringList result; for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) { @@ -865,13 +865,13 @@ QStringList ModList::allModsByProfilePriority(MOBase::IProfile* profile) const return res; } -MOBase::IModInterface* ModList::getMod(const QString& name) const +MOBase::IModInterface* ModList::getMod(const QString& name) { unsigned int index = ModInfo::getIndex(name); return index == UINT_MAX ? nullptr : ModInfo::getByIndex(index).data(); } -bool ModList::removeMod(MOBase::IModInterface* mod) +bool ModList::removeMod(MOBase::IModInterface* mod) const { bool result = ModInfo::removeMod(ModInfo::getIndex(mod->name())); if (result) { @@ -1319,7 +1319,7 @@ void ModList::notifyChange(int rowStart, int rowEnd) QModelIndex ModList::index(int row, int column, const QModelIndex&) const { if ((row < 0) || (row >= rowCount()) || (column < 0) || (column >= columnCount())) { - return QModelIndex(); + return {}; } QModelIndex res = createIndex(row, column, row); return res; @@ -1327,7 +1327,7 @@ QModelIndex ModList::index(int row, int column, const QModelIndex&) const QModelIndex ModList::parent(const QModelIndex&) const { - return QModelIndex(); + return {}; } QMap ModList::itemData(const QModelIndex& index) const @@ -1401,7 +1401,7 @@ QString ModList::getColumnToolTip(int column) const case COL_CONTENT: { auto& contents = m_Organizer->modDataContents(); if (m_Organizer->modDataContents().empty()) { - return QString(); + return {}; } QString result = tr("Depicts the content of the mod:") + "
    " + ""; diff --git a/src/src/modlist.h b/src/src/modlist.h index f1d0e30..663a715 100644 --- a/src/src/modlist.h +++ b/src/src/modlist.h @@ -80,19 +80,19 @@ public: enum EColumn { - COL_NAME, - COL_CONFLICTFLAGS, - COL_FLAGS, - COL_CONTENT, - COL_CATEGORY, - COL_AUTHOR, - COL_UPLOADER, - COL_MODID, - COL_GAME, - COL_VERSION, - COL_INSTALLTIME, - COL_PRIORITY, - COL_NOTES, + COL_NAME = 0, + COL_CONFLICTFLAGS = 1, + COL_FLAGS = 2, + COL_CONTENT = 3, + COL_CATEGORY = 4, + COL_AUTHOR = 5, + COL_UPLOADER = 6, + COL_MODID = 7, + COL_GAME = 8, + COL_VERSION = 9, + COL_INSTALLTIME = 10, + COL_PRIORITY = 11, + COL_NOTES = 12, COL_LASTCOLUMN = COL_NOTES, }; @@ -174,17 +174,17 @@ public: public: /// \copydoc MOBase::IModList::displayName - QString displayName(const QString& internalName) const; + static QString displayName(const QString& internalName) ; /// \copydoc MOBase::IModList::allMods - QStringList allMods() const; + static QStringList allMods() ; QStringList allModsByProfilePriority(MOBase::IProfile* profile = nullptr) const; // \copydoc MOBase::IModList::getMod - MOBase::IModInterface* getMod(const QString& name) const; + static MOBase::IModInterface* getMod(const QString& name) ; // \copydoc MOBase::IModList::remove - bool removeMod(MOBase::IModInterface* mod); + bool removeMod(MOBase::IModInterface* mod) const; // \copydoc MOBase::IModList::renameMod MOBase::IModInterface* renameMod(MOBase::IModInterface* mod, const QString& name); @@ -352,12 +352,12 @@ private: // retrieve the display name of a mod or convert from a user-provided // name to internal name // - QString getDisplayName(ModInfo::Ptr info) const; - QString makeInternalName(ModInfo::Ptr info, QString name) const; + static QString getDisplayName(ModInfo::Ptr info) ; + static QString makeInternalName(ModInfo::Ptr info, QString name) ; - QString getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) const; + static QString getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) ; - QString getConflictFlagText(ModInfo::EConflictFlag flag, ModInfo::Ptr modInfo) const; + static QString getConflictFlagText(ModInfo::EConflictFlag flag, ModInfo::Ptr modInfo) ; QString getColumnToolTip(int column) const; diff --git a/src/src/modlistbypriorityproxy.cpp b/src/src/modlistbypriorityproxy.cpp index 9bbbf09..d3f31dc 100644 --- a/src/src/modlistbypriorityproxy.cpp +++ b/src/src/modlistbypriorityproxy.cpp @@ -12,7 +12,7 @@ ModListByPriorityProxy::ModListByPriorityProxy(Profile* profile, OrganizerCore& : QAbstractProxyModel(parent), m_core(core), m_profile(profile) {} -ModListByPriorityProxy::~ModListByPriorityProxy() {} +ModListByPriorityProxy::~ModListByPriorityProxy() = default; void ModListByPriorityProxy::setSourceModel(QAbstractItemModel* model) { @@ -167,7 +167,7 @@ void ModListByPriorityProxy::onModelDataChanged(const QModelIndex& topLeft, QModelIndex ModListByPriorityProxy::mapFromSource(const QModelIndex& sourceIndex) const { if (!sourceIndex.isValid()) { - return QModelIndex(); + return {}; } auto* item = m_IndexToItem.at(sourceIndex.row()).get(); @@ -177,7 +177,7 @@ QModelIndex ModListByPriorityProxy::mapFromSource(const QModelIndex& sourceIndex QModelIndex ModListByPriorityProxy::mapToSource(const QModelIndex& proxyIndex) const { if (!proxyIndex.isValid()) { - return QModelIndex(); + return {}; } auto* item = static_cast(proxyIndex.internalPointer()); @@ -207,13 +207,13 @@ int ModListByPriorityProxy::columnCount(const QModelIndex& index) const QModelIndex ModListByPriorityProxy::parent(const QModelIndex& child) const { if (!child.isValid()) { - return QModelIndex(); + return {}; } auto* item = static_cast(child.internalPointer()); if (!item->parent || item->parent == &m_Root) { - return QModelIndex(); + return {}; } return createIndex(item->parent->parent->childIndex(item->parent), 0, item->parent); @@ -395,7 +395,7 @@ QModelIndex ModListByPriorityProxy::index(int row, int column, const QModelIndex& parent) const { if (!hasIndex(row, column, parent)) { - return QModelIndex(); + return {}; } const TreeItem* parentItem; diff --git a/src/src/modlistdropinfo.cpp b/src/src/modlistdropinfo.cpp index 0941c00..aee77a6 100644 --- a/src/src/modlistdropinfo.cpp +++ b/src/src/modlistdropinfo.cpp @@ -64,7 +64,7 @@ ModListDropInfo::ModListDropInfo(const QMimeData* mimeData, OrganizerCore& core) } std::optional -ModListDropInfo::relativeUrl(const QUrl& url) const +ModListDropInfo::relativeUrl(const QUrl& url) { if (!url.isLocalFile()) { return {}; diff --git a/src/src/modlistdropinfo.h b/src/src/modlistdropinfo.h index d614f53..b0f6cb4 100644 --- a/src/src/modlistdropinfo.h +++ b/src/src/modlistdropinfo.h @@ -72,7 +72,7 @@ private: // retrieve the relative path of file and its origin given a URL from Mime data // returns an empty optional if the URL is not a valid file for dropping // - std::optional relativeUrl(const QUrl&) const; + static std::optional relativeUrl(const QUrl&) ; private: // rows for drag&drop between views diff --git a/src/src/modlistsortproxy.cpp b/src/src/modlistsortproxy.cpp index 6a1df60..69ca875 100644 --- a/src/src/modlistsortproxy.cpp +++ b/src/src/modlistsortproxy.cpp @@ -81,7 +81,7 @@ void ModListSortProxy::setCriteria(const std::vector& criteria) } } -unsigned long ModListSortProxy::flagsId(const std::vector& flags) const +unsigned long ModListSortProxy::flagsId(const std::vector& flags) { unsigned long result = 0; for (ModInfo::EFlag flag : flags) { @@ -93,7 +93,7 @@ unsigned long ModListSortProxy::flagsId(const std::vector& flags } unsigned long ModListSortProxy::conflictFlagsId( - const std::vector& flags) const + const std::vector& flags) { unsigned long result = 0; for (ModInfo::EConflictFlag flag : flags) { @@ -272,7 +272,7 @@ void ModListSortProxy::updateFilter(const QString& filter) } bool ModListSortProxy::hasConflictFlag( - const std::vector& flags) const + const std::vector& flags) { for (ModInfo::EConflictFlag flag : flags) { if ((flag == ModInfo::FLAG_CONFLICT_MIXED) || @@ -318,7 +318,7 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const return true; } -bool ModListSortProxy::optionsMatchMod(ModInfo::Ptr info, bool) const +bool ModListSortProxy::optionsMatchMod(ModInfo::Ptr info, bool) { return true; } @@ -430,7 +430,7 @@ bool ModListSortProxy::categoryMatchesMod(ModInfo::Ptr info, bool enabled, } bool ModListSortProxy::contentMatchesMod(ModInfo::Ptr info, bool enabled, - int content) const + int content) { return info->hasContent(content); } diff --git a/src/src/modlistsortproxy.h b/src/src/modlistsortproxy.h index b41cf37..acc9d29 100644 --- a/src/src/modlistsortproxy.h +++ b/src/src/modlistsortproxy.h @@ -129,9 +129,9 @@ protected: private: void refreshFilter(); - unsigned long flagsId(const std::vector& flags) const; - unsigned long conflictFlagsId(const std::vector& flags) const; - bool hasConflictFlag(const std::vector& flags) const; + static unsigned long flagsId(const std::vector& flags) ; + static unsigned long conflictFlagsId(const std::vector& flags) ; + static bool hasConflictFlag(const std::vector& flags) ; void updateFilterActive(); bool filterMatchesModAnd(ModInfo::Ptr info, bool enabled) const; bool filterMatchesModOr(ModInfo::Ptr info, bool enabled) const; @@ -159,10 +159,10 @@ private: std::vector m_PreChangeCriteria; - bool optionsMatchMod(ModInfo::Ptr info, bool enabled) const; + static bool optionsMatchMod(ModInfo::Ptr info, bool enabled) ; bool criteriaMatchMod(ModInfo::Ptr info, bool enabled, const Criteria& c) const; bool categoryMatchesMod(ModInfo::Ptr info, bool enabled, int category) const; - bool contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const; + static bool contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) ; }; #endif // MODLISTSORTPROXY_H diff --git a/src/src/modlistview.cpp b/src/src/modlistview.cpp index aa74f81..4b12ea5 100644 --- a/src/src/modlistview.cpp +++ b/src/src/modlistview.cpp @@ -297,19 +297,19 @@ std::optional ModListView::prevMod(unsigned int modIndex) const return {}; } -void ModListView::invalidateFilter() +void ModListView::invalidateFilter() const { m_sortProxy->invalidate(); } void ModListView::setFilterCriteria( - const std::vector& criteria) + const std::vector& criteria) const { m_sortProxy->setCriteria(criteria); } void ModListView::setFilterOptions(ModListSortProxy::FilterMode mode, - ModListSortProxy::SeparatorsMode sep) + ModListSortProxy::SeparatorsMode sep) const { m_sortProxy->setOptions(mode, sep); } @@ -346,7 +346,7 @@ QModelIndexList ModListView::indexViewToModel(const QModelIndexList& index) cons return ::indexViewToModel(index, m_core->modList()); } -QModelIndex ModListView::nextIndex(const QModelIndex& index) const +QModelIndex ModListView::nextIndex(const QModelIndex& index) { auto* model = index.model(); if (!model) { @@ -372,7 +372,7 @@ QModelIndex ModListView::nextIndex(const QModelIndex& index) const } } -QModelIndex ModListView::prevIndex(const QModelIndex& index) const +QModelIndex ModListView::prevIndex(const QModelIndex& index) { if (index.row() == 0 && index.parent().isValid()) { return index.parent(); @@ -1180,7 +1180,7 @@ QColor ModListView::markerColor(const QModelIndex& index) const } if (colors.empty()) { - return QColor(); + return {}; } int r = 0, g = 0, b = 0, a = 0; @@ -1191,11 +1191,11 @@ QColor ModListView::markerColor(const QModelIndex& index) const a += color.alpha(); } - return QColor(r / colors.size(), g / colors.size(), b / colors.size(), - a / colors.size()); + return {r / colors.size(), g / colors.size(), b / colors.size(), + a / colors.size()}; } - return QColor(); + return {}; } std::vector ModListView::modFlags(const QModelIndex& index, diff --git a/src/src/modlistview.h b/src/src/modlistview.h index fcc6b42..a5c079c 100644 --- a/src/src/modlistview.h +++ b/src/src/modlistview.h @@ -120,13 +120,13 @@ public slots: // invalidate (refresh) the filter (similar to a layout changed event) // - void invalidateFilter(); + void invalidateFilter() const; // set the filter criteria/options for mods // - void setFilterCriteria(const std::vector& criteria); + void setFilterCriteria(const std::vector& criteria) const; void setFilterOptions(ModListSortProxy::FilterMode mode, - ModListSortProxy::SeparatorsMode sep); + ModListSortProxy::SeparatorsMode sep) const; // update the mod counter // @@ -150,8 +150,8 @@ protected: // returns the next/previous index of the given index // - QModelIndex nextIndex(const QModelIndex& index) const; - QModelIndex prevIndex(const QModelIndex& index) const; + static QModelIndex nextIndex(const QModelIndex& index) ; + static QModelIndex prevIndex(const QModelIndex& index) ; // re-implemented to fake the return value to allow drag-and-drop on // itself for separators diff --git a/src/src/modlistviewactions.cpp b/src/src/modlistviewactions.cpp index 1ee485c..6d7d482 100644 --- a/src/src/modlistviewactions.cpp +++ b/src/src/modlistviewactions.cpp @@ -1158,7 +1158,7 @@ void ModListViewActions::setEndorsed(const QModelIndexList& indices, }); } -void ModListViewActions::willNotEndorsed(const QModelIndexList& indices) const +void ModListViewActions::willNotEndorsed(const QModelIndexList& indices) { for (auto& idx : indices) { ModInfo::getByIndex(idx.data(ModList::IndexRole).toInt())->setNeverEndorse(); @@ -1229,7 +1229,7 @@ void ModListViewActions::resetColor(const QModelIndexList& indices) const } void ModListViewActions::setCategories( - ModInfo::Ptr mod, const std::vector>& categories) const + ModInfo::Ptr mod, const std::vector>& categories) { for (auto& [id, enabled] : categories) { mod->setCategory(id, enabled); @@ -1238,7 +1238,7 @@ void ModListViewActions::setCategories( void ModListViewActions::setCategoriesIf( ModInfo::Ptr mod, ModInfo::Ptr ref, - const std::vector>& categories) const + const std::vector>& categories) { for (auto& [id, enabled] : categories) { if (ref->categorySet(id) != enabled) { @@ -1296,7 +1296,7 @@ void ModListViewActions::setPrimaryCategory(const QModelIndexList& selected, } } -void ModListViewActions::openExplorer(const QModelIndexList& index) const +void ModListViewActions::openExplorer(const QModelIndexList& index) { for (auto& idx : index) { ModInfo::Ptr info = ModInfo::getByIndex(idx.data(ModList::IndexRole).toInt()); @@ -1327,7 +1327,7 @@ void ModListViewActions::restoreBackup(const QModelIndex& index) const QDir::fromNativeSeparators(m_core.settings().paths().mods()) + "/" + regName; if (!modDir.rename(modInfo->absolutePath(), destinationPath)) { - reportError(tr("failed to rename \"%1\" to \"%2\"") + reportError(tr(R"(failed to rename "%1" to "%2")") .arg(modInfo->absolutePath()) .arg(destinationPath)); } diff --git a/src/src/modlistviewactions.h b/src/src/modlistviewactions.h index 3dcbffc..74465e3 100644 --- a/src/src/modlistviewactions.h +++ b/src/src/modlistviewactions.h @@ -98,7 +98,7 @@ public: void restoreHiddenFiles(const QModelIndexList& indices) const; void setTracked(const QModelIndexList& indices, bool tracked) const; void setEndorsed(const QModelIndexList& indices, bool endorsed) const; - void willNotEndorsed(const QModelIndexList& indices) const; + static void willNotEndorsed(const QModelIndexList& indices) ; void remapCategory(const QModelIndexList& indices) const; // set/reset color of the given selection, using the given reference index (index @@ -124,7 +124,7 @@ public: // open the Windows explorer for the specified mods // - void openExplorer(const QModelIndexList& index) const; + static void openExplorer(const QModelIndexList& index) ; // backup-specific actions // @@ -162,14 +162,14 @@ private: // set the category of the given mod based on the given array // - void setCategories(ModInfo::Ptr mod, - const std::vector>& categories) const; + static void setCategories(ModInfo::Ptr mod, + const std::vector>& categories) ; // set the category of the given mod if the category from the reference mod does not // match the one in the array of categories // - void setCategoriesIf(ModInfo::Ptr mod, ModInfo::Ptr ref, - const std::vector>& categories) const; + static void setCategoriesIf(ModInfo::Ptr mod, ModInfo::Ptr ref, + const std::vector>& categories) ; // check the given mods from update, the map should map game names to nexus ID // diff --git a/src/src/motddialog.h b/src/src/motddialog.h index 6d3837f..523c9dc 100644 --- a/src/src/motddialog.h +++ b/src/src/motddialog.h @@ -38,7 +38,7 @@ public: private slots: void on_okButton_clicked(); - void linkClicked(const QUrl& url); + static void linkClicked(const QUrl& url); private: Ui::MotDDialog* ui; diff --git a/src/src/nexusinterface.cpp b/src/src/nexusinterface.cpp index 6d2f74a..3f15e19 100644 --- a/src/src/nexusinterface.cpp +++ b/src/src/nexusinterface.cpp @@ -1232,7 +1232,7 @@ APIStats NexusInterface::getAPIStats() const } void NexusInterface::applyGameNameOverride(NXMRequestInfo& info, const QString& gameName, - const MOBase::IPluginGame* game) const + const MOBase::IPluginGame* game) { // When gameName has no matching plugin (e.g. "site" for Nexus tools), getGame() // returns the managed game as a fallback, causing NXMRequestInfo to store the wrong diff --git a/src/src/nexusinterface.h b/src/src/nexusinterface.h index a027268..e8e2798 100644 --- a/src/src/nexusinterface.h +++ b/src/src/nexusinterface.h @@ -678,8 +678,8 @@ private: // When the game name has no matching plugin (e.g. "site"), getGame() returns the // managed game as a fallback but sets the wrong m_GameName in the request. This // overrides it back to the raw requested name so API URLs use the correct domain. - void applyGameNameOverride(NXMRequestInfo& info, const QString& gameName, - const MOBase::IPluginGame* game) const; + static void applyGameNameOverride(NXMRequestInfo& info, const QString& gameName, + const MOBase::IPluginGame* game) ; private: QNetworkDiskCache* m_DiskCache; diff --git a/src/src/nxmaccessmanager.cpp b/src/src/nxmaccessmanager.cpp index 83bc139..8f0abfd 100644 --- a/src/src/nxmaccessmanager.cpp +++ b/src/src/nxmaccessmanager.cpp @@ -258,7 +258,7 @@ bool NexusSSOLogin::isActive() const return m_active; } -void NexusSSOLogin::setState(States s, const QString& error) +void NexusSSOLogin::setState(States s, const QString& error) const { if (stateChanged) { stateChanged(s, error); @@ -755,7 +755,7 @@ void NexusKeyValidator::onAttemptFailure(const ValidationAttempt& a) } void NexusKeyValidator::setFinished(ValidationAttempt::Result r, const QString& message, - std::optional user) + std::optional user) const { if (finished) { finished(r, message, user); diff --git a/src/src/nxmaccessmanager.h b/src/src/nxmaccessmanager.h index 1c78fe8..6027fa6 100644 --- a/src/src/nxmaccessmanager.h +++ b/src/src/nxmaccessmanager.h @@ -72,7 +72,7 @@ private: bool m_active{false}; QTimer m_timeout; - void setState(States s, const QString& error = {}); + void setState(States s, const QString& error = {}) const; void close(); void abort(); @@ -171,7 +171,7 @@ private: void onAttemptFailure(const ValidationAttempt& a); void setFinished(ValidationAttempt::Result r, const QString& message, - std::optional user); + std::optional user) const; }; class ValidationProgressDialog : public QDialog diff --git a/src/src/nxmhandler_linux.cpp b/src/src/nxmhandler_linux.cpp index 4fa66b5..05d3944 100644 --- a/src/src/nxmhandler_linux.cpp +++ b/src/src/nxmhandler_linux.cpp @@ -172,7 +172,7 @@ QString NxmHandlerLinux::socketPath() return QDir::homePath() + "/.local/share/fluorine/tmp/mo2-nxm.sock"; } -void NxmHandlerLinux::registerHandler() const +void NxmHandlerLinux::registerHandler() { const QString home = QDir::homePath(); if (home.isEmpty()) { diff --git a/src/src/nxmhandler_linux.h b/src/src/nxmhandler_linux.h index c4631aa..ab58165 100644 --- a/src/src/nxmhandler_linux.h +++ b/src/src/nxmhandler_linux.h @@ -33,7 +33,7 @@ public: explicit NxmHandlerLinux(QObject* parent = nullptr); ~NxmHandlerLinux() override; - void registerHandler() const; + static void registerHandler() ; bool startListener(); static bool sendToSocket(const QString& url); diff --git a/src/src/organizercore.cpp b/src/src/organizercore.cpp index 4c37670..2ef8b47 100644 --- a/src/src/organizercore.cpp +++ b/src/src/organizercore.cpp @@ -1194,14 +1194,14 @@ ModInfo::Ptr OrganizerCore::installArchive(const QString& archivePath, int prior QString OrganizerCore::resolvePath(const QString& fileName) const { if (m_DirectoryStructure == nullptr) { - return QString(); + return {}; } const FileEntryPtr file = m_DirectoryStructure->searchFile(ToWString(fileName), nullptr); if (file.get() != nullptr) { return ToQString(file->getFullPath()); } else { - return QString(); + return {}; } } @@ -1811,7 +1811,7 @@ void OrganizerCore::requestDownload(const QUrl& url, QNetworkReply* reply) QString gameName = ""; int modID = 0; int fileID = 0; - QRegularExpression nameExp("www\\.nexusmods\\.com/(\\a+)/"); + QRegularExpression nameExp(R"(www\.nexusmods\.com/(\a+)/)"); auto match = nameExp.match(url.toString()); if (match.hasMatch()) { gameName = match.captured(1); @@ -2224,7 +2224,7 @@ QString OrganizerCore::oldMO1HookDll() const if (QFile(hookdll).exists()) return hookdll; } - return QString(); + return {}; } std::vector OrganizerCore::activeProblems() const diff --git a/src/src/organizercore.h b/src/src/organizercore.h index 7783511..7f60998 100644 --- a/src/src/organizercore.h +++ b/src/src/organizercore.h @@ -206,7 +206,7 @@ public: * @brief Construct a ModDataContentHolder without any contents (e.g., if the * feature is missing). */ - ModDataContentHolder() {} + ModDataContentHolder() = default; /** * @brief Construct a ModDataContentHold holding the given list of contents. @@ -319,7 +319,7 @@ public: void afterRun(const QFileInfo& binary, DWORD exitCode); - ProcessRunner::Results + static ProcessRunner::Results waitForAllUSVFSProcesses(UILocker::Reasons reason = UILocker::PreventExit); void refreshESPList(bool force = false); @@ -342,7 +342,7 @@ public: const QByteArray& fileData); void loginSuccessfulUpdate(bool necessary); - void loginFailedUpdate(const QString& message); + static void loginFailedUpdate(const QString& message); static bool createAndMakeWritable(const QString& path); bool checkPathSymlinks(); @@ -473,7 +473,7 @@ public slots: QString const& newName); void profileRemoved(QString const& profileName); - bool nexusApi(bool retry = false); + static bool nexusApi(bool retry = false); signals: @@ -516,7 +516,7 @@ private: // void clearCaches(std::vector const& indices) const; - bool createDirectory(const QString& path); + static bool createDirectory(const QString& path); QString oldMO1HookDll() const; diff --git a/src/src/organizerproxy.cpp b/src/src/organizerproxy.cpp index b1fac87..66aaf62 100644 --- a/src/src/organizerproxy.cpp +++ b/src/src/organizerproxy.cpp @@ -171,7 +171,7 @@ VersionInfo OrganizerProxy::appVersion() const // there is no way to differentiate two pre-releases? } - return VersionInfo(major, minor, subminor, subsubminor, infoReleaseType); + return {major, minor, subminor, subsubminor, infoReleaseType}; } IPluginGame* OrganizerProxy::getGame(const QString& gameName) const diff --git a/src/src/overwriteinfodialog.h b/src/src/overwriteinfodialog.h index 2984c40..a56998c 100644 --- a/src/src/overwriteinfodialog.h +++ b/src/src/overwriteinfodialog.h @@ -52,7 +52,7 @@ public: if (role == Qt::DisplayRole) { return tr("Overwrites"); } else { - return QVariant(); + return {}; } } else { return QFileSystemModel::headerData(section, orientation, role); @@ -65,7 +65,7 @@ public: if (role == Qt::DisplayRole) { return tr("not implemented"); } else { - return QVariant(); + return {}; } } else { return QFileSystemModel::data(index, role); diff --git a/src/src/plugincontainer.cpp b/src/src/plugincontainer.cpp index 41b39f8..4c73c74 100644 --- a/src/src/plugincontainer.cpp +++ b/src/src/plugincontainer.cpp @@ -355,7 +355,7 @@ QStringList PluginContainer::implementedInterfaces(IPlugin* plugin) const return implementedInterfaces(oPlugin); } -QStringList PluginContainer::implementedInterfaces(QObject* oPlugin) const +QStringList PluginContainer::implementedInterfaces(QObject* oPlugin) { // Find all the names: QStringList names; @@ -383,7 +383,7 @@ QString PluginContainer::topImplementedInterface(IPlugin* plugin) const return interfaces.isEmpty() ? "" : interfaces[0]; } -bool PluginContainer::isBetterInterface(QObject* lhs, QObject* rhs) const +bool PluginContainer::isBetterInterface(QObject* lhs, QObject* rhs) { int count = 0, lhsIdx = -1, rhsIdx = -1; boost::mp11::mp_for_each([&](const auto* p) { @@ -960,7 +960,7 @@ QObject* PluginContainer::loadQtPlugin(const QString& filepath) return nullptr; } -std::optional PluginContainer::isQtPluginFolder(const QString& filepath) const +std::optional PluginContainer::isQtPluginFolder(const QString& filepath) { if (!QFileInfo(filepath).isDir()) { diff --git a/src/src/plugincontainer.h b/src/src/plugincontainer.h index ec18475..70abcf4 100644 --- a/src/src/plugincontainer.h +++ b/src/src/plugincontainer.h @@ -413,7 +413,7 @@ private: // // extra DLLs are ignored by Qt so can be present in the folder // - std::optional isQtPluginFolder(const QString& filepath) const; + static std::optional isQtPluginFolder(const QString& filepath) ; // See startPlugins for more details. This is simply an intermediate function // that can be used when loading plugins after initialization. This uses the @@ -442,7 +442,7 @@ private: * @note This function can be used to get implemented interfaces before registering * a plugin. */ - QStringList implementedInterfaces(QObject* plugin) const; + static QStringList implementedInterfaces(QObject* plugin) ; /** * @brief Check if a plugin implements a "better" interface than another @@ -453,7 +453,7 @@ private: * @return true if the left plugin implements a better interface than the right * one, false otherwise (or if both implements the same interface). */ - bool isBetterInterface(QObject* lhs, QObject* rhs) const; + static bool isBetterInterface(QObject* lhs, QObject* rhs) ; /** * @brief Find the QObject* corresponding to the given plugin. diff --git a/src/src/pluginlist.cpp b/src/src/pluginlist.cpp index 56bee56..41f3d27 100644 --- a/src/src/pluginlist.cpp +++ b/src/src/pluginlist.cpp @@ -1019,7 +1019,7 @@ QStringList PluginList::masters(const QString& name) const { auto iter = m_ESPsByName.find(name); if (iter == m_ESPsByName.end()) { - return QStringList(); + return {}; } else { QStringList result; for (const QString& master : m_ESPs[iter->second].masters) { @@ -1033,7 +1033,7 @@ QString PluginList::origin(const QString& name) const { auto iter = m_ESPsByName.find(name); if (iter == m_ESPsByName.end()) { - return QString(); + return {}; } else { return m_ESPs[iter->second].originName; } @@ -1133,7 +1133,7 @@ QString PluginList::author(const QString& name) const { auto iter = m_ESPsByName.find(name); if (iter == m_ESPsByName.end()) { - return QString(); + return {}; } else { return m_ESPs[iter->second].author; } @@ -1143,7 +1143,7 @@ QString PluginList::description(const QString& name) const { auto iter = m_ESPsByName.find(name); if (iter == m_ESPsByName.end()) { - return QString(); + return {}; } else { return m_ESPs[iter->second].description; } @@ -1303,7 +1303,7 @@ QVariant PluginList::data(const QModelIndex& modelIndex, int role) const } else if (role == Qt::UserRole + 1) { return iconData(modelIndex); } - return QVariant(); + return {}; } QVariant PluginList::displayData(const QModelIndex& modelIndex) const @@ -1399,14 +1399,14 @@ QVariant PluginList::fontData(const QModelIndex& modelIndex) const return result; } -QVariant PluginList::alignmentData(const QModelIndex& modelIndex) const +QVariant PluginList::alignmentData(const QModelIndex& modelIndex) { const int index = modelIndex.row(); if (modelIndex.column() == 0) { - return QVariant(Qt::AlignLeft | Qt::AlignVCenter); + return {Qt::AlignLeft | Qt::AlignVCenter}; } else { - return QVariant(Qt::AlignHCenter | Qt::AlignVCenter); + return {Qt::AlignHCenter | Qt::AlignVCenter}; } } @@ -1609,12 +1609,12 @@ QVariant PluginList::iconData(const QModelIndex& modelIndex) const return result; } -bool PluginList::isProblematic(const ESPInfo& esp, const AdditionalInfo*) const +bool PluginList::isProblematic(const ESPInfo& esp, const AdditionalInfo*) { return !esp.masterUnset.empty(); } -bool PluginList::hasInfo(const ESPInfo&, const AdditionalInfo* info) const +bool PluginList::hasInfo(const ESPInfo&, const AdditionalInfo* info) { return info && !info->messages.empty(); } @@ -1891,14 +1891,14 @@ bool PluginList::dropMimeData(const QMimeData* mimeData, Qt::DropAction action, QModelIndex PluginList::index(int row, int column, const QModelIndex&) const { if ((row < 0) || (row >= rowCount()) || (column < 0) || (column >= columnCount())) { - return QModelIndex(); + return {}; } return createIndex(row, column, row); } QModelIndex PluginList::parent(const QModelIndex&) const { - return QModelIndex(); + return {}; } PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEnabled, diff --git a/src/src/pluginlist.h b/src/src/pluginlist.h index ec1f865..3178d69 100644 --- a/src/src/pluginlist.h +++ b/src/src/pluginlist.h @@ -88,14 +88,14 @@ class PluginList : public QAbstractItemModel public: enum EColumn { - COL_NAME, - COL_FLAGS, - COL_PRIORITY, - COL_MODINDEX, - COL_FORMVERSION, - COL_HEADERVERSION, - COL_AUTHOR, - COL_DESCRIPTION, + COL_NAME = 0, + COL_FLAGS = 1, + COL_PRIORITY = 2, + COL_MODINDEX = 3, + COL_FORMVERSION = 4, + COL_HEADERVERSION = 5, + COL_AUTHOR = 6, + COL_DESCRIPTION = 7, COL_LASTCOLUMN = COL_DESCRIPTION, }; @@ -424,12 +424,12 @@ private: QVariant foregroundData(const QModelIndex& modelIndex) const; QVariant backgroundData(const QModelIndex& modelIndex) const; QVariant fontData(const QModelIndex& modelIndex) const; - QVariant alignmentData(const QModelIndex& modelIndex) const; + static QVariant alignmentData(const QModelIndex& modelIndex) ; QVariant tooltipData(const QModelIndex& modelIndex) const; QVariant iconData(const QModelIndex& modelIndex) const; - bool isProblematic(const ESPInfo& esp, const AdditionalInfo* info) const; - bool hasInfo(const ESPInfo& esp, const AdditionalInfo* info) const; + static bool isProblematic(const ESPInfo& esp, const AdditionalInfo* info) ; + static bool hasInfo(const ESPInfo& esp, const AdditionalInfo* info) ; }; #pragma warning(pop) diff --git a/src/src/prefixsetuprunner.cpp b/src/src/prefixsetuprunner.cpp index dba1742..f064a1c 100644 --- a/src/src/prefixsetuprunner.cpp +++ b/src/src/prefixsetuprunner.cpp @@ -1726,7 +1726,7 @@ QString PrefixSetupRunner::findProtonScript() const return QFileInfo::exists(script) ? script : QString(); } -QString PrefixSetupRunner::detectSteamPath() const +QString PrefixSetupRunner::detectSteamPath() { // Use native Steam detection first. const QString steamPath = findSteamPath(); @@ -1776,7 +1776,7 @@ QString PrefixSetupRunner::detectSLRRunScript() const return {}; } -QString PrefixSetupRunner::fluorineBinDir() const +QString PrefixSetupRunner::fluorineBinDir() { return fluorineDataDir() + "/bin"; } @@ -1861,12 +1861,12 @@ void PrefixSetupRunner::killStalePrefixProcesses() const QThread::msleep(100); } -QString PrefixSetupRunner::fluorineCacheDir() const +QString PrefixSetupRunner::fluorineCacheDir() { return fluorineDataDir() + "/cache"; } -QString PrefixSetupRunner::fluorineTmpDir() const +QString PrefixSetupRunner::fluorineTmpDir() { return fluorineDataDir() + "/tmp"; } diff --git a/src/src/prefixsetuprunner.h b/src/src/prefixsetuprunner.h index 05d21cc..3797c40 100644 --- a/src/src/prefixsetuprunner.h +++ b/src/src/prefixsetuprunner.h @@ -123,11 +123,11 @@ private: QString findWineBinary() const; QString findWineserverBinary() const; QString findProtonScript() const; - QString detectSteamPath() const; + static QString detectSteamPath() ; QString detectSLRRunScript() const; - QString fluorineBinDir() const; - QString fluorineCacheDir() const; - QString fluorineTmpDir() const; + static QString fluorineBinDir() ; + static QString fluorineCacheDir() ; + static QString fluorineTmpDir() ; QMap baseWineEnv() const; /// Kill any wineboot/wineserver/pv-adverb processes still bound to diff --git a/src/src/problemsdialog.h b/src/src/problemsdialog.h index 0bacc60..075868b 100644 --- a/src/src/problemsdialog.h +++ b/src/src/problemsdialog.h @@ -31,7 +31,7 @@ private: private slots: void selectionChanged(); - void urlClicked(const QUrl& url); + static void urlClicked(const QUrl& url); void startFix(); diff --git a/src/src/profile.cpp b/src/src/profile.cpp index f9e852a..299bae4 100644 --- a/src/src/profile.cpp +++ b/src/src/profile.cpp @@ -384,7 +384,7 @@ void Profile::renameModInList(QFile& modList, const QString& oldName, } if (renamed) - log::debug("Renamed {} \"{}\" mod to \"{}\" in {}", renamed, oldName, newName, + log::debug(R"(Renamed {} "{}" mod to "{}" in {})", renamed, oldName, newName, modList.fileName()); } @@ -480,7 +480,7 @@ void Profile::refreshModStatus() unsigned int modIndex = ModInfo::getIndex(modName); if (modIndex == UINT_MAX) { if (modsNotFound < 5) { - log::warn("mod not found: \"{}\" (profile \"{}\")", modName, m_Directory.path()); + log::warn(R"(mod not found: "{}" (profile "{}"))", modName, m_Directory.path()); } ++modsNotFound; // need to rewrite the modlist to fix this @@ -499,7 +499,7 @@ void Profile::refreshModStatus() m_ModStatus[modIndex].m_Priority = index++; } } else { - log::warn("no mod state for \"{}\" (profile \"{}\")", modName, + log::warn(R"(no mod state for "{}" (profile "{}"))", modName, m_Directory.path()); // need to rewrite the modlist to fix this modStatusModified = true; @@ -753,7 +753,7 @@ void Profile::copyFilesTo(QString& target) const copyDir(m_Directory.absolutePath(), target, false); } -std::vector Profile::splitDZString(const wchar_t* buffer) const +std::vector Profile::splitDZString(const wchar_t* buffer) { std::vector result; const wchar_t* pos = buffer; @@ -766,7 +766,7 @@ std::vector Profile::splitDZString(const wchar_t* buffer) const return result; } -void Profile::mergeTweak(const QString& tweakName, const QString& tweakedIni) const +void Profile::mergeTweak(const QString& tweakName, const QString& tweakedIni) { // Parse the tweak INI file line-by-line and merge each key=value into the // destination using WriteRegistryValue (which uses the safe line-by-line diff --git a/src/src/profile.h b/src/src/profile.h index 0537c0f..178600f 100644 --- a/src/src/profile.h +++ b/src/src/profile.h @@ -376,7 +376,7 @@ private: friend class Profile; public: - ModStatus() {} + ModStatus() = default; private: bool m_Enabled{false}; @@ -388,8 +388,8 @@ private: void copyFilesTo(QString& target) const; - std::vector splitDZString(const wchar_t* buffer) const; - void mergeTweak(const QString& tweakName, const QString& tweakedIni) const; + static std::vector splitDZString(const wchar_t* buffer) ; + static void mergeTweak(const QString& tweakName, const QString& tweakedIni) ; void mergeTweaks(ModInfo::Ptr modInfo, const QString& tweakedIni) const; void touchFile(QString fileName); diff --git a/src/src/protonlauncher.cpp b/src/src/protonlauncher.cpp index 6ec11e1..0e66e80 100644 --- a/src/src/protonlauncher.cpp +++ b/src/src/protonlauncher.cpp @@ -343,7 +343,7 @@ bool parseEnvAssignment(const QString& token, QString& keyOut, QString& valueOut ProtonLauncher::ProtonLauncher() -{} += default; ProtonLauncher& ProtonLauncher::setBinary(const QString& path) { @@ -775,7 +775,7 @@ bool ProtonLauncher::launchWithProton(qint64& pid) const QStringList newArgs; newArgs << "--user" << "--mount" << "-r" << "--" << "/bin/sh" << "-c" - << "mount --bind \"$1\" \"$2\" && shift 2 && exec \"$@\"" + << R"(mount --bind "$1" "$2" && shift 2 && exec "$@")" << "_mo2bind" << m_bindMountSource << m_bindMountTarget diff --git a/src/src/qtgroupingproxy.cpp b/src/src/qtgroupingproxy.cpp index af5ea8b..5235d6f 100644 --- a/src/src/qtgroupingproxy.cpp +++ b/src/src/qtgroupingproxy.cpp @@ -42,7 +42,7 @@ QtGroupingProxy::QtGroupingProxy(QModelIndex rootNode, int groupedColumn, } } -QtGroupingProxy::~QtGroupingProxy() {} +QtGroupingProxy::~QtGroupingProxy() = default; void QtGroupingProxy::setSourceModel(QAbstractItemModel* model) { @@ -294,11 +294,11 @@ int QtGroupingProxy::indexOfParentCreate(const QModelIndex& parent) const QModelIndex QtGroupingProxy::index(int row, int column, const QModelIndex& parent) const { if (!hasIndex(row, column, parent)) { - return QModelIndex(); + return {}; } if (parent.column() > 0) { - return QModelIndex(); + return {}; } /* We save the instructions to make the parent of the index in a struct. @@ -312,11 +312,11 @@ QModelIndex QtGroupingProxy::index(int row, int column, const QModelIndex& paren QModelIndex QtGroupingProxy::parent(const QModelIndex& index) const { if (!index.isValid()) - return QModelIndex(); + return {}; int parentCreateIndex = index.internalId(); if (parentCreateIndex == -1 || parentCreateIndex >= m_parentCreateList.count()) - return QModelIndex(); + return {}; struct ParentCreate pc = m_parentCreateList[parentCreateIndex]; @@ -393,7 +393,7 @@ static QVariant variantMin(const QVariantList& variants) QVariant QtGroupingProxy::data(const QModelIndex& index, int role) const { if (!index.isValid()) - return QVariant(); + return {}; int row = index.row(); int column = index.column(); @@ -416,7 +416,7 @@ QVariant QtGroupingProxy::data(const QModelIndex& index, int role) const } break; case Qt::CheckStateRole: { if (column != 0) - return QVariant(); + return {}; int childCount = m_groupMap.value(row).count(); int checked = 0; QModelIndex parentIndex = this->index(row, 0, index.parent()); @@ -438,7 +438,7 @@ QVariant QtGroupingProxy::data(const QModelIndex& index, int role) const if (m_groupMap.value(row).count() > 0) { return this->index(0, column, parentIndex).data(role); } else { - return QVariant(); + return {}; } // return m_groupMaps[row][column].value( role ); } break; @@ -464,7 +464,7 @@ QVariant QtGroupingProxy::data(const QModelIndex& index, int role) const QVariantList variantsOfChildren; int childCount = m_groupMap.value(row).count(); if (childCount == 0) - return QVariant(); + return {}; int function = AGGR_NONE; if (m_aggregateRole >= Qt::UserRole) { @@ -492,12 +492,12 @@ QVariant QtGroupingProxy::data(const QModelIndex& index, int role) const } if (variantsOfChildren.count() == 0) - return QVariant(); + return {}; // only one unique variant? No need to return a list switch (function) { case AGGR_EMPTY: - return QVariant(); + return {}; case AGGR_FIRST: return variantsOfChildren.first(); case AGGR_MAX: @@ -581,7 +581,7 @@ QModelIndex QtGroupingProxy::mapToSource(const QModelIndex& index) const QList childRows = m_groupMap.value(proxyParent.row()); if (childRows.isEmpty() || indexInGroup >= childRows.count() || indexInGroup < 0) - return QModelIndex(); + return {}; originalRow = childRows.at(indexInGroup); } @@ -602,7 +602,7 @@ QModelIndexList QtGroupingProxy::mapToSource(const QModelIndexList& list) const QModelIndex QtGroupingProxy::mapFromSource(const QModelIndex& idx) const { if (!idx.isValid()) - return QModelIndex(); + return {}; QModelIndex proxyParent; QModelIndex sourceParent = idx.parent(); @@ -647,9 +647,9 @@ Qt::ItemFlags QtGroupingProxy::flags(const QModelIndex& idx) const if (!idx.isValid()) { Qt::ItemFlags rootFlags = sourceModel()->flags(m_rootNode); if (rootFlags.testFlag(Qt::ItemIsDropEnabled)) - return Qt::ItemFlags(Qt::ItemIsDropEnabled); + return {Qt::ItemIsDropEnabled}; - return Qt::ItemFlags(0); + return {0}; } // only if the grouped column has the editable flag set allow the diff --git a/src/src/qtgroupingproxy.h b/src/src/qtgroupingproxy.h index 9b980eb..b0661aa 100644 --- a/src/src/qtgroupingproxy.h +++ b/src/src/qtgroupingproxy.h @@ -26,8 +26,8 @@ #include #include -typedef QMap ItemData; -typedef QMap RowData; +using ItemData = QMap; +using RowData = QMap; class QtGroupingProxy : public QAbstractProxyModel { diff --git a/src/src/savestab.cpp b/src/src/savestab.cpp index 734f88d..0798033 100644 --- a/src/src/savestab.cpp +++ b/src/src/savestab.cpp @@ -278,7 +278,7 @@ void SavesTab::startMonitorSaves() void SavesTab::stopMonitorSaves() { - if (m_SavesWatcher.directories().length() > 0) { + if (!m_SavesWatcher.directories().empty()) { m_SavesWatcher.removePaths(m_SavesWatcher.directories()); } } @@ -370,7 +370,7 @@ void SavesTab::onContextMenu(const QPoint& pos) if (selection->selectedRows().count() == 1) { auto& save = m_SaveGames[selection->selectedRows()[0].row()]; SaveGameInfo::MissingAssets missing = info->getMissingAssets(*save); - if (missing.size() != 0) { + if (!missing.empty()) { connect(action, &QAction::triggered, this, [this, missing] { fixMods(missing); }); diff --git a/src/src/selectiondialog.cpp b/src/src/selectiondialog.cpp index 319b4eb..25fc765 100644 --- a/src/src/selectiondialog.cpp +++ b/src/src/selectiondialog.cpp @@ -79,7 +79,7 @@ QString SelectionDialog::getChoiceString() { if ((m_Choice == nullptr) || (m_ValidateByData && !m_Choice->property("data").isValid())) { - return QString(); + return {}; } else { return m_Choice->text(); } @@ -88,7 +88,7 @@ QString SelectionDialog::getChoiceString() QString SelectionDialog::getChoiceDescription() { if (m_Choice == nullptr) - return QString(); + return {}; else return m_Choice->accessibleDescription(); } diff --git a/src/src/selfupdater.cpp b/src/src/selfupdater.cpp index d33bc00..1a01771 100644 --- a/src/src/selfupdater.cpp +++ b/src/src/selfupdater.cpp @@ -71,7 +71,7 @@ SelfUpdater::SelfUpdater(NexusInterface* nexusInterface) m_Reply(nullptr), m_Attempts(3) {} -SelfUpdater::~SelfUpdater() {} +SelfUpdater::~SelfUpdater() = default; void SelfUpdater::setUserInterface(QWidget* widget) { diff --git a/src/src/settings.cpp b/src/src/settings.cpp index 3f48ae9..9d86150 100644 --- a/src/src/settings.cpp +++ b/src/src/settings.cpp @@ -783,7 +783,7 @@ bool GeometrySettings::restoreWindowGeometry(QWidget* w) const return false; } -void GeometrySettings::ensureWindowOnScreen(QWidget* w) const +void GeometrySettings::ensureWindowOnScreen(QWidget* w) { // users report that the main window and/or dialogs are displayed off-screen; // the usual workaround is keyboard navigation to move it @@ -1388,13 +1388,13 @@ void ColorSettings::setColorSeparatorScrollbar(bool b) QColor ColorSettings::idealTextColor(const QColor& rBackgroundColor) { if (rBackgroundColor.alpha() < 50) - return QColor(Qt::black); + return {Qt::black}; // "inverse' of luminance of the background int iLuminance = (rBackgroundColor.red() * 0.299) + (rBackgroundColor.green() * 0.587) + (rBackgroundColor.blue() * 0.114); - return QColor(iLuminance >= 128 ? Qt::black : Qt::white); + return {iLuminance >= 128 ? Qt::black : Qt::white}; } PluginSettings::PluginSettings(QSettings& settings) : m_Settings(settings) {} @@ -1474,12 +1474,12 @@ QVariant PluginSettings::setting(const QString& pluginName, const QString& key) { auto iterPlugin = m_PluginSettings.find(pluginName); if (iterPlugin == m_PluginSettings.end()) { - return QVariant(); + return {}; } auto iterSetting = iterPlugin->find(key); if (iterSetting == iterPlugin->end()) { - return QVariant(); + return {}; } return *iterSetting; @@ -1797,7 +1797,7 @@ NetworkSettings::NetworkSettings(QSettings& settings, bool globalInstance) } } -void NetworkSettings::updateCustomBrowser() +void NetworkSettings::updateCustomBrowser() const { if (useCustomBrowser()) { MOBase::shell::SetUrlHandler(customBrowserCommand()); @@ -2081,7 +2081,7 @@ std::vector NexusSettings::validationTimeouts() const return v; } -void NexusSettings::dump() const +void NexusSettings::dump() { const auto iniPath = InstanceManager::singleton().globalInstancesRootPath() + "/" + QString::fromStdWString(AppConfig::nxmHandlerIni()); @@ -2099,7 +2099,7 @@ void NexusSettings::dump() const log::debug("nxmhandler settings:"); - QSettings handler("HKEY_CURRENT_USER\\Software\\Classes\\nxm\\", + QSettings handler(R"(HKEY_CURRENT_USER\Software\Classes\nxm\)", QSettings::NativeFormat); log::debug(" . primary: {}", handler.value("shell/open/command/Default").toString()); diff --git a/src/src/settings.h b/src/src/settings.h index e605cff..239ac1c 100644 --- a/src/src/settings.h +++ b/src/src/settings.h @@ -160,7 +160,7 @@ private: void saveWindowGeometry(const QWidget* w); bool restoreWindowGeometry(QWidget* w) const; - void ensureWindowOnScreen(QWidget* w) const; + static void ensureWindowOnScreen(QWidget* w) ; static void centerOnMonitor(QWidget* w, int monitor); static void centerOnParent(QWidget* w, QWidget* parent = nullptr); }; @@ -482,7 +482,7 @@ private: // sets the custom command in uibase, called when the settings change // - void updateCustomBrowser(); + void updateCustomBrowser() const; }; enum class EndorsementState @@ -525,13 +525,13 @@ public: // if 'force' is true, the registration dialog will be shown even if the user // said earlier not to // - void registerAsNXMHandler(bool force); + static void registerAsNXMHandler(bool force); std::vector validationTimeouts() const; // dumps nxmhandler stuff // - void dump() const; + static void dump() ; private: Settings& m_Parent; diff --git a/src/src/settingsdialog.cpp b/src/src/settingsdialog.cpp index 057fafe..c0e254b 100644 --- a/src/src/settingsdialog.cpp +++ b/src/src/settingsdialog.cpp @@ -112,14 +112,14 @@ SettingsDialog::~SettingsDialog() delete ui; } -QString SettingsDialog::getColoredButtonStyleSheet() const +QString SettingsDialog::getColoredButtonStyleSheet() { - return QString("QPushButton {" + return {"QPushButton {" "background-color: %1;" "color: %2;" "border: 1px solid;" "padding: 3px;" - "}"); + "}"}; } void SettingsDialog::accept() diff --git a/src/src/settingsdialog.h b/src/src/settingsdialog.h index 230939b..864eae7 100644 --- a/src/src/settingsdialog.h +++ b/src/src/settingsdialog.h @@ -72,7 +72,7 @@ public: * @brief get stylesheet of settings buttons with colored background * @return string of stylesheet */ - QString getColoredButtonStyleSheet() const; + static QString getColoredButtonStyleSheet() ; PluginContainer* pluginContainer(); QWidget* parentWidgetForDialogs(); diff --git a/src/src/settingsdialogpaths.h b/src/src/settingsdialogpaths.h index d7de302..90311e4 100644 --- a/src/src/settingsdialogpaths.h +++ b/src/src/settingsdialogpaths.h @@ -26,7 +26,7 @@ private: void on_overwriteDirEdit_editingFinished(); void on_profilesDirEdit_editingFinished(); - void normalizePath(QLineEdit* lineEdit); + static void normalizePath(QLineEdit* lineEdit); QDir m_gameDir; }; diff --git a/src/src/settingsdialogplugins.cpp b/src/src/settingsdialogplugins.cpp index 879ea0d..fabef4c 100644 --- a/src/src/settingsdialogplugins.cpp +++ b/src/src/settingsdialogplugins.cpp @@ -176,7 +176,7 @@ void PluginsSettingsTab::filterPluginList() } } -IPlugin* PluginsSettingsTab::plugin(QTreeWidgetItem* pluginItem) const +IPlugin* PluginsSettingsTab::plugin(QTreeWidgetItem* pluginItem) { return static_cast(qvariant_cast(pluginItem->data(0, PluginRole))); } diff --git a/src/src/settingsdialogplugins.h b/src/src/settingsdialogplugins.h index b354364..400e390 100644 --- a/src/src/settingsdialogplugins.h +++ b/src/src/settingsdialogplugins.h @@ -39,7 +39,7 @@ private slots: * @brief Retrieve the plugin associated to the given item in the list. * */ - MOBase::IPlugin* plugin(QTreeWidgetItem* pluginItem) const; + static MOBase::IPlugin* plugin(QTreeWidgetItem* pluginItem) ; enum { diff --git a/src/src/settingsdialogproton.h b/src/src/settingsdialogproton.h index 966a980..5eee3bd 100644 --- a/src/src/settingsdialogproton.h +++ b/src/src/settingsdialogproton.h @@ -34,8 +34,8 @@ private: void onBrowsePrefixLocation(); void onDownloadSLR(); - QString ensureWinetricks(); - QString findProtonWine(const QString& protonPath); + static QString ensureWinetricks(); + static QString findProtonWine(const QString& protonPath); void runPrefixSetupDialog(uint32_t appId, const QString& prefixPath, const QString& protonName, const QString& protonPath); diff --git a/src/src/settingsdialogtheme.h b/src/src/settingsdialogtheme.h index de1aa2c..0d60f5c 100644 --- a/src/src/settingsdialogtheme.h +++ b/src/src/settingsdialogtheme.h @@ -16,7 +16,7 @@ public: private: void addStyles(); void selectStyle(); - void onExploreStyles(); + static void onExploreStyles(); }; #endif // SETTINGSDIALOGGENERAL_H diff --git a/src/src/settingsdialogworkarounds.h b/src/src/settingsdialogworkarounds.h index 76a1720..03561b4 100644 --- a/src/src/settingsdialogworkarounds.h +++ b/src/src/settingsdialogworkarounds.h @@ -39,7 +39,7 @@ private: QStringList m_SkipFileSuffixes; QStringList m_SkipDirectories; - void on_bsaDateBtn_clicked(); + static void on_bsaDateBtn_clicked(); void on_execBlacklistBtn_clicked(); void on_skipFileSuffixBtn_clicked(); void on_skipDirectoriesBtn_clicked(); diff --git a/src/src/shared/util.cpp b/src/src/shared/util.cpp index 603cad2..3413458 100644 --- a/src/src/shared/util.cpp +++ b/src/src/shared/util.cpp @@ -137,8 +137,8 @@ Version createVersionInfo() return Version(FLUORINE_VERSION_MAJOR, FLUORINE_VERSION_MINOR, FLUORINE_VERSION_PATCH, 0, {Version::Development}); #else - return Version(FLUORINE_VERSION_MAJOR, FLUORINE_VERSION_MINOR, - FLUORINE_VERSION_PATCH, 0); + return {FLUORINE_VERSION_MAJOR, FLUORINE_VERSION_MINOR, + FLUORINE_VERSION_PATCH, 0}; #endif } diff --git a/src/src/shared/windows_error.h b/src/src/shared/windows_error.h index c1eac82..f7b7784 100644 --- a/src/src/shared/windows_error.h +++ b/src/src/shared/windows_error.h @@ -36,7 +36,7 @@ public: int getErrorCode() const { return m_ErrorCode; } private: - std::string constructMessage(const std::string& input, int errorcode); + static std::string constructMessage(const std::string& input, int errorcode); private: int m_ErrorCode; diff --git a/src/src/statusbar.cpp b/src/src/statusbar.cpp index 70c83af..7efb64d 100644 --- a/src/src/statusbar.cpp +++ b/src/src/statusbar.cpp @@ -219,7 +219,7 @@ void StatusBarAction::mouseDoubleClickEvent(QMouseEvent* e) } } -QString StatusBarAction::cleanupActionText(const QString& original) const +QString StatusBarAction::cleanupActionText(const QString& original) { QString s = original; diff --git a/src/src/statusbar.h b/src/src/statusbar.h index 4910ed6..4f45241 100644 --- a/src/src/statusbar.h +++ b/src/src/statusbar.h @@ -29,7 +29,7 @@ private: QLabel* m_icon; QLabel* m_text; - QString cleanupActionText(const QString& s) const; + static QString cleanupActionText(const QString& s) ; }; class StatusBar : public QStatusBar diff --git a/src/src/texteditor.cpp b/src/src/texteditor.cpp index 55684f4..b01d6d9 100644 --- a/src/src/texteditor.cpp +++ b/src/src/texteditor.cpp @@ -393,7 +393,7 @@ TextEditorLineNumbers::TextEditorLineNumbers(TextEditor& editor) QSize TextEditorLineNumbers::sizeHint() const { - return QSize(areaWidth(), 0); + return {areaWidth(), 0}; } int TextEditorLineNumbers::areaWidth() const diff --git a/src/src/transfersavesdialog.h b/src/src/transfersavesdialog.h index 8cd329e..f2bfecc 100644 --- a/src/src/transfersavesdialog.h +++ b/src/src/transfersavesdialog.h @@ -102,7 +102,7 @@ private: SaveCollection m_LocalSaves; void refreshSaves(SaveCollection& saveCollection, const QString& savedir); - void refreshCharacters(SaveCollection const& saveCollection, QListWidget* charList, + static void refreshCharacters(SaveCollection const& saveCollection, QListWidget* charList, QPushButton* copy, QPushButton* move); bool diff --git a/src/src/uilocker.cpp b/src/src/uilocker.cpp index bcb1eaa..09fc5ac 100644 --- a/src/src/uilocker.cpp +++ b/src/src/uilocker.cpp @@ -181,7 +181,7 @@ private: return m_mainUI; } - QWidget* createTransparentWidget(QWidget* parent = nullptr) + static QWidget* createTransparentWidget(QWidget* parent = nullptr) { auto* w = new QWidget(parent); @@ -395,7 +395,7 @@ const QString& UILocker::Session::name() const return m_name; } -UILocker::Results UILocker::Session::result() const +UILocker::Results UILocker::Session::result() { return UILocker::instance().result(); } diff --git a/src/src/uilocker.h b/src/src/uilocker.h index 8bb36b9..2fa4b6e 100644 --- a/src/src/uilocker.h +++ b/src/src/uilocker.h @@ -50,7 +50,7 @@ public: void unlock(); void setInfo(DWORD pid, const QString& name); - Results result() const; + static Results result() ; DWORD pid() const; const QString& name() const; diff --git a/src/src/vfs/overwritemanager.cpp b/src/src/vfs/overwritemanager.cpp index d5f84f3..7824704 100644 --- a/src/src/vfs/overwritemanager.cpp +++ b/src/src/vfs/overwritemanager.cpp @@ -45,7 +45,7 @@ std::string OverwriteManager::overwritePath(const std::string& relative_path) co } std::string OverwriteManager::copyOnWrite(const std::string& source_path, - const std::string& relative_path) + const std::string& relative_path) const { const fs::path dest = stagingPath(relative_path); @@ -78,7 +78,7 @@ std::string OverwriteManager::copyOnWrite(const std::string& source_path, } std::string OverwriteManager::copyOnWriteFromFd(int dir_fd, - const std::string& relative_path) + const std::string& relative_path) const { const fs::path dest = stagingPath(relative_path); @@ -116,7 +116,7 @@ std::string OverwriteManager::copyOnWriteFromFd(int dir_fd, } std::string OverwriteManager::writeFile(const std::string& relative_path, - const std::vector& data) + const std::vector& data) const { const fs::path path = stagingPath(relative_path); std::error_code ec; @@ -135,7 +135,7 @@ std::string OverwriteManager::writeFile(const std::string& relative_path, } bool OverwriteManager::rename(const std::string& old_relative, - const std::string& new_relative) + const std::string& new_relative) const { std::error_code ec; @@ -155,7 +155,7 @@ bool OverwriteManager::rename(const std::string& old_relative, return !ec; } -bool OverwriteManager::removeFile(const std::string& relative_path) +bool OverwriteManager::removeFile(const std::string& relative_path) const { std::error_code ec; fs::path staged = stagingPath(relative_path); @@ -172,7 +172,7 @@ bool OverwriteManager::removeFile(const std::string& relative_path) } bool OverwriteManager::removeDirectory(const std::string& relative_path, - bool* out_not_empty) + bool* out_not_empty) const { if (out_not_empty) *out_not_empty = false; @@ -200,7 +200,7 @@ bool OverwriteManager::removeDirectory(const std::string& relative_path, return removedAny; } -bool OverwriteManager::createDirectory(const std::string& relative_path) +bool OverwriteManager::createDirectory(const std::string& relative_path) const { std::error_code ec; fs::create_directories(stagingPath(relative_path), ec); diff --git a/src/src/vfs/overwritemanager.h b/src/src/vfs/overwritemanager.h index 4ce2fb8..ff23e18 100644 --- a/src/src/vfs/overwritemanager.h +++ b/src/src/vfs/overwritemanager.h @@ -11,17 +11,17 @@ public: OverwriteManager(const std::string& staging_dir, const std::string& overwrite_dir); std::string copyOnWrite(const std::string& source_path, - const std::string& relative_path); + const std::string& relative_path) const; - std::string copyOnWriteFromFd(int dir_fd, const std::string& relative_path); + std::string copyOnWriteFromFd(int dir_fd, const std::string& relative_path) const; std::string writeFile(const std::string& relative_path, - const std::vector& data); + const std::vector& data) const; - bool rename(const std::string& old_relative, const std::string& new_relative); - bool removeFile(const std::string& relative_path); - bool removeDirectory(const std::string& relative_path, bool* out_not_empty = nullptr); - bool createDirectory(const std::string& relative_path); + bool rename(const std::string& old_relative, const std::string& new_relative) const; + bool removeFile(const std::string& relative_path) const; + bool removeDirectory(const std::string& relative_path, bool* out_not_empty = nullptr) const; + bool createDirectory(const std::string& relative_path) const; bool exists(const std::string& relative_path) const; std::string overwritePath(const std::string& relative_path) const; -- cgit v1.3.1