summaryrefslogtreecommitdiff
path: root/src/filetreemodel.cpp
diff options
context:
space:
mode:
authorJonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com>2025-05-23 09:23:36 +0200
committerGitHub <noreply@github.com>2025-05-23 09:23:36 +0200
commita823d2aa88bd00d10370d5516c4426e8780435f7 (patch)
treed0b78481cc4c8b3f0edcc01c9f3714070e49dfca /src/filetreemodel.cpp
parentb531bbff39bfe6df18e324b0d0785eb1f8e0163d (diff)
Ignore conflicts between hidden files (#2148)
* Ignore conflicts between hidden files * Optimize checks for .mohidden extension
Diffstat (limited to 'src/filetreemodel.cpp')
-rw-r--r--src/filetreemodel.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/filetreemodel.cpp b/src/filetreemodel.cpp
index 5a6f6a2c..de6194ff 100644
--- a/src/filetreemodel.cpp
+++ b/src/filetreemodel.cpp
@@ -9,6 +9,7 @@
using namespace MOBase;
using namespace MOShared;
+namespace fs = std::filesystem;
// in mainwindow.cpp
QString UnmanagedModName();
@@ -969,8 +970,11 @@ void FileTreeModel::updateFileItem(FileTreeItem& item, const MOShared::FileEntry
bool FileTreeModel::shouldShowFile(const FileEntry& file) const
{
- if (showConflictsOnly() && (file.getAlternatives().size() == 0)) {
- // only conflicts should be shown, but this file is not conflicted
+ if (showConflictsOnly() &&
+ ((file.getAlternatives().size() == 0) ||
+ QString::fromStdWString(file.getName())
+ .endsWith(ModInfo::s_HiddenExt, Qt::CaseInsensitive))) {
+ // only conflicts should be shown, but this file is hidden or not conflicted
return false;
}
@@ -979,8 +983,8 @@ bool FileTreeModel::shouldShowFile(const FileEntry& file) const
return false;
}
- if (!showHiddenFiles() &&
- file.getName().ends_with(ModInfo::s_HiddenExt.toStdWString())) {
+ if (!showHiddenFiles() && QString::fromStdWString(file.getName())
+ .endsWith(ModInfo::s_HiddenExt, Qt::CaseInsensitive)) {
// hidden files shouldn't be shown, but this file is hidden
return false;
}
@@ -991,8 +995,9 @@ bool FileTreeModel::shouldShowFile(const FileEntry& file) const
bool FileTreeModel::shouldShowFolder(const DirectoryEntry& dir,
const FileTreeItem* item) const
{
- if (!showHiddenFiles() &&
- dir.getName().ends_with(ModInfo::s_HiddenExt.toStdWString())) {
+ if ((!showHiddenFiles() || showConflictsOnly()) &&
+ QString::fromStdWString(dir.getName())
+ .endsWith(ModInfo::s_HiddenExt, Qt::CaseInsensitive)) {
return false;
}