MythTV  master
galleryfilter.h
Go to the documentation of this file.
1 #ifndef GALLERYFILTER_H
2 #define GALLERYFILTER_H
3 
4 // qt
5 #include <QDir>
6 
7 #include <mythscreentype.h>
8 
9 enum SortOrder {
10  kSortOrderUnsorted = QDir::Unsorted,
11  kSortOrderNameAsc = QDir::Name + QDir::DirsFirst + QDir::IgnoreCase,
12  kSortOrderNameDesc = QDir::Name + QDir::DirsFirst + QDir::IgnoreCase +
13  QDir::Reversed,
14  kSortOrderModTimeAsc = QDir::Time + QDir::DirsFirst + QDir::IgnoreCase,
15  kSortOrderModTimeDesc = QDir::Time + QDir::DirsFirst + QDir::IgnoreCase +
16  QDir::Reversed,
17  kSortOrderExtAsc = QDir::Size + QDir::DirsFirst + QDir::IgnoreCase,
18  kSortOrderExtDesc = QDir::Size + QDir::DirsFirst + QDir::IgnoreCase +
19  QDir::Reversed,
20  kSortOrderSizeAsc = QDir::Type + QDir::DirsFirst + QDir::IgnoreCase,
21  kSortOrderSizeDesc = QDir::Type + QDir::DirsFirst + QDir::IgnoreCase +
22  QDir::Reversed
23 };
25 
26 enum TypeFilter {
30 };
32 
34 {
35  public:
36  static bool TestFilter(const QString& dir, const GalleryFilter& flt,
37  int *dirCount, int *imageCount, int *movieCount);
38 
39  explicit GalleryFilter(bool loaddefaultsettings = true);
40  GalleryFilter(const GalleryFilter &gfs);
41  GalleryFilter &operator=(const GalleryFilter &gfs);
42 
43  void saveAsDefault();
44 
45  QString getDirFilter() const { return m_dirFilter; }
46  void setDirFilter(QString dirFilter)
47  {
48  m_changed_state = true;
49  m_dirFilter = dirFilter;
50  }
51 
52  int getTypeFilter() const { return m_typeFilter; }
53  void setTypeFilter(int typeFilter)
54  {
55  m_changed_state = true;
56  m_typeFilter = typeFilter;
57  }
58 
59  int getSort() const { return m_sort; }
60  void setSort(int sort)
61  {
62  m_changed_state = true;
63  m_sort = sort;
64  }
65 
67  {
68  bool ret = m_changed_state;
69  m_changed_state = false;
70  return ret;
71  }
72  void dumpFilter(const QString& src);
73 
74  private:
75  QString m_dirFilter;
76  int m_typeFilter {kTypeFilterAll};
77  int m_sort {kSortOrderUnsorted};
78 
79  bool m_changed_state {false};
80 };
81 
82 #endif /* GALLERYFILTER_H */
83 
84 /*
85  * vim:ts=4:sw=4:ai:et:si:sts=4
86  */
int getTypeFilter() const
Definition: galleryfilter.h:52
Q_DECLARE_METATYPE(GrabberScript *)
void setSort(int sort)
Definition: galleryfilter.h:60
TypeFilter
Definition: galleryfilter.h:26
QString getDirFilter() const
Definition: galleryfilter.h:45
QString m_dirFilter
Definition: galleryfilter.h:75
bool getChangedState()
Definition: galleryfilter.h:66
void setTypeFilter(int typeFilter)
Definition: galleryfilter.h:53
SortOrder
Definition: galleryfilter.h:9
int getSort() const
Definition: galleryfilter.h:59
void setDirFilter(QString dirFilter)
Definition: galleryfilter.h:46