diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlist.cpp | 22 | ||||
| -rw-r--r-- | src/modlist.h | 15 | ||||
| -rw-r--r-- | src/modlistsortproxy.cpp | 7 |
3 files changed, 7 insertions, 37 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index 5cbc6c9f..6637f48a 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -168,20 +168,6 @@ QString ModList::getConflictFlagText(ModInfo::EConflictFlag flag, ModInfo::Ptr m } } -int ModList::modPriority(unsigned int index) const -{ - auto info = ModInfo::getByIndex(index); - if (info->isBackup()) { - return BACKUP_PRIORITY; - } - else if (info->isOverwrite()) { - return OVERWRITE_PRIORITY; - } - else { - return m_Profile->getModPriority(index); - } -} - QVariant ModList::data(const QModelIndex &modelIndex, int role) const { if (m_Profile == nullptr) return QVariant(); @@ -323,9 +309,6 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const return QVariant(); } } - else if (column == COL_PRIORITY) { - return modPriority(modIndex); - } else { return modInfo->nexusId(); } @@ -346,7 +329,7 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const return modInfo->gameName(); } else if (role == PriorityRole) { - return modPriority(modIndex); + return m_Profile->getModPriority(modIndex); } else if (role == Qt::FontRole) { QFont result; @@ -580,9 +563,6 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) case COL_PRIORITY: { bool ok = false; int newPriority = value.toInt(&ok); - if (ok && newPriority < 0) { - newPriority = 0; - } if (ok) { changeModPriority(modID, newPriority); result = true; diff --git a/src/modlist.h b/src/modlist.h index 68316613..e201de27 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -335,21 +335,6 @@ signals: private:
- // the priority of backups and overwrite for sorting (and display, although
- // those are not displayed), these do not correspond to the actual priority
- // in the mod list
- //
- static constexpr int BACKUP_PRIORITY = -1;
- static constexpr int OVERWRITE_PRIORITY = std::numeric_limits<int>::max();
-
- // retrieve the priority of a mod for the purpose of display (i.e. sorting
- // or grouping)
- //
- // this can be different from the priority in the profile (e.g. for backups
- // or overwrite)
- //
- int modPriority(unsigned int index) const;
-
// retrieve the display name of a mod or convert from a user-provided
// name to internal name
//
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 18e91e6e..fc7f3270 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -215,7 +215,12 @@ bool ModListSortProxy::lessThan(const QModelIndex &left, }
} break;
case ModList::COL_PRIORITY: {
- // nop, already compared by priority
+ if (leftMod->isBackup() != rightMod->isBackup()) {
+ lt = leftMod->isBackup();
+ }
+ else if (leftMod->isOverwrite() != rightMod->isOverwrite()) {
+ lt = rightMod->isOverwrite();
+ }
} break;
default: {
log::warn("Sorting is not defined for column {}", left.column());
|
