diff options
71 files changed, 182 insertions, 191 deletions
diff --git a/src/src/modinforegular.h b/src/src/modinforegular.h index 3f32781..fb801fe 100644 --- a/src/src/modinforegular.h +++ b/src/src/modinforegular.h @@ -518,8 +518,8 @@ private: MOBase::VersionInfo m_NewestVersion;
MOBase::VersionInfo m_IgnoredVersion;
- MOBase::EndorsedState m_EndorsedState{EndorsedState::ENDORSED_UNKNOWN};
- MOBase::TrackedState m_TrackedState{TrackedState::TRACKED_UNKNOWN};
+ MOBase::EndorsedState m_EndorsedState{MOBase::EndorsedState::ENDORSED_UNKNOWN};
+ MOBase::TrackedState m_TrackedState{MOBase::TrackedState::TRACKED_UNKNOWN};
NexusBridge m_NexusBridge;
diff --git a/src/src/modlistproxy.h b/src/src/modlistproxy.h index 7fa5c70..9552658 100644 --- a/src/src/modlistproxy.h +++ b/src/src/modlistproxy.h @@ -11,7 +11,7 @@ class ModListProxy : public MOBase::IModList public:
ModListProxy(OrganizerProxy* oproxy, ModList* modlist);
- virtual ~ModListProxy();
+ ~ModListProxy() override;
QString displayName(const QString& internalName) const override;
QStringList allMods() const override;
diff --git a/src/src/modlistsortproxy.cpp b/src/src/modlistsortproxy.cpp index 81b9a17..6a1df60 100644 --- a/src/src/modlistsortproxy.cpp +++ b/src/src/modlistsortproxy.cpp @@ -38,9 +38,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. using namespace MOBase;
ModListSortProxy::ModListSortProxy(Profile* profile, OrganizerCore* organizer)
- : QSortFilterProxyModel(organizer), m_Organizer(organizer), m_Profile(profile),
- m_FilterActive(false), m_FilterMode(FilterAnd),
- m_FilterSeparators(SeparatorFilter)
+ : QSortFilterProxyModel(organizer), m_Organizer(organizer), m_Profile(profile)
+
{
setDynamicSortFilter(true); // this seems to work without dynamicsortfilter
// but I don't know why. This should be necessary
diff --git a/src/src/modlistsortproxy.h b/src/src/modlistsortproxy.h index 1f0238f..b41cf37 100644 --- a/src/src/modlistsortproxy.h +++ b/src/src/modlistsortproxy.h @@ -153,9 +153,9 @@ private: QString m_Filter;
std::bitset<ModList::COL_LASTCOLUMN + 1> m_EnabledColumns;
- bool m_FilterActive;
- FilterMode m_FilterMode;
- SeparatorsMode m_FilterSeparators;
+ bool m_FilterActive{false};
+ FilterMode m_FilterMode{FilterAnd};
+ SeparatorsMode m_FilterSeparators{SeparatorFilter};
std::vector<Criteria> m_PreChangeCriteria;
diff --git a/src/src/modlistview.cpp b/src/src/modlistview.cpp index 2cd6ba4..aa74f81 100644 --- a/src/src/modlistview.cpp +++ b/src/src/modlistview.cpp @@ -133,8 +133,7 @@ public: };
ModListView::ModListView(QWidget* parent)
- : QTreeView(parent), m_core(nullptr), m_sortProxy(nullptr),
- m_byPriorityProxy(nullptr), m_byCategoryProxy(nullptr), m_byNexusIdProxy(nullptr),
+ : QTreeView(parent),
m_markers{{}, {}, {}, {}, {}, {}},
m_scrollbar(new ModListViewMarkingScrollBar(this))
{
@@ -1143,18 +1142,16 @@ void ModListView::setHighlightedMods(const std::set<QString>& modNames) QColor ModListView::markerColor(const QModelIndex& index) const
{
unsigned int modIndex = index.data(ModList::IndexRole).toInt();
- bool highlight = m_markers.highlight.find(modIndex) != m_markers.highlight.end();
- bool overwrite = m_markers.overwrite.find(modIndex) != m_markers.overwrite.end();
+ bool highlight = m_markers.highlight.contains(modIndex);
+ bool overwrite = m_markers.overwrite.contains(modIndex);
bool archiveOverwrite =
- m_markers.archiveOverwrite.find(modIndex) != m_markers.archiveOverwrite.end();
- bool archiveLooseOverwrite = m_markers.archiveLooseOverwrite.find(modIndex) !=
- m_markers.archiveLooseOverwrite.end();
+ m_markers.archiveOverwrite.contains(modIndex);
+ bool archiveLooseOverwrite = m_markers.archiveLooseOverwrite.contains(modIndex);
bool overwritten =
- m_markers.overwritten.find(modIndex) != m_markers.overwritten.end();
+ m_markers.overwritten.contains(modIndex);
bool archiveOverwritten =
- m_markers.archiveOverwritten.find(modIndex) != m_markers.archiveOverwritten.end();
- bool archiveLooseOverwritten = m_markers.archiveLooseOverwritten.find(modIndex) !=
- m_markers.archiveLooseOverwritten.end();
+ m_markers.archiveOverwritten.contains(modIndex);
+ bool archiveLooseOverwritten = m_markers.archiveLooseOverwritten.contains(modIndex);
if (highlight) {
return Settings::instance().colors().modlistContainsFile();
diff --git a/src/src/modlistview.h b/src/src/modlistview.h index fd1508f..fcc6b42 100644 --- a/src/src/modlistview.h +++ b/src/src/modlistview.h @@ -320,16 +320,16 @@ private: // private functions void updateGroupByProxy();
public: // member variables
- OrganizerCore* m_core;
+ OrganizerCore* m_core{nullptr};
std::unique_ptr<FilterList> m_filters;
CategoryFactory* m_categories;
ModListViewUi ui;
ModListViewActions* m_actions;
- ModListSortProxy* m_sortProxy;
- ModListByPriorityProxy* m_byPriorityProxy;
- QtGroupingProxy* m_byCategoryProxy;
- QtGroupingProxy* m_byNexusIdProxy;
+ ModListSortProxy* m_sortProxy{nullptr};
+ ModListByPriorityProxy* m_byPriorityProxy{nullptr};
+ QtGroupingProxy* m_byCategoryProxy{nullptr};
+ QtGroupingProxy* m_byNexusIdProxy{nullptr};
// marker used to avoid calling refreshing markers to many
// time in a row
diff --git a/src/src/moshortcut.cpp b/src/src/moshortcut.cpp index 0172f50..1626c6c 100644 --- a/src/src/moshortcut.cpp +++ b/src/src/moshortcut.cpp @@ -3,8 +3,8 @@ #include <QDir>
MOShortcut::MOShortcut(const QString& link)
- : m_valid(link.startsWith("moshortcut://")), m_hasInstance(false),
- m_hasExecutable(false)
+ : m_valid(link.startsWith("moshortcut://"))
+
{
if (m_valid) {
int start = (int)strlen("moshortcut://");
diff --git a/src/src/moshortcut.h b/src/src/moshortcut.h index 1204be9..6786f93 100644 --- a/src/src/moshortcut.h +++ b/src/src/moshortcut.h @@ -45,8 +45,8 @@ private: QString m_instance;
QString m_executable;
bool m_valid;
- bool m_hasInstance;
- bool m_hasExecutable;
+ bool m_hasInstance{false};
+ bool m_hasExecutable{false};
};
#endif // MODORGANIZER_MOSHORTCUT_INCLUDED
diff --git a/src/src/multiprocess.cpp b/src/src/multiprocess.cpp index 73dbaab..9fc857c 100644 --- a/src/src/multiprocess.cpp +++ b/src/src/multiprocess.cpp @@ -12,7 +12,7 @@ static const int s_Timeout = 5000; using MOBase::reportError;
MOMultiProcess::MOMultiProcess(bool allowMultiple, QObject* parent)
- : QObject(parent), m_Ephemeral(false), m_OwnsSM(false)
+ : QObject(parent)
{
m_SharedMem.setKey(s_Key);
diff --git a/src/src/multiprocess.h b/src/src/multiprocess.h index 9c0d2d7..965447d 100644 --- a/src/src/multiprocess.h +++ b/src/src/multiprocess.h @@ -53,8 +53,8 @@ private slots: void receiveMessage();
private:
- bool m_Ephemeral;
- bool m_OwnsSM;
+ bool m_Ephemeral{false};
+ bool m_OwnsSM{false};
QSharedMemory m_SharedMem;
QLocalServer m_Server;
};
diff --git a/src/src/nexusinterface.cpp b/src/src/nexusinterface.cpp index 9de1b45..6d2f74a 100644 --- a/src/src/nexusinterface.cpp +++ b/src/src/nexusinterface.cpp @@ -271,7 +271,7 @@ NexusInterface::parseLimits(const QList<QNetworkReply::RawHeaderPair>& headers) static NexusInterface* g_instance = nullptr;
-NexusInterface::NexusInterface(Settings* s) : m_PluginContainer(nullptr)
+NexusInterface::NexusInterface(Settings* s)
{
MO_ASSERT(!g_instance);
g_instance = this;
@@ -1259,7 +1259,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo( m_Reroute(false), m_ID(s_NextID.fetchAndAddAcquire(1)),
m_URL(get_management_url()), m_SubModule(subModule),
m_NexusGameID(game->nexusGameID()), m_GameName(game->gameNexusName()),
- m_Endorse(false), m_Track(false), m_Hash(QByteArray())
+ m_Endorse(false), m_Track(false)
{}
NexusInterface::NXMRequestInfo::NXMRequestInfo(
@@ -1270,7 +1270,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo( m_Timeout(nullptr), m_Reroute(false), m_ID(s_NextID.fetchAndAddAcquire(1)),
m_URL(get_management_url()), m_SubModule(subModule),
m_NexusGameID(game->nexusGameID()), m_GameName(game->gameNexusName()),
- m_Endorse(false), m_Track(false), m_Hash(QByteArray())
+ m_Endorse(false), m_Track(false)
{}
NexusInterface::NXMRequestInfo::NXMRequestInfo(Type type, QVariant userData,
@@ -1281,7 +1281,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(Type type, QVariant userData, m_Reroute(false), m_ID(s_NextID.fetchAndAddAcquire(1)),
m_URL(get_management_url()), m_SubModule(subModule),
m_NexusGameID(game->nexusGameID()), m_GameName(game->gameNexusName()),
- m_Endorse(false), m_Track(false), m_Hash(QByteArray())
+ m_Endorse(false), m_Track(false)
{}
NexusInterface::NXMRequestInfo::NXMRequestInfo(
@@ -1292,7 +1292,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo( m_Timeout(nullptr), m_Reroute(false), m_ID(s_NextID.fetchAndAddAcquire(1)),
m_URL(get_management_url()), m_SubModule(subModule),
m_NexusGameID(game->nexusGameID()), m_GameName(game->gameNexusName()),
- m_Endorse(false), m_Track(false), m_Hash(QByteArray())
+ m_Endorse(false), m_Track(false)
{}
NexusInterface::NXMRequestInfo::NXMRequestInfo(Type type, QVariant userData,
@@ -1301,7 +1301,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(Type type, QVariant userData, m_UpdatePeriod(UpdatePeriod::NONE), m_UserData(userData), m_Timeout(nullptr),
m_Reroute(false), m_ID(s_NextID.fetchAndAddAcquire(1)),
m_URL(get_management_url()), m_SubModule(subModule), m_NexusGameID(0),
- m_GameName(""), m_Endorse(false), m_Track(false), m_Hash(QByteArray())
+ m_GameName(""), m_Endorse(false), m_Track(false)
{}
NexusInterface::NXMRequestInfo::NXMRequestInfo(
@@ -1312,7 +1312,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo( m_Reroute(false), m_ID(s_NextID.fetchAndAddAcquire(1)),
m_URL(get_management_url()), m_SubModule(subModule),
m_NexusGameID(game->nexusGameID()), m_GameName(game->gameNexusName()),
- m_Endorse(false), m_Track(false), m_Hash(QByteArray())
+ m_Endorse(false), m_Track(false)
{}
NexusInterface::NXMRequestInfo::NXMRequestInfo(
diff --git a/src/src/nexusinterface.h b/src/src/nexusinterface.h index 8823b28..a027268 100644 --- a/src/src/nexusinterface.h +++ b/src/src/nexusinterface.h @@ -686,7 +686,7 @@ private: NXMAccessManager* m_AccessManager;
std::list<NXMRequestInfo> m_ActiveRequest;
QQueue<NXMRequestInfo> m_RequestQueue;
- PluginContainer* m_PluginContainer;
+ PluginContainer* m_PluginContainer{nullptr};
APIUserAccount m_User;
};
diff --git a/src/src/noeditdelegate.h b/src/src/noeditdelegate.h index 8a55eef..0c304d1 100644 --- a/src/src/noeditdelegate.h +++ b/src/src/noeditdelegate.h @@ -7,8 +7,8 @@ class NoEditDelegate : public QStyledItemDelegate {
public:
NoEditDelegate(QObject* parent = nullptr);
- virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
- const QModelIndex& index) const;
+ QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
+ const QModelIndex& index) const override;
};
#endif // NOEDITDELEGATE_H
diff --git a/src/src/nxmaccessmanager.cpp b/src/src/nxmaccessmanager.cpp index ad9b0bd..83bc139 100644 --- a/src/src/nxmaccessmanager.cpp +++ b/src/src/nxmaccessmanager.cpp @@ -48,7 +48,7 @@ const QString NexusSSOPage("https://www.nexusmods.com/sso?id=%1&application=modorganizer2");
ValidationProgressDialog::ValidationProgressDialog(Settings* s, NexusKeyValidator& v)
- : m_settings(s), m_validator(v), m_updateTimer(nullptr), m_first(true)
+ : m_settings(s), m_validator(v)
{
ui.reset(new Ui::ValidationProgressDialog);
ui->setupUi(this);
@@ -153,7 +153,7 @@ void ValidationProgressDialog::updateProgress() }
}
-NexusSSOLogin::NexusSSOLogin() : m_keyReceived(false), m_active(false)
+NexusSSOLogin::NexusSSOLogin()
{
m_timeout.setInterval(10s);
m_timeout.setSingleShot(true);
@@ -357,7 +357,7 @@ void NexusSSOLogin::onTimeout() }
ValidationAttempt::ValidationAttempt(std::chrono::seconds timeout)
- : m_reply(nullptr), m_result(None)
+
{
m_timeout.setSingleShot(true);
m_timeout.setInterval(timeout);
@@ -765,7 +765,7 @@ void NexusKeyValidator::setFinished(ValidationAttempt::Result r, const QString& NXMAccessManager::NXMAccessManager(QObject* parent, Settings* s,
const QString& moVersion)
: QNetworkAccessManager(parent), m_Settings(s), m_MOVersion(moVersion),
- m_validator(s, *this), m_validationState(NotChecked)
+ m_validator(s, *this)
{
m_validator.finished = [&](auto&& r, auto&& m, auto&& u) {
onValidatorFinished(r, m, u);
diff --git a/src/src/nxmaccessmanager.h b/src/src/nxmaccessmanager.h index ecc2de8..1c78fe8 100644 --- a/src/src/nxmaccessmanager.h +++ b/src/src/nxmaccessmanager.h @@ -68,8 +68,8 @@ public: private:
QWebSocket m_socket;
QString m_guid;
- bool m_keyReceived;
- bool m_active;
+ bool m_keyReceived{false};
+ bool m_active{false};
QTimer m_timeout;
void setState(States s, const QString& error = {});
@@ -114,8 +114,8 @@ public: QElapsedTimer elapsed() const;
private:
- QNetworkReply* m_reply;
- Result m_result;
+ QNetworkReply* m_reply{nullptr};
+ Result m_result{None};
QString m_message;
QTimer m_timeout;
QElapsedTimer m_elapsed;
@@ -194,8 +194,8 @@ private: std::unique_ptr<Ui::ValidationProgressDialog> ui;
Settings* m_settings;
NexusKeyValidator& m_validator;
- QTimer* m_updateTimer;
- bool m_first;
+ QTimer* m_updateTimer{nullptr};
+ bool m_first{true};
void onHide();
void onCancel();
@@ -269,7 +269,7 @@ private: mutable std::unique_ptr<ValidationProgressDialog> m_ProgressDialog;
QString m_MOVersion;
NexusKeyValidator m_validator;
- States m_validationState;
+ States m_validationState{NotChecked};
void startValidationCheck(const QString& key);
diff --git a/src/src/organizercore.cpp b/src/src/organizercore.cpp index e4fa162..4c37670 100644 --- a/src/src/organizercore.cpp +++ b/src/src/organizercore.cpp @@ -235,7 +235,7 @@ QString resolveAbsoluteSaveDir(const WinePrefix& prefix, }
OrganizerCore::OrganizerCore(Settings& settings)
- : m_UserInterface(nullptr), m_PluginContainer(nullptr), m_GamePlugin(nullptr),
+ :
m_CurrentProfile(nullptr), m_Settings(settings),
m_Updater(&NexusInterface::instance()), m_ModList(m_PluginContainer, this),
m_PluginList(*this),
@@ -245,7 +245,7 @@ OrganizerCore::OrganizerCore(Settings& settings) return VirtualFileTree::makeTree(m_DirectoryStructure);
}),
m_DownloadManager(&NexusInterface::instance(), this), m_DirectoryUpdate(false),
- m_ArchivesInit(false),
+
m_PluginListsWriter(std::bind(&OrganizerCore::savePluginList, this))
{
env::setHandleCloserThreadCount(settings.refreshThreadCount());
@@ -640,7 +640,7 @@ bool OrganizerCore::bootstrap() void OrganizerCore::createDefaultProfile()
{
QString profilesPath = settings().paths().profiles();
- if (QDir(profilesPath).entryList(QDir::AllDirs | QDir::NoDotAndDotDot).size() == 0) {
+ if (QDir(profilesPath).entryList(QDir::AllDirs | QDir::NoDotAndDotDot).empty()) {
Profile newProf(QString::fromStdWString(AppConfig::defaultProfileName()),
managedGame(), gameFeatures(), false);
@@ -1358,7 +1358,7 @@ bool OrganizerCore::previewFileWithAlternatives(QWidget* parent, QString fileNam } else {
preview->addVariant(ToQString(origin.getName()), wid);
}
- } else if (archiveName != L"") {
+ } else if (!archiveName.empty()) {
auto archiveFile = directoryStructure()->searchFile(archiveName);
if (archiveFile.get() != nullptr) {
try {
@@ -1619,7 +1619,7 @@ void OrganizerCore::refreshBSAList() // happen if ini files are missing) use hard-coded defaults (preferrably the
// same the game would use)
m_DefaultArchives = archives->archives(m_CurrentProfile.get());
- if (m_DefaultArchives.length() == 0) {
+ if (m_DefaultArchives.empty()) {
m_DefaultArchives = archives->vanillaArchives();
}
diff --git a/src/src/organizercore.h b/src/src/organizercore.h index ca73ba9..7783511 100644 --- a/src/src/organizercore.h +++ b/src/src/organizercore.h @@ -545,10 +545,10 @@ private: static constexpr unsigned int PROBLEM_MO1SCRIPTEXTENDERWORKAROUND = 1;
private:
- IUserInterface* m_UserInterface;
- PluginContainer* m_PluginContainer;
+ IUserInterface* m_UserInterface{nullptr};
+ PluginContainer* m_PluginContainer{nullptr};
QString m_GameName;
- MOBase::IPluginGame* m_GamePlugin;
+ MOBase::IPluginGame* m_GamePlugin{nullptr};
ModDataContentHolder m_Contents;
std::shared_ptr<Profile> m_CurrentProfile;
@@ -593,7 +593,7 @@ private: std::thread m_StructureDeleter;
std::atomic<bool> m_DirectoryUpdate;
- bool m_ArchivesInit;
+ bool m_ArchivesInit{false};
MOBase::DelayedFileWriter m_PluginListsWriter;
FuseConnector m_USVFS;
diff --git a/src/src/overwriteinfodialog.cpp b/src/src/overwriteinfodialog.cpp index 36735ac..7a4c942 100644 --- a/src/src/overwriteinfodialog.cpp +++ b/src/src/overwriteinfodialog.cpp @@ -29,9 +29,8 @@ using namespace MOBase; OverwriteInfoDialog::OverwriteInfoDialog(ModInfo::Ptr modInfo, OrganizerCore& organizer,
QWidget* parent)
- : QDialog(parent), m_Organizer(organizer), ui(new Ui::OverwriteInfoDialog),
- m_FileSystemModel(nullptr), m_DeleteAction(nullptr), m_RenameAction(nullptr),
- m_OpenAction(nullptr)
+ : QDialog(parent), m_Organizer(organizer), ui(new Ui::OverwriteInfoDialog)
+
{
ui->setupUi(this);
diff --git a/src/src/overwriteinfodialog.h b/src/src/overwriteinfodialog.h index ac54fa1..2984c40 100644 --- a/src/src/overwriteinfodialog.h +++ b/src/src/overwriteinfodialog.h @@ -136,11 +136,11 @@ private slots: private:
Ui::OverwriteInfoDialog* ui;
- QFileSystemModel* m_FileSystemModel;
+ QFileSystemModel* m_FileSystemModel{nullptr};
QModelIndexList m_FileSelection;
- QAction* m_DeleteAction;
- QAction* m_RenameAction;
- QAction* m_OpenAction;
+ QAction* m_DeleteAction{nullptr};
+ QAction* m_RenameAction{nullptr};
+ QAction* m_OpenAction{nullptr};
QAction* m_NewFolderAction;
ModInfo::Ptr m_ModInfo;
diff --git a/src/src/persistentcookiejar.h b/src/src/persistentcookiejar.h index f545211..6403a30 100644 --- a/src/src/persistentcookiejar.h +++ b/src/src/persistentcookiejar.h @@ -9,8 +9,8 @@ class PersistentCookieJar : public QNetworkCookieJar Q_OBJECT
public:
- PersistentCookieJar(const QString& fileName, QObject* parent = 0);
- virtual ~PersistentCookieJar();
+ PersistentCookieJar(const QString& fileName, QObject* parent = nullptr);
+ ~PersistentCookieJar() override;
void clear();
diff --git a/src/src/plugincontainer.cpp b/src/src/plugincontainer.cpp index a5189cc..41b39f8 100644 --- a/src/src/plugincontainer.cpp +++ b/src/src/plugincontainer.cpp @@ -158,7 +158,7 @@ PluginRequirements::PluginRequirements(PluginContainer* pluginContainer, MOBase::IPlugin* plugin, OrganizerProxy* proxy,
MOBase::IPluginProxy* pluginProxy)
: m_PluginContainer(pluginContainer), m_Plugin(plugin), m_PluginProxy(pluginProxy),
- m_Master(nullptr), m_Organizer(proxy)
+ m_Organizer(proxy)
{
// There are a lots of things we cannot set here (e.g. m_Master) because we do not
// know the order plugins are loaded.
@@ -326,7 +326,7 @@ void PluginRequirements::requiredFor(std::vector<MOBase::IPlugin*>& required, // PluginContainer
PluginContainer::PluginContainer(OrganizerCore* organizer)
- : m_Organizer(organizer), m_UserInterface(nullptr),
+ : m_Organizer(organizer),
m_GameFeatures(std::make_unique<GameFeatures>(organizer, this)),
m_PreviewGenerator(*this)
{}
@@ -1370,7 +1370,7 @@ void PluginContainer::loadPlugins() std::vector<unsigned int> PluginContainer::activeProblems() const
{
std::vector<unsigned int> problems;
- if (m_FailedPlugins.size()) {
+ if (!m_FailedPlugins.empty()) {
problems.push_back(PROBLEM_PLUGINSNOTLOADED);
}
return problems;
diff --git a/src/src/plugincontainer.h b/src/src/plugincontainer.h index c8c11a5..ec18475 100644 --- a/src/src/plugincontainer.h +++ b/src/src/plugincontainer.h @@ -111,7 +111,7 @@ private: PluginContainer* m_PluginContainer;
MOBase::IPlugin* m_Plugin;
MOBase::IPluginProxy* m_PluginProxy;
- MOBase::IPlugin* m_Master;
+ MOBase::IPlugin* m_Master{nullptr};
std::vector<std::shared_ptr<const MOBase::IPluginRequirement>> m_Requirements;
OrganizerProxy* m_Organizer;
std::vector<MOBase::IPlugin*> m_RequiredFor;
@@ -486,7 +486,7 @@ private: OrganizerCore* m_Organizer;
// Main user interface, can be null until MW has been initialized.
- IUserInterface* m_UserInterface;
+ IUserInterface* m_UserInterface{nullptr};
// Game features
std::unique_ptr<GameFeatures> m_GameFeatures;
diff --git a/src/src/pluginlist.cpp b/src/src/pluginlist.cpp index 49fa323..56bee56 100644 --- a/src/src/pluginlist.cpp +++ b/src/src/pluginlist.cpp @@ -163,7 +163,7 @@ void PluginList::highlightPlugins(const std::vector<unsigned int>& modIndices, }
const MOShared::FilesOrigin& origin =
directoryEntry.getOriginByName(selectedMod->internalName().toStdWString());
- if (plugins.size() > 0) {
+ if (!plugins.empty()) {
for (auto plugin : plugins) {
MOShared::FileEntryPtr file = directoryEntry.findFile(plugin.toStdWString());
if (file && file->getOrigin() != origin.getID()) {
@@ -552,7 +552,7 @@ void PluginList::sendToPriority(const QModelIndexList& indices, int newPriority) pluginsToMove.push_back(idx.row());
}
}
- if (pluginsToMove.size()) {
+ if (!pluginsToMove.empty()) {
changePluginPriority(pluginsToMove, newPriority);
}
}
@@ -826,7 +826,7 @@ QString PluginList::getIndexPriority(int index) const bool PluginList::isESPLocked(int index) const
{
- return m_LockedOrder.find(m_ESPs.at(index).name) != m_LockedOrder.end();
+ return m_LockedOrder.contains(m_ESPs.at(index).name);
}
void PluginList::lockESPIndex(int index, bool lock)
@@ -1274,7 +1274,7 @@ void PluginList::testMasters() iter.masterUnset.clear();
if (iter.enabled) {
for (const auto& master : iter.masters) {
- if (enabledMasters.find(master) == enabledMasters.end()) {
+ if (!enabledMasters.contains(master)) {
iter.masterUnset.insert(master);
}
}
@@ -1448,7 +1448,7 @@ QVariant PluginList::tooltipData(const QModelIndex& modelIndex) const "<br><b>" + tr("Description") + "</b>: " + TruncateString(esp.description);
}
- if (esp.masterUnset.size() > 0) {
+ if (!esp.masterUnset.empty()) {
toolTip +=
"<br><b>" + tr("Missing Masters") + "</b>: " + "<b>" +
TruncateString(
@@ -1571,7 +1571,7 @@ QVariant PluginList::iconData(const QModelIndex& modelIndex) const result.append(":/MO/gui/warning");
}
- if (m_LockedOrder.find(esp.name) != m_LockedOrder.end()) {
+ if (m_LockedOrder.contains(esp.name)) {
result.append(":/MO/gui/locked");
}
@@ -1611,7 +1611,7 @@ QVariant PluginList::iconData(const QModelIndex& modelIndex) const bool PluginList::isProblematic(const ESPInfo& esp, const AdditionalInfo*) const
{
- return esp.masterUnset.size() > 0;
+ return !esp.masterUnset.empty();
}
bool PluginList::hasInfo(const ESPInfo&, const AdditionalInfo* info) const
@@ -1907,10 +1907,9 @@ PluginList::ESPInfo::ESPInfo(const QString& name, bool forceLoaded, bool forceEn std::set<QString> archives, bool lightSupported,
bool mediumSupported, bool blueprintSupported)
: name(name), fullPath(fullPath), enabled(forceLoaded), forceLoaded(forceLoaded),
- forceEnabled(forceEnabled), forceDisabled(forceDisabled), priority(0),
- loadOrder(-1), originName(originName), hasIni(hasIni),
- archives(archives.begin(), archives.end()), modSelected(false),
- isMasterOfSelectedPlugin(false)
+ forceEnabled(forceEnabled), forceDisabled(forceDisabled), originName(originName), hasIni(hasIni),
+ archives(archives.begin(), archives.end())
+
{
QString parsePath = fullPath;
// Linux is case-sensitive while Windows-authored paths sometimes mismatch
diff --git a/src/src/pluginlist.h b/src/src/pluginlist.h index 0f4747c..ec1f865 100644 --- a/src/src/pluginlist.h +++ b/src/src/pluginlist.h @@ -333,9 +333,9 @@ private: bool forceLoaded;
bool forceEnabled;
bool forceDisabled;
- int priority;
+ int priority{0};
QString index;
- int loadOrder;
+ int loadOrder{-1};
FILETIME time;
QString originName;
bool hasMasterExtension;
@@ -345,8 +345,8 @@ private: bool isLightFlagged;
bool isBlueprintFlagged;
bool hasNoRecords;
- bool modSelected;
- bool isMasterOfSelectedPlugin;
+ bool modSelected{false};
+ bool isMasterOfSelectedPlugin{false};
int formVersion;
float headerVersion;
QString author;
diff --git a/src/src/pluginlistproxy.h b/src/src/pluginlistproxy.h index dbcccea..d390d85 100644 --- a/src/src/pluginlistproxy.h +++ b/src/src/pluginlistproxy.h @@ -10,7 +10,7 @@ class PluginListProxy : public MOBase::IPluginList {
public:
PluginListProxy(OrganizerProxy* oproxy, PluginList* pluginlist);
- virtual ~PluginListProxy();
+ ~PluginListProxy() override;
QStringList pluginNames() const override;
PluginStates state(const QString& name) const override;
diff --git a/src/src/pluginlistsortproxy.cpp b/src/src/pluginlistsortproxy.cpp index b7fb797..16be804 100644 --- a/src/src/pluginlistsortproxy.cpp +++ b/src/src/pluginlistsortproxy.cpp @@ -26,7 +26,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QWidgetAction>
PluginListSortProxy::PluginListSortProxy(QObject* parent) - : QSortFilterProxyModel(parent), m_SortIndex(0), m_SortOrder(Qt::AscendingOrder) + : QSortFilterProxyModel(parent) { m_EnabledColumns.set(PluginList::COL_NAME);
m_EnabledColumns.set(PluginList::COL_PRIORITY);
diff --git a/src/src/pluginlistsortproxy.h b/src/src/pluginlistsortproxy.h index 73d439d..3d05005 100644 --- a/src/src/pluginlistsortproxy.h +++ b/src/src/pluginlistsortproxy.h @@ -35,12 +35,12 @@ public: };
public:
- explicit PluginListSortProxy(QObject* parent = 0);
+ explicit PluginListSortProxy(QObject* parent = nullptr);
void setEnabledColumns(unsigned int columns);
- virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row,
- int column, const QModelIndex& parent);
+ bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row,
+ int column, const QModelIndex& parent) override;
bool filterMatchesPlugin(const QString& plugin) const;
@@ -49,13 +49,13 @@ public slots: void updateFilter(const QString& filter);
protected:
- virtual bool filterAcceptsRow(int row, const QModelIndex& parent) const;
- virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
+ bool filterAcceptsRow(int row, const QModelIndex& parent) const override;
+ bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
private: void refreshFilter(); - int m_SortIndex; - Qt::SortOrder m_SortOrder;
+ int m_SortIndex{0}; + Qt::SortOrder m_SortOrder{Qt::AscendingOrder};
std::bitset<PluginList::COL_LASTCOLUMN + 1> m_EnabledColumns;
QString m_CurrentFilter;
diff --git a/src/src/pluginlistview.cpp b/src/src/pluginlistview.cpp index 7fc4c93..a37cbc9 100644 --- a/src/src/pluginlistview.cpp +++ b/src/src/pluginlistview.cpp @@ -24,7 +24,7 @@ using namespace MOBase;
PluginListView::PluginListView(QWidget* parent)
- : QTreeView(parent), m_sortProxy(nullptr),
+ : QTreeView(parent),
m_Scrollbar(new ViewMarkingScrollBar(this, Qt::BackgroundRole))
{
setVerticalScrollBar(m_Scrollbar);
diff --git a/src/src/pluginlistview.h b/src/src/pluginlistview.h index 3b47471..9b1171f 100644 --- a/src/src/pluginlistview.h +++ b/src/src/pluginlistview.h @@ -75,7 +75,7 @@ private: OrganizerCore* m_core;
PluginListViewUi ui;
- PluginListSortProxy* m_sortProxy;
+ PluginListSortProxy* m_sortProxy{nullptr};
ModListViewActions* m_modActions;
ViewMarkingScrollBar* m_Scrollbar;
};
diff --git a/src/src/problemsdialog.cpp b/src/src/problemsdialog.cpp index b4ce7fa..c22b298 100644 --- a/src/src/problemsdialog.cpp +++ b/src/src/problemsdialog.cpp @@ -11,8 +11,8 @@ using namespace MOBase;
ProblemsDialog::ProblemsDialog(const PluginContainer& pluginContainer, QWidget* parent)
- : QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginContainer(pluginContainer),
- m_hasProblems(false)
+ : QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginContainer(pluginContainer)
+
{
ui->setupUi(this);
ui->problemsWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
@@ -99,7 +99,7 @@ void ProblemsDialog::selectionChanged() void ProblemsDialog::startFix()
{
QObject* fixButton = QObject::sender();
- if (fixButton == NULL) {
+ if (fixButton == nullptr) {
log::warn("no button");
return;
}
diff --git a/src/src/problemsdialog.h b/src/src/problemsdialog.h index 1f2fe09..0bacc60 100644 --- a/src/src/problemsdialog.h +++ b/src/src/problemsdialog.h @@ -38,7 +38,7 @@ private slots: private:
Ui::ProblemsDialog* ui;
const PluginContainer& m_PluginContainer;
- bool m_hasProblems;
+ bool m_hasProblems{false};
};
#endif // PROBLEMSDIALOG_H
diff --git a/src/src/processrunner.cpp b/src/src/processrunner.cpp index 99e1742..3e585e6 100644 --- a/src/src/processrunner.cpp +++ b/src/src/processrunner.cpp @@ -787,8 +787,8 @@ ProcessRunner::Results waitForProcesses(const std::vector<HANDLE>& initialProces } ProcessRunner::ProcessRunner(OrganizerCore& core, IUserInterface* ui) - : m_core(core), m_ui(ui), m_lockReason(UILocker::NoReason), - m_waitFlags(NoFlags), m_handle(INVALID_HANDLE_VALUE), m_exitCode(-1) + : m_core(core), m_ui(ui), + m_waitFlags(NoFlags), m_handle(INVALID_HANDLE_VALUE) { // all processes started in ProcessRunner are hooked by default setHooked(true); diff --git a/src/src/processrunner.h b/src/src/processrunner.h index 76ed364..b648771 100644 --- a/src/src/processrunner.h +++ b/src/src/processrunner.h @@ -159,11 +159,11 @@ private: QString m_customOverwrite;
ForcedLibraries m_forcedLibraries;
QString m_profileName;
- UILocker::Reasons m_lockReason;
+ UILocker::Reasons m_lockReason{UILocker::NoReason};
WaitFlags m_waitFlags;
QFileInfo m_shellOpen;
env::HandlePtr m_handle;
- DWORD m_exitCode;
+ DWORD m_exitCode{static_cast<DWORD>(-1)};
bool shouldRunShell() const;
bool shouldRefresh(Results r) const;
diff --git a/src/src/profile.cpp b/src/src/profile.cpp index cf74cad..f9e852a 100644 --- a/src/src/profile.cpp +++ b/src/src/profile.cpp @@ -472,7 +472,7 @@ void Profile::refreshModStatus() }
// check if the name was already read
- if (namesRead.find(modName) != namesRead.end()) {
+ if (namesRead.contains(modName)) {
continue;
}
namesRead.insert(modName);
diff --git a/src/src/profileinputdialog.h b/src/src/profileinputdialog.h index 7e740f0..ca3b428 100644 --- a/src/src/profileinputdialog.h +++ b/src/src/profileinputdialog.h @@ -32,8 +32,8 @@ class ProfileInputDialog : public QDialog Q_OBJECT
public:
- explicit ProfileInputDialog(QWidget* parent = 0);
- ~ProfileInputDialog();
+ explicit ProfileInputDialog(QWidget* parent = nullptr);
+ ~ProfileInputDialog() override;
QString getName() const;
bool getPreferDefaultSettings() const;
diff --git a/src/src/protonlauncher.cpp b/src/src/protonlauncher.cpp index d9b371a..6ec11e1 100644 --- a/src/src/protonlauncher.cpp +++ b/src/src/protonlauncher.cpp @@ -342,7 +342,7 @@ bool parseEnvAssignment(const QString& token, QString& keyOut, QString& valueOut } // namespace ProtonLauncher::ProtonLauncher() - : m_steamAppId(0), m_useSteamDrm(true) + {} ProtonLauncher& ProtonLauncher::setBinary(const QString& path) diff --git a/src/src/protonlauncher.h b/src/src/protonlauncher.h index 9026921..25c4b16 100644 --- a/src/src/protonlauncher.h +++ b/src/src/protonlauncher.h @@ -52,9 +52,9 @@ private: QString m_workingDir; QString m_protonPath; QString m_prefixPath; - uint32_t m_steamAppId; + uint32_t m_steamAppId{0}; QStringList m_wrapperCommands; - bool m_useSteamDrm; + bool m_useSteamDrm{true}; bool m_useSteamOverlay = false; bool m_useSLR = true; QString m_storeVariant; // "GOG", "Epic", or empty for Steam diff --git a/src/src/qtgroupingproxy.cpp b/src/src/qtgroupingproxy.cpp index 0983e15..af5ea8b 100644 --- a/src/src/qtgroupingproxy.cpp +++ b/src/src/qtgroupingproxy.cpp @@ -34,7 +34,7 @@ using namespace MOBase; QtGroupingProxy::QtGroupingProxy(QModelIndex rootNode, int groupedColumn,
int groupedRole, unsigned int flags, int aggregateRole)
- : QAbstractProxyModel(), m_rootNode(rootNode), m_groupedColumn(0),
+ : m_rootNode(rootNode),
m_groupedRole(groupedRole), m_aggregateRole(aggregateRole), m_flags(flags)
{
if (groupedColumn != -1) {
diff --git a/src/src/qtgroupingproxy.h b/src/src/qtgroupingproxy.h index 11868e8..9b980eb 100644 --- a/src/src/qtgroupingproxy.h +++ b/src/src/qtgroupingproxy.h @@ -138,7 +138,7 @@ protected: QModelIndexList m_selectedGroups;
QModelIndex m_rootNode;
- int m_groupedColumn;
+ int m_groupedColumn{0};
/* debug function */
void dumpGroups() const;
diff --git a/src/src/queryoverwritedialog.cpp b/src/src/queryoverwritedialog.cpp index 8454f58..bbbf1fe 100644 --- a/src/src/queryoverwritedialog.cpp +++ b/src/src/queryoverwritedialog.cpp @@ -23,7 +23,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QStyle>
QueryOverwriteDialog::QueryOverwriteDialog(QWidget* parent, Backup b)
- : QDialog(parent), ui(new Ui::QueryOverwriteDialog), m_Action(ACT_NONE)
+ : QDialog(parent), ui(new Ui::QueryOverwriteDialog)
{
ui->setupUi(this);
ui->backupBox->setChecked(b == BACKUP_YES);
diff --git a/src/src/queryoverwritedialog.h b/src/src/queryoverwritedialog.h index eab5c9b..450d3e7 100644 --- a/src/src/queryoverwritedialog.h +++ b/src/src/queryoverwritedialog.h @@ -58,7 +58,7 @@ private slots: private:
Ui::QueryOverwriteDialog* ui;
- Action m_Action;
+ Action m_Action{ACT_NONE};
};
#endif // QUERYOVERWRITEDIALOG_H
diff --git a/src/src/savetextasdialog.h b/src/src/savetextasdialog.h index 839722c..f61af6b 100644 --- a/src/src/savetextasdialog.h +++ b/src/src/savetextasdialog.h @@ -13,8 +13,8 @@ class SaveTextAsDialog : public QDialog Q_OBJECT
public:
- explicit SaveTextAsDialog(QWidget* parent = 0);
- ~SaveTextAsDialog();
+ explicit SaveTextAsDialog(QWidget* parent = nullptr);
+ ~SaveTextAsDialog() override;
void setText(const QString& text);
diff --git a/src/src/selectiondialog.cpp b/src/src/selectiondialog.cpp index 75c491f..319b4eb 100644 --- a/src/src/selectiondialog.cpp +++ b/src/src/selectiondialog.cpp @@ -24,8 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. SelectionDialog::SelectionDialog(const QString& description, QWidget* parent,
const QSize& iconSize)
- : QDialog(parent), ui(new Ui::SelectionDialog), m_Choice(nullptr),
- m_ValidateByData(false), m_IconSize(iconSize)
+ : QDialog(parent), ui(new Ui::SelectionDialog), m_IconSize(iconSize)
{
ui->setupUi(this);
diff --git a/src/src/selectiondialog.h b/src/src/selectiondialog.h index 5318bbd..b04086f 100644 --- a/src/src/selectiondialog.h +++ b/src/src/selectiondialog.h @@ -69,8 +69,8 @@ private slots: private:
Ui::SelectionDialog* ui;
- QAbstractButton* m_Choice;
- bool m_ValidateByData;
+ QAbstractButton* m_Choice{nullptr};
+ bool m_ValidateByData{false};
QSize m_IconSize;
};
diff --git a/src/src/settings.cpp b/src/src/settings.cpp index a98f609..3f48ae9 100644 --- a/src/src/settings.cpp +++ b/src/src/settings.cpp @@ -654,7 +654,7 @@ void Settings::managedGameChanged(IPluginGame const* gamePlugin) }
GameSettings::GameSettings(QSettings& settings)
- : m_Settings(settings), m_GamePlugin(nullptr)
+ : m_Settings(settings)
{}
const MOBase::IPluginGame* GameSettings::plugin()
@@ -725,7 +725,7 @@ void GameSettings::setSelectedProfileName(const QString& name) set(m_Settings, "General", "selected_profile", name.toUtf8());
}
-GeometrySettings::GeometrySettings(QSettings& s) : m_Settings(s), m_Reset(false) {}
+GeometrySettings::GeometrySettings(QSettings& s) : m_Settings(s) {}
void GeometrySettings::requestReset()
{
@@ -2333,7 +2333,7 @@ QString InterfaceSettings::language() if (result.isEmpty()) {
QStringList languagePreferences = QLocale::system().uiLanguages();
- if (languagePreferences.length() > 0) {
+ if (!languagePreferences.empty()) {
// the users most favoritest language
result = languagePreferences.at(0);
} else {
diff --git a/src/src/settings.h b/src/src/settings.h index d6bb5f5..e605cff 100644 --- a/src/src/settings.h +++ b/src/src/settings.h @@ -81,7 +81,7 @@ public: private:
QSettings& m_Settings;
- const MOBase::IPluginGame* m_GamePlugin;
+ const MOBase::IPluginGame* m_GamePlugin{nullptr};
};
// geometry settings for various widgets; this should contain any setting that
@@ -155,7 +155,7 @@ public: private:
QSettings& m_Settings;
- bool m_Reset;
+ bool m_Reset{false};
void saveWindowGeometry(const QWidget* w);
bool restoreWindowGeometry(QWidget* w) const;
diff --git a/src/src/settingsdialogdiagnostics.h b/src/src/settingsdialogdiagnostics.h index 23a5ed5..753dadb 100644 --- a/src/src/settingsdialogdiagnostics.h +++ b/src/src/settingsdialogdiagnostics.h @@ -9,7 +9,7 @@ class DiagnosticsSettingsTab : public SettingsTab public:
DiagnosticsSettingsTab(Settings& settings, SettingsDialog& dialog);
- void update();
+ void update() override;
private:
void setLogLevel();
diff --git a/src/src/settingsdialoggeneral.h b/src/src/settingsdialoggeneral.h index 94fbd9e..a338cbd 100644 --- a/src/src/settingsdialoggeneral.h +++ b/src/src/settingsdialoggeneral.h @@ -10,7 +10,7 @@ class GeneralSettingsTab : public SettingsTab public:
GeneralSettingsTab(Settings& settings, SettingsDialog& dialog);
- void update();
+ void update() override;
private:
void addLanguages();
diff --git a/src/src/settingsdialogpaths.h b/src/src/settingsdialogpaths.h index 287e891..d7de302 100644 --- a/src/src/settingsdialogpaths.h +++ b/src/src/settingsdialogpaths.h @@ -8,7 +8,7 @@ class PathsSettingsTab : public SettingsTab {
public:
PathsSettingsTab(Settings& settings, SettingsDialog& dialog);
- void update();
+ void update() override;
private:
void on_browseBaseDirBtn_clicked();
diff --git a/src/src/settingsdialogplugins.h b/src/src/settingsdialogplugins.h index 78d5b04..b354364 100644 --- a/src/src/settingsdialogplugins.h +++ b/src/src/settingsdialogplugins.h @@ -12,7 +12,7 @@ public: PluginsSettingsTab(Settings& settings, PluginContainer* pluginContainer,
SettingsDialog& dialog);
- void update();
+ void update() override;
void closing() override;
private:
diff --git a/src/src/settingsdialogworkarounds.h b/src/src/settingsdialogworkarounds.h index 9c537df..76a1720 100644 --- a/src/src/settingsdialogworkarounds.h +++ b/src/src/settingsdialogworkarounds.h @@ -32,7 +32,7 @@ public: static std::optional<QStringList> changeSkipDirectories(QWidget* parent,
const QStringList& current);
- void update();
+ void update() override;
private:
QString m_ExecutableBlacklist;
diff --git a/src/src/settingsutilities.cpp b/src/src/settingsutilities.cpp index 1f7d0d8..0ea67fb 100644 --- a/src/src/settingsutilities.cpp +++ b/src/src/settingsutilities.cpp @@ -97,7 +97,7 @@ QStringList ScopedGroup::keys() const }
ScopedReadArray::ScopedReadArray(QSettings& s, const QString& section)
- : m_settings(s), m_count(0)
+ : m_settings(s)
{
m_count = m_settings.beginReadArray(section);
}
@@ -119,7 +119,7 @@ QStringList ScopedReadArray::keys() const ScopedWriteArray::ScopedWriteArray(QSettings& s, const QString& section,
std::size_t size)
- : m_settings(s), m_section(section), m_i(0)
+ : m_settings(s), m_section(section)
{
m_settings.beginWriteArray(section, size == NoSize ? -1 : static_cast<int>(size));
}
diff --git a/src/src/settingsutilities.h b/src/src/settingsutilities.h index be89943..2553434 100644 --- a/src/src/settingsutilities.h +++ b/src/src/settingsutilities.h @@ -206,7 +206,7 @@ public: private:
QSettings& m_settings;
- int m_count;
+ int m_count{0};
};
class ScopedWriteArray
@@ -233,7 +233,7 @@ public: private:
QSettings& m_settings;
QString m_section;
- int m_i;
+ int m_i{0};
};
QString widgetNameWithTopLevel(const QWidget* widget);
diff --git a/src/src/shared/directoryentry.cpp b/src/src/shared/directoryentry.cpp index 43588a4..2fac06b 100644 --- a/src/src/shared/directoryentry.cpp +++ b/src/src/shared/directoryentry.cpp @@ -373,7 +373,7 @@ const FileEntryPtr DirectoryEntry::searchFile(const std::wstring& path, *directory = nullptr;
}
- if ((path.length() == 0) || (path == L"*")) {
+ if ((path.empty()) || (path == L"*")) {
// no file name -> the path ended on a (back-)slash
if (directory != nullptr) {
*directory = this;
@@ -492,7 +492,7 @@ bool DirectoryEntry::remove(const std::wstring& fileName, int* origin) bool DirectoryEntry::hasContentsFromOrigin(int originID) const
{
- return m_Origins.find(originID) != m_Origins.end();
+ return m_Origins.contains(originID);
}
FilesOrigin& DirectoryEntry::createOrigin(const std::wstring& originName,
@@ -771,7 +771,7 @@ DirectoryEntry* DirectoryEntry::getSubDirectoryRecursive(const std::wstring& pat DirectoryStats& stats,
int originID)
{
- if (path.length() == 0) {
+ if (path.empty()) {
// path ended with a backslash?
return this;
}
@@ -866,7 +866,7 @@ void DirectoryEntry::removeFileFromList(FileIndex index) void DirectoryEntry::removeFilesFromList(const std::set<FileIndex>& indices)
{
for (auto iter = m_Files.begin(); iter != m_Files.end();) {
- if (indices.find(iter->second) != indices.end()) {
+ if (indices.contains(iter->second)) {
iter = m_Files.erase(iter);
} else {
++iter;
@@ -874,7 +874,7 @@ void DirectoryEntry::removeFilesFromList(const std::set<FileIndex>& indices) }
for (auto iter = m_FilesLookup.begin(); iter != m_FilesLookup.end();) {
- if (indices.find(iter->second) != indices.end()) {
+ if (indices.contains(iter->second)) {
iter = m_FilesLookup.erase(iter);
} else {
++iter;
diff --git a/src/src/shared/fileentry.cpp b/src/src/shared/fileentry.cpp index f05a859..6f3e5d7 100644 --- a/src/src/shared/fileentry.cpp +++ b/src/src/shared/fileentry.cpp @@ -7,7 +7,7 @@ namespace MOShared {
FileEntry::FileEntry()
- : m_Index(InvalidFileIndex), m_Name(), m_Origin(-1), m_Parent(nullptr),
+ : m_Index(InvalidFileIndex), m_Origin(-1), m_Parent(nullptr),
m_FileSize(NoFileSize), m_CompressedFileSize(NoFileSize)
{}
@@ -34,7 +34,7 @@ void FileEntry::addOrigin(OriginID origin, FILETIME fileTime, std::wstring_view } else if ((m_Parent != nullptr) &&
((m_Parent->getOriginByID(origin).getPriority() >
m_Parent->getOriginByID(m_Origin).getPriority()) ||
- (archive.size() == 0 && m_Archive.isValid()))) {
+ (archive.empty() && m_Archive.isValid()))) {
// If this mod has a higher priority than the origin mod OR
// this mod has a loose file and the origin mod has an archived file,
// this mod is now the origin and the previous origin is the first alternative
@@ -189,7 +189,7 @@ bool FileEntry::isFromArchive(std::wstring archiveName) const {
std::scoped_lock lock(m_OriginsMutex);
- if (archiveName.length() == 0) {
+ if (archiveName.empty()) {
return m_Archive.isValid();
}
diff --git a/src/src/shared/filesorigin.cpp b/src/src/shared/filesorigin.cpp index 7fbcd4d..492e2f0 100644 --- a/src/src/shared/filesorigin.cpp +++ b/src/src/shared/filesorigin.cpp @@ -16,7 +16,7 @@ std::wstring tail(const std::wstring& source, const size_t count) }
FilesOrigin::FilesOrigin()
- : m_ID(0), m_Disabled(false), m_Name(), m_Path(), m_Priority(0)
+ : m_ID(0), m_Disabled(false), m_Priority(0)
{}
FilesOrigin::FilesOrigin(OriginID ID, const std::wstring& name,
diff --git a/src/src/shared/originconnection.cpp b/src/src/shared/originconnection.cpp index 0eadc8c..f5132b4 100644 --- a/src/src/shared/originconnection.cpp +++ b/src/src/shared/originconnection.cpp @@ -48,7 +48,7 @@ OriginConnection::createOrigin(const std::wstring& originName, bool OriginConnection::exists(const std::wstring& name)
{
std::scoped_lock lock(m_Mutex);
- return m_OriginsNameMap.find(name) != m_OriginsNameMap.end();
+ return m_OriginsNameMap.contains(name);
}
FilesOrigin& OriginConnection::getByID(OriginID ID)
diff --git a/src/src/statusbar.cpp b/src/src/statusbar.cpp index e77e720..70c83af 100644 --- a/src/src/statusbar.cpp +++ b/src/src/statusbar.cpp @@ -6,9 +6,9 @@ #include "ui_mainwindow.h"
StatusBar::StatusBar(QWidget* parent)
- : QStatusBar(parent), ui(nullptr), m_normal(new QLabel),
+ : QStatusBar(parent), m_normal(new QLabel),
m_progress(new QProgressBar), m_progressSpacer1(new QWidget),
- m_progressSpacer2(new QWidget), m_notifications(nullptr), m_update(nullptr),
+ m_progressSpacer2(new QWidget),
m_api(new QLabel)
{}
diff --git a/src/src/statusbar.h b/src/src/statusbar.h index 0891fdd..4910ed6 100644 --- a/src/src/statusbar.h +++ b/src/src/statusbar.h @@ -53,13 +53,13 @@ protected: void hideEvent(QHideEvent* e) override;
private:
- Ui::MainWindow* ui;
+ Ui::MainWindow* ui{nullptr};
QLabel* m_normal;
QProgressBar* m_progress;
QWidget* m_progressSpacer1;
QWidget* m_progressSpacer2;
- StatusBarAction* m_notifications;
- StatusBarAction* m_update;
+ StatusBarAction* m_notifications{nullptr};
+ StatusBarAction* m_update{nullptr};
QLabel* m_api;
void visibilityChanged(bool visible);
diff --git a/src/src/syncoverwritedialog.h b/src/src/syncoverwritedialog.h index d548988..8a29cd9 100644 --- a/src/src/syncoverwritedialog.h +++ b/src/src/syncoverwritedialog.h @@ -36,9 +36,9 @@ class SyncOverwriteDialog : public MOBase::TutorableDialog public:
explicit SyncOverwriteDialog(const QString& path,
MOShared::DirectoryEntry* directoryStructure,
- QWidget* parent = 0);
+ QWidget* parent = nullptr);
- ~SyncOverwriteDialog();
+ ~SyncOverwriteDialog() override;
void apply(const QString& modDirectory);
diff --git a/src/src/texteditor.cpp b/src/src/texteditor.cpp index 36d8103..55684f4 100644 --- a/src/src/texteditor.cpp +++ b/src/src/texteditor.cpp @@ -6,8 +6,7 @@ using namespace MOBase;
TextEditor::TextEditor(QWidget* parent)
- : QPlainTextEdit(parent), m_toolbar(nullptr), m_lineNumbers(nullptr),
- m_highlighter(nullptr), m_dirty(false), m_loading(false)
+ : QPlainTextEdit(parent)
{
m_toolbar = new TextEditorToolbar(*this);
m_lineNumbers = new TextEditorLineNumbers(*this);
@@ -464,8 +463,8 @@ void TextEditorLineNumbers::updateArea(const QRect& rect, int dy) }
TextEditorToolbar::TextEditorToolbar(TextEditor& editor)
- : m_editor(editor), m_save(nullptr), m_wordWrap(nullptr), m_explore(nullptr),
- m_path(nullptr)
+ : m_editor(editor)
+
{
m_save = new QAction(QIcon(":/MO/gui/save"), QObject::tr("&Save"), &editor);
diff --git a/src/src/texteditor.h b/src/src/texteditor.h index d40c28d..c832605 100644 --- a/src/src/texteditor.h +++ b/src/src/texteditor.h @@ -14,10 +14,10 @@ public: private:
TextEditor& m_editor;
- QAction* m_save;
- QAction* m_wordWrap;
- QAction* m_explore;
- QLineEdit* m_path;
+ QAction* m_save{nullptr};
+ QAction* m_wordWrap{nullptr};
+ QAction* m_explore{nullptr};
+ QLineEdit* m_path{nullptr};
void onTextModified(bool b);
void onWordWrap(bool b);
@@ -124,15 +124,15 @@ protected: void resizeEvent(QResizeEvent* e) override;
private:
- TextEditorToolbar* m_toolbar;
- TextEditorLineNumbers* m_lineNumbers;
- TextEditorHighlighter* m_highlighter;
+ TextEditorToolbar* m_toolbar{nullptr};
+ TextEditorLineNumbers* m_lineNumbers{nullptr};
+ TextEditorHighlighter* m_highlighter{nullptr};
QColor m_highlightBackground;
QString m_filename;
QString m_encoding;
bool m_needsBOM;
- bool m_dirty;
- bool m_loading;
+ bool m_dirty{false};
+ bool m_loading{false};
void setDefaultStyle();
void onModified(bool b);
diff --git a/src/src/transfersavesdialog.h b/src/src/transfersavesdialog.h index 6430b8b..8cd329e 100644 --- a/src/src/transfersavesdialog.h +++ b/src/src/transfersavesdialog.h @@ -53,8 +53,8 @@ class TransferSavesDialog : public MOBase::TutorableDialog public:
explicit TransferSavesDialog(const Profile& profile,
MOBase::IPluginGame const* gamePlugin,
- QWidget* parent = 0);
- ~TransferSavesDialog();
+ QWidget* parent = nullptr);
+ ~TransferSavesDialog() override;
private slots:
diff --git a/src/src/uilocker.cpp b/src/src/uilocker.cpp index 9cdbf31..bcb1eaa 100644 --- a/src/src/uilocker.cpp +++ b/src/src/uilocker.cpp @@ -8,8 +8,7 @@ class UILockerInterface {
public:
UILockerInterface(QWidget* mainUI)
- : m_mainUI(mainUI), m_target(nullptr), m_message(nullptr), m_info(nullptr),
- m_buttons(nullptr), m_reason(UILocker::NoReason)
+ : m_mainUI(mainUI)
{
m_timer.reset(new QTimer);
QObject::connect(m_timer.get(), &QTimer::timeout, [&] {
@@ -123,14 +122,14 @@ private: std::unique_ptr<QTimer> m_timer;
QWidget* m_mainUI;
- QWidget* m_target;
+ QWidget* m_target{nullptr};
QPointer<QWidget> m_topLevel;
- QLabel* m_message;
- QLabel* m_info;
+ QLabel* m_message{nullptr};
+ QLabel* m_info{nullptr};
QStringList m_labels;
- QWidget* m_buttons;
+ QWidget* m_buttons{nullptr};
std::unique_ptr<Filter> m_filter;
- UILocker::Reasons m_reason;
+ UILocker::Reasons m_reason{UILocker::NoReason};
bool hasMainUI() const { return (m_target != nullptr); }
@@ -403,7 +402,7 @@ UILocker::Results UILocker::Session::result() const static UILocker* g_instance = nullptr;
-UILocker::UILocker() : m_parent(nullptr), m_result(NoResult)
+UILocker::UILocker() : m_result(NoResult)
{
Q_ASSERT(!g_instance);
g_instance = this;
diff --git a/src/src/uilocker.h b/src/src/uilocker.h index 04f0e8d..8bb36b9 100644 --- a/src/src/uilocker.h +++ b/src/src/uilocker.h @@ -74,7 +74,7 @@ public: Results result() const;
private:
- QWidget* m_parent;
+ QWidget* m_parent{nullptr};
std::unique_ptr<UILockerInterface> m_ui;
std::vector<std::weak_ptr<Session>> m_sessions;
std::atomic<Results> m_result;
diff --git a/src/src/updatedialog.h b/src/src/updatedialog.h index ec8e762..2bd4c4b 100644 --- a/src/src/updatedialog.h +++ b/src/src/updatedialog.h @@ -17,7 +17,7 @@ class UpdateDialog : public QDialog public:
UpdateDialog(QWidget* parent);
- ~UpdateDialog();
+ ~UpdateDialog() override;
void setChangeLogs(const QString& text);
void setVersions(const QString& oldVersion, const QString& newVersion);
diff --git a/src/src/vdfparser.cpp b/src/src/vdfparser.cpp index cc6bd46..1df8fe6 100644 --- a/src/src/vdfparser.cpp +++ b/src/src/vdfparser.cpp @@ -5,13 +5,13 @@ namespace { class VdfParser { public: - explicit VdfParser(const QString& text) : m_text(text), m_pos(0) {} + explicit VdfParser(const QString& text) : m_text(text) {} VdfValue parse() { return parseObject(); } private: const QString& m_text; - int m_pos; + int m_pos{0}; QChar peek() const { diff --git a/src/src/vfs/mo2filesystem.cpp b/src/src/vfs/mo2filesystem.cpp index 4ef9be5..08f873c 100644 --- a/src/src/vfs/mo2filesystem.cpp +++ b/src/src/vfs/mo2filesystem.cpp @@ -273,7 +273,7 @@ struct NodeSnapshot bool is_directory = false; bool is_backing = false; uint64_t size = 0; - std::chrono::system_clock::time_point mtime{}; + std::chrono::system_clock::time_point mtime; std::string real_path; }; @@ -470,7 +470,7 @@ struct ChildSnapshot std::string name; bool is_dir = false; uint64_t size = 0; - std::chrono::system_clock::time_point mtime{}; + std::chrono::system_clock::time_point mtime; std::string real_path; mode_t cached_mode = 0; // permission bits from stat() or VfsNode cache }; diff --git a/src/src/vfs/trackedwrites.cpp b/src/src/vfs/trackedwrites.cpp index 62bb88b..10d14e5 100644 --- a/src/src/vfs/trackedwrites.cpp +++ b/src/src/vfs/trackedwrites.cpp @@ -328,7 +328,7 @@ void TrackedWrites::detectManualMoves( for (const auto& relPath : missing) { const std::string key = toLower(relPath); // Skip if already tracked - if (m_tracked.count(key)) + if (m_tracked.contains(key)) continue; std::string matchedMod; @@ -392,7 +392,7 @@ void TrackedWrites::initialScan( const std::string relStr = rel.string(); const std::string key = toLower(relStr); - if (m_tracked.count(key)) + if (m_tracked.contains(key)) continue; // Check if any mod also has this file — use the LAST match (highest diff --git a/src/src/virtualfiletree.cpp b/src/src/virtualfiletree.cpp index bfd4a43..d94437e 100644 --- a/src/src/virtualfiletree.cpp +++ b/src/src/virtualfiletree.cpp @@ -63,7 +63,7 @@ protected: return true;
}
- std::shared_ptr<IFileTree> doClone() const
+ std::shared_ptr<IFileTree> doClone() const override
{
return std::make_shared<VirtualFileTreeImpl>(nullptr, m_dirEntry);
}
diff --git a/src/src/virtualfiletree.h b/src/src/virtualfiletree.h index 2451473..aa056ff 100644 --- a/src/src/virtualfiletree.h +++ b/src/src/virtualfiletree.h @@ -54,9 +54,9 @@ public: protected:
using IFileTree::IFileTree;
- virtual bool
+ bool
doPopulate(std::shared_ptr<const IFileTree> parent,
- std::vector<std::shared_ptr<FileTreeEntry>>& entries) const = 0;
+ std::vector<std::shared_ptr<FileTreeEntry>>& entries) const override = 0;
};
#endif
|
