summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAl <gabriel.cortesi@outlook.com>2019-01-01 22:57:00 +0100
committerAl <gabriel.cortesi@outlook.com>2019-01-01 22:57:00 +0100
commit9a2b9224ca20f44d69029b8e7847dad32c8e96aa (patch)
tree8eb9eef2d58389a7ec8d7505b6243db536e7f67d /src
parent35995a49892a015080f52d5b863ddaf6bb8455d3 (diff)
Sort Separators by priority in Send To dialog.
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp11
-rw-r--r--src/profile.h7
2 files changed, 14 insertions, 4 deletions
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
@@ -234,6 +234,13 @@ public:
std::vector<std::tuple<QString, QString, int> > getActiveMods();
/**
+ * @brief retrieve a mod of the indexes ordered by priority
+ *
+ * @return map of indexes by priority
+ **/
+ std::map<int, unsigned int> 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
* calls to ModInfo::updateFromDisc() and the Profile::refreshModStatus()