diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-07 19:47:13 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-10 10:27:30 +0100 |
| commit | 183440d6949578c2c626022d42ee412919a19552 (patch) | |
| tree | 95c68be7954809ef98d1d535c928cbe5f92571c1 /src/modlistview.cpp | |
| parent | 1ac3f4d8e8ee7461f047d34e196df40499e89557 (diff) | |
Display mod flags on collapsed separators.
Diffstat (limited to 'src/modlistview.cpp')
| -rw-r--r-- | src/modlistview.cpp | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 63999ce9..7c67c599 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -217,10 +217,8 @@ std::optional<unsigned int> ModListView::nextMod(unsigned int modIndex) const ModInfo::Ptr mod = ModInfo::getByIndex(modIndex);
- // skip overwrite and backups and separators
- if (mod->hasFlag(ModInfo::FLAG_OVERWRITE) ||
- mod->hasFlag(ModInfo::FLAG_BACKUP) ||
- mod->hasFlag(ModInfo::FLAG_SEPARATOR)) {
+ // skip overwrite, backups and separators
+ if (mod->isOverwrite() || mod->isBackup() || mod->isSeparator()) {
continue;
}
@@ -246,12 +244,9 @@ std::optional<unsigned int> ModListView::prevMod(unsigned int modIndex) const modIndex = index.data(ModList::IndexRole).toInt();
- // skip overwrite and backups and separators
+ // skip overwrite, backups and separators
ModInfo::Ptr mod = ModInfo::getByIndex(modIndex);
-
- if (mod->hasFlag(ModInfo::FLAG_OVERWRITE) ||
- mod->hasFlag(ModInfo::FLAG_BACKUP) ||
- mod->hasFlag(ModInfo::FLAG_SEPARATOR)) {
+ if (mod->isOverwrite() || mod->isBackup() || mod->isSeparator()) {
continue;
}
@@ -1080,6 +1075,37 @@ QColor ModListView::markerColor(const QModelIndex& index) const return QColor();
}
+std::vector<ModInfo::EFlag> ModListView::modFlags(const QModelIndex& index, bool* forceCompact) const
+{
+ ModInfo::Ptr info = ModInfo::getByIndex(index.data(ModList::IndexRole).toInt());
+
+ auto flags = info->getFlags();
+ bool compact = false;
+ if (info->isSeparator()
+ && hasCollapsibleSeparators()
+ && m_core->settings().interface().collapsibleSeparatorsConflicts()
+ && !isExpanded(index.sibling(index.row(), 0))) {
+
+ // combine the child conflicts
+ std::set eFlags(flags.begin(), flags.end());
+ for (int i = 0; i < model()->rowCount(index); ++i) {
+ auto cIndex = model()->index(i, index.column(), index).data(ModList::IndexRole).toInt();
+ auto cFlags = ModInfo::getByIndex(cIndex)->getFlags();
+ eFlags.insert(cFlags.begin(), cFlags.end());
+ }
+ flags = { eFlags.begin(), eFlags.end() };
+
+ // force compact because there can be a lots of flags here
+ compact = true;
+ }
+
+ if (forceCompact) {
+ *forceCompact = true;
+ }
+
+ return flags;
+}
+
std::vector<ModInfo::EConflictFlag> ModListView::conflictFlags(const QModelIndex& index, bool* forceCompact) const
{
ModInfo::Ptr info = ModInfo::getByIndex(index.data(ModList::IndexRole).toInt());
|
