diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-10-25 16:53:31 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-10-25 16:53:31 +0100 |
| commit | d804a5e186b421c75e01338ce9d22601c78bbb38 (patch) | |
| tree | 2962f72d47617ca6c7a28e1b1f9e20fa507f81a9 /src | |
| parent | cca709baaeb415d4cc600d3274169c2db7c90bd9 (diff) | |
Move IOrganizer::modsSortedByProfilePriority() to IModList::allModsByProfilePriority().
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 4 | ||||
| -rw-r--r-- | src/modlist.cpp | 8 | ||||
| -rw-r--r-- | src/modlist.h | 1 | ||||
| -rw-r--r-- | src/modlistproxy.cpp | 5 | ||||
| -rw-r--r-- | src/modlistproxy.h | 1 | ||||
| -rw-r--r-- | src/organizercore.cpp | 8 | ||||
| -rw-r--r-- | src/organizercore.h | 10 | ||||
| -rw-r--r-- | src/organizerproxy.cpp | 5 | ||||
| -rw-r--r-- | src/organizerproxy.h | 2 |
9 files changed, 30 insertions, 14 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 851900a0..a2afb8a0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3775,7 +3775,7 @@ void MainWindow::moveOverwriteContentToExistingMod() QString modAbsolutePath; - for (const auto& mod : m_OrganizerCore.modsSortedByProfilePriority()) { + for (const auto& mod : m_OrganizerCore.modsSortedByProfilePriority(m_OrganizerCore.currentProfile())) { if (result.compare(mod) == 0) { ModInfo::Ptr modInfo = ModInfo::getByIndex(ModInfo::getIndex(mod)); modAbsolutePath = modInfo->absolutePath(); @@ -6549,7 +6549,7 @@ void MainWindow::sendSelectedModsToSeparator_clicked() int newPriority = INT_MAX; bool foundSection = false; - for (auto mod : m_OrganizerCore.modsSortedByProfilePriority()) { + for (auto mod : m_OrganizerCore.modsSortedByProfilePriority(m_OrganizerCore.currentProfile())) { unsigned int modIndex = ModInfo::getIndex(mod); ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); if (!foundSection && result.compare(mod) == 0) { diff --git a/src/modlist.cpp b/src/modlist.cpp index 90433963..d72cede9 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -931,6 +931,14 @@ QStringList ModList::allMods() const return result; } +QStringList ModList::allModsByProfilePriority(MOBase::IProfile* profile) const +{ + Profile* mo2Profile = profile == nullptr ? + m_Organizer->currentProfile() + : dynamic_cast<Profile*>(profile); + return m_Organizer->modsSortedByProfilePriority(mo2Profile); +} + IModList::ModStates ModList::state(const QString &name) const { unsigned int modIndex = ModInfo::getIndex(name); diff --git a/src/modlist.h b/src/modlist.h index baaeede3..8748cb30 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -157,6 +157,7 @@ public: /// \copydoc MOBase::IModList::allMods
virtual QStringList allMods() const override;
+ virtual QStringList allModsByProfilePriority(MOBase::IProfile* profile = nullptr) const override;
/// \copydoc MOBase::IModList::state
virtual ModStates state(const QString &name) const override;
diff --git a/src/modlistproxy.cpp b/src/modlistproxy.cpp index 321f1873..51cea1ee 100644 --- a/src/modlistproxy.cpp +++ b/src/modlistproxy.cpp @@ -17,6 +17,11 @@ QStringList ModListProxy::allMods() const return m_Proxied->allMods(); } +QStringList ModListProxy::allModsByProfilePriority(MOBase::IProfile* profile) const +{ + return m_Proxied->allModsByProfilePriority(profile); +} + IModList::ModStates ModListProxy::state(const QString& name) const { return m_Proxied->state(name); diff --git a/src/modlistproxy.h b/src/modlistproxy.h index 5b0a7114..2e653850 100644 --- a/src/modlistproxy.h +++ b/src/modlistproxy.h @@ -15,6 +15,7 @@ public: QString displayName(const QString& internalName) const override; QStringList allMods() const override; + QStringList allModsByProfilePriority(MOBase::IProfile* profile = nullptr) const override; ModStates state(const QString& name) const override; bool setActive(const QString& name, bool active) override; int setActive(const QStringList& names, bool active) override; diff --git a/src/organizercore.cpp b/src/organizercore.cpp index ac485c91..a66a6450 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -974,13 +974,13 @@ ModList *OrganizerCore::modList() return &m_ModList; } -QStringList OrganizerCore::modsSortedByProfilePriority() const +QStringList OrganizerCore::modsSortedByProfilePriority(Profile *profile) const { QStringList res; - for (int i = currentProfile()->getPriorityMinimum(); - i < currentProfile()->getPriorityMinimum() + (int)currentProfile()->numRegularMods(); + for (int i = profile->getPriorityMinimum(); + i < profile->getPriorityMinimum() + (int)profile->numRegularMods(); ++i) { - int modIndex = currentProfile()->modIndexByPriority(i); + int modIndex = profile->modIndexByPriority(i); auto modInfo = ModInfo::getByIndex(modIndex); if (!modInfo->hasFlag(ModInfo::FLAG_OVERWRITE) && !modInfo->hasFlag(ModInfo::FLAG_BACKUP)) { diff --git a/src/organizercore.h b/src/organizercore.h index 226c5c0a..95c7ef51 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -289,6 +289,15 @@ public: static void setGlobalCrashDumpsType(CrashDumpsType crashDumpsType);
static std::wstring crashDumpsPath();
+ /**
+ * @brief Returns the name of all the mods in the priority order of the given profile.
+ *
+ * @param profile Profile to use for the mod order.
+ *
+ * @return the name of all the mods in the priority order of the given profile.
+ */
+ QStringList modsSortedByProfilePriority(Profile* profile) const;
+
public:
MOBase::IModRepositoryBridge *createNexusBridge() const;
QString profileName() const;
@@ -318,7 +327,6 @@ public: PluginList *pluginList();
ModList *modList();
void refresh(bool saveChanges = true);
- QStringList modsSortedByProfilePriority() const;
bool onAboutToRun(const std::function<bool(const QString&)>& func);
bool onFinishedRun(const std::function<void(const QString&, unsigned int)>& func);
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 5e720ea8..e369c1a3 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -254,11 +254,6 @@ MOBase::IPluginGame const *OrganizerProxy::managedGame() const return m_Proxied->managedGame();
}
-QStringList OrganizerProxy::modsSortedByProfilePriority() const
-{
- return m_Proxied->modsSortedByProfilePriority();
-}
-
// CALLBACKS
bool OrganizerProxy::onAboutToRun(const std::function<bool(const QString&)>& func)
diff --git a/src/organizerproxy.h b/src/organizerproxy.h index 29210ff2..a72d01b3 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -67,8 +67,6 @@ public: virtual MOBase::IPluginGame const *managedGame() const;
- virtual QStringList modsSortedByProfilePriority() const;
-
private:
OrganizerCore *m_Proxied;
|
