summaryrefslogtreecommitdiffstats
path: root/filesorter.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-01-04 10:55:25 +0100
committerArno <arno@disconnect.de>2018-01-04 10:55:25 +0100
commitffffb6e63abfc33bc339d89a7bfcdd1734c48bef (patch)
treeeb7869ac8b4c81ef510f568f536a82e3a3b26897 /filesorter.cpp
parent94869e2c1fc55bec86c80777baa41f2c9f41e4ed (diff)
downloadShemovCleaner-ffffb6e63abfc33bc339d89a7bfcdd1734c48bef.tar.gz
ShemovCleaner-ffffb6e63abfc33bc339d89a7bfcdd1734c48bef.tar.bz2
ShemovCleaner-ffffb6e63abfc33bc339d89a7bfcdd1734c48bef.zip
Implement filtering by MIME-Type
The MIME-type is a regular expression that can be configured. Show the configured types in a QComboBox with the special value "<all>" at the top, which invalidates the MIME type filter.
Diffstat (limited to 'filesorter.cpp')
-rw-r--r--filesorter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/filesorter.cpp b/filesorter.cpp
index 7c6d1d1..fcecfad 100644
--- a/filesorter.cpp
+++ b/filesorter.cpp
@@ -54,3 +54,12 @@ bool VideoSorter::lessThan(const QModelIndex &source_left, const QModelIndex &so
return QSortFilterProxyModel::lessThan(source_left, source_right);
}
+
+bool VideoSorter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
+ QModelIndex nameIdx = sourceModel()->index(source_row, 0, source_parent);
+ int attr = nameIdx.data(FileWidget::AttrsRole).toInt();
+ if(attr == FileWidget::Directory || attr == FileWidget::ParentDir){
+ return true;
+ }
+ return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
+}