From c93cf33c8324052b321fc0428c394016abcee115 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Wed, 13 Jan 2021 13:00:54 +0100 Subject: Remove OrganizerCore::modsSortedByProfilePriority. --- src/modlist.cpp | 14 +++++++++++++- src/modlistviewactions.cpp | 4 ++-- src/organizercore.cpp | 16 ---------------- src/organizercore.h | 9 --------- 4 files changed, 15 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/modlist.cpp b/src/modlist.cpp index f820e4d1..d4ffbeff 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -900,7 +900,19 @@ QStringList ModList::allModsByProfilePriority(MOBase::IProfile* profile) const { Profile* mo2Profile = profile == nullptr ? m_Organizer->currentProfile() : static_cast(profile); - return m_Organizer->modsSortedByProfilePriority(mo2Profile); + + QStringList res; + for (int i = mo2Profile->getPriorityMinimum(); + i < mo2Profile->getPriorityMinimum() + (int)mo2Profile->numRegularMods(); + ++i) { + int modIndex = mo2Profile->modIndexByPriority(i); + auto modInfo = ModInfo::getByIndex(modIndex); + if (!modInfo->hasFlag(ModInfo::FLAG_OVERWRITE) && + !modInfo->hasFlag(ModInfo::FLAG_BACKUP)) { + res.push_back(ModInfo::getByIndex(modIndex)->internalName()); + } + } + return res; } MOBase::IModInterface* ModList::getMod(const QString& name) const diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index cc50f009..63d74192 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -547,7 +547,7 @@ void ModListViewActions::sendModsToSeparator(const QModelIndexList& index) const int newPriority = std::numeric_limits::max(); bool foundSection = false; - for (auto mod : m_core.modsSortedByProfilePriority(m_core.currentProfile())) { + for (auto mod : m_core.modList()->allModsByProfilePriority()) { unsigned int modIndex = ModInfo::getIndex(mod); ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); if (!foundSection && result.compare(mod) == 0) { @@ -1128,7 +1128,7 @@ void ModListViewActions::moveOverwriteContentToExistingMod() const QString modAbsolutePath; - for (const auto& mod : m_core.modsSortedByProfilePriority(m_core.currentProfile())) { + for (const auto& mod : m_core.modList()->allModsByProfilePriority()) { if (result.compare(mod) == 0) { ModInfo::Ptr modInfo = ModInfo::getByIndex(ModInfo::getIndex(mod)); modAbsolutePath = modInfo->absolutePath(); diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 3d730c23..bbf6029b 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1016,22 +1016,6 @@ ModList *OrganizerCore::modList() return &m_ModList; } -QStringList OrganizerCore::modsSortedByProfilePriority(Profile *profile) const -{ - QStringList res; - for (int i = profile->getPriorityMinimum(); - i < profile->getPriorityMinimum() + (int)profile->numRegularMods(); - ++i) { - int modIndex = profile->modIndexByPriority(i); - auto modInfo = ModInfo::getByIndex(modIndex); - if (!modInfo->hasFlag(ModInfo::FLAG_OVERWRITE) && - !modInfo->hasFlag(ModInfo::FLAG_BACKUP)) { - res.push_back(ModInfo::getByIndex(modIndex)->internalName()); - } - } - return res; -} - bool OrganizerCore::previewFileWithAlternatives( QWidget* parent, QString fileName, int selectedOrigin) { diff --git a/src/organizercore.h b/src/organizercore.h index e8b42609..7ec4dda8 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -300,15 +300,6 @@ public: static void setGlobalCoreDumpType(env::CoreDumpTypes type); static std::wstring getGlobalCoreDumpPath(); - /** - * @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; -- cgit v1.3.1