From 9a2b9224ca20f44d69029b8e7847dad32c8e96aa Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 1 Jan 2019 22:57:00 +0100 Subject: Sort Separators by priority in Send To dialog. --- src/mainwindow.cpp | 11 +++++++---- src/profile.h | 7 +++++++ 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2e1391c1..2dbf297c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -6260,10 +6260,13 @@ void MainWindow::sendSelectedModsToPriority_clicked() void MainWindow::sendSelectedModsToSeparator_clicked() { QStringList separators; - for (auto mod : m_OrganizerCore.modList()->allMods()) { - ModInfo::Ptr modInfo = ModInfo::getByIndex(ModInfo::getIndex(mod)); - if (modInfo->hasFlag(ModInfo::FLAG_SEPARATOR)) { - separators << mod.chopped(10); + auto indexesByPriority = m_OrganizerCore.currentProfile()->getAllIndexesByPriority(); + for (auto iter = indexesByPriority.begin(); iter != indexesByPriority.end(); iter++) { + if ((iter->second != UINT_MAX)) { + ModInfo::Ptr modInfo = ModInfo::getByIndex(iter->second); + if (modInfo->hasFlag(ModInfo::FLAG_SEPARATOR)) { + separators << modInfo->name().chopped(10); + } } } diff --git a/src/profile.h b/src/profile.h index a9d68062..95a5c59d 100644 --- a/src/profile.h +++ b/src/profile.h @@ -233,6 +233,13 @@ public: **/ std::vector > getActiveMods(); + /** + * @brief retrieve a mod of the indexes ordered by priority + * + * @return map of indexes by priority + **/ + std::map getAllIndexesByPriority() { return m_ModIndexByPriority; } + /** * retrieve the number of mods for which this object has status information. * This is usually the same as ModInfo::getNumMods() except between -- cgit v1.3.1