diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2021-01-29 19:29:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-29 19:29:21 +0100 |
| commit | f53e5406d4292f484257178ec5733f6ceb116673 (patch) | |
| tree | f08dfdba6a38986a93612a5aa0166f3008110ad7 /src/modlistviewactions.cpp | |
| parent | 8606bf70c76252e20f888264bfbdedde0f1c8754 (diff) | |
| parent | 48fae18ac6baced388b1fa7cee6c18e6aa8dbab3 (diff) | |
Merge pull request #1378 from Holt59/fix-priority-management
Increase robustness of mods priority in profile.
Diffstat (limited to 'src/modlistviewactions.cpp')
| -rw-r--r-- | src/modlistviewactions.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index e7e74b16..9d4be554 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -207,10 +207,16 @@ void ModListViewActions::createSeparator(const QModelIndex& index) const void ModListViewActions::setAllMatchingModsEnabled(bool enabled) const { + // number of mods to enable / disable + const auto counters = m_view->counters(); + const auto count = enabled ? + counters.visible.regular - counters.visible.active : counters.visible.active; + + // retrieve visible mods from the model view const auto allIndex = m_view->indexViewToModel(flatIndex(m_view->model())); const QString message = enabled ? tr("Really enable %1 mod(s)?") : tr("Really disable %1 mod(s)?"); - if (QMessageBox::question(m_parent, tr("Confirm"), message.arg(allIndex.size()), + if (QMessageBox::question(m_parent, tr("Confirm"), message.arg(count), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { m_core.modList()->setActive(allIndex, enabled); } @@ -539,12 +545,12 @@ void ModListViewActions::displayModInformation(ModInfo::Ptr modInfo, unsigned in void ModListViewActions::sendModsToTop(const QModelIndexList& indexes) const { - m_core.modList()->changeModsPriority(indexes, 0); + m_core.modList()->changeModsPriority(indexes, Profile::MinimumPriority); } void ModListViewActions::sendModsToBottom(const QModelIndexList& indexes) const { - m_core.modList()->changeModsPriority(indexes, std::numeric_limits<int>::max()); + m_core.modList()->changeModsPriority(indexes, Profile::MaximumPriority); } void ModListViewActions::sendModsToPriority(const QModelIndexList& indexes) const @@ -580,7 +586,7 @@ void ModListViewActions::sendModsToSeparator(const QModelIndexList& indexes) con if (!result.isEmpty()) { result += "_separator"; - int newPriority = std::numeric_limits<int>::max(); + int newPriority = Profile::MaximumPriority; bool foundSection = false; for (auto mod : m_core.modList()->allModsByProfilePriority()) { unsigned int modIndex = ModInfo::getIndex(mod); |
