31 isFilteringHidden = false; |
31 isFilteringHidden = false; |
32 } |
32 } |
33 |
33 |
34 bool ThemeFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const |
34 bool ThemeFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const |
35 { |
35 { |
|
36 QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); |
|
37 bool searchOkay = true; |
|
38 if(!filterRegExp().isEmpty()) |
|
39 { |
|
40 // Check regular expression set by the theme chooser search |
|
41 QString name = index.data(ThemeModel::ActualNameRole).toString(); |
|
42 int in = filterRegExp().indexIn(name); |
|
43 searchOkay = in != -1; |
|
44 } |
|
45 |
36 if(isFilteringDLC || isFilteringHidden) |
46 if(isFilteringDLC || isFilteringHidden) |
37 { |
47 { |
38 QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); |
|
39 bool isDLC = index.data(ThemeModel::IsDlcRole).toBool(); |
48 bool isDLC = index.data(ThemeModel::IsDlcRole).toBool(); |
40 bool isHidden = index.data(ThemeModel::IsHiddenRole).toBool(); |
49 bool isHidden = index.data(ThemeModel::IsHiddenRole).toBool(); |
41 if( |
50 |
42 ((isFilteringDLC && !isDLC) || !isFilteringDLC) && |
51 return ( ((isFilteringDLC && !isDLC) || !isFilteringDLC) && |
43 ((isFilteringHidden && !isHidden) || !isFilteringHidden)) |
52 ((isFilteringHidden && !isHidden) || !isFilteringHidden) ) && |
44 { |
53 searchOkay; |
45 if(!filterRegExp().isEmpty()) |
|
46 { |
|
47 // Also check regular expression set by the theme chooser search |
|
48 QString name = index.data(ThemeModel::ActualNameRole).toString(); |
|
49 int index = filterRegExp().indexIn(name); |
|
50 return index != -1; |
|
51 } |
|
52 else |
|
53 return true; |
|
54 } |
|
55 } |
54 } |
56 else |
55 else |
57 { |
56 { |
58 return true; |
57 return searchOkay; |
59 } |
58 } |
60 } |
59 } |
61 |
60 |
62 void ThemeFilterProxyModel::setFilterDLC(bool enable) |
61 void ThemeFilterProxyModel::setFilterDLC(bool enable) |
63 { |
62 { |