digiKam
filter.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-12-16
7  * Description : Filter for filter combobox
8  *
9  * Copyright (C) 2010-2011 by Petri Damstén <petri dot damsten at iki dot fi>
10  * Copyright (C) 2014 by Teemu Rytilahti <tpr@iki.fi>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FILTER_H
26 #define DIGIKAM_FILTER_H
27 
28 // Qt includes
29 
30 #include <QHash>
31 #include <QString>
32 #include <QList>
33 #include <QStringList>
34 #include <QRegExp>
35 
36 // Local includes
37 
38 #include "camiteminfo.h"
39 
40 namespace Digikam
41 {
42 
43 class Filter
44 {
45 public:
46 
47  explicit Filter();
48  ~Filter();
49 
50  QString toString();
51  void fromString(const QString& filter);
52  bool match(const QStringList& wildcards, const QString& name);
53  const QRegExp& regexp(const QString& wildcard);
54  const QStringList& mimeWildcards(const QString& mime);
55  bool matchesCurrentFilter(const CamItemInfo& item);
56 
57 public:
58 
59  QString name;
60  bool onlyNew;
61  QStringList fileFilter;
62  QStringList pathFilter;
63  QString mimeFilter;
64  QHash<QString, QRegExp> filterHash;
65  QHash<QString, QStringList> mimeHash;
66 };
67 
69 
70 } // namespace Digikam
71 
72 Q_DECLARE_METATYPE(Digikam::Filter*)
73 
74 #endif // DIGIKAM_FILTER_H
Definition: camiteminfo.h:48
Definition: filter.h:44
QHash< QString, QStringList > mimeHash
Definition: filter.h:65
const QStringList & mimeWildcards(const QString &mime)
Definition: filter.cpp:109
void fromString(const QString &filter)
Definition: filter.cpp:56
QHash< QString, QRegExp > filterHash
Definition: filter.h:64
const QRegExp & regexp(const QString &wildcard)
Definition: filter.cpp:78
bool onlyNew
Definition: filter.h:60
~Filter()
Definition: filter.cpp:40
bool matchesCurrentFilter(const CamItemInfo &item)
Definition: filter.cpp:135
QStringList fileFilter
Definition: filter.h:61
Filter()
Definition: filter.cpp:35
QStringList pathFilter
Definition: filter.h:62
bool match(const QStringList &wildcards, const QString &name)
Definition: filter.cpp:90
QString mimeFilter
Definition: filter.h:63
QString toString()
Definition: filter.cpp:44
QString name
Definition: filter.h:59
Definition: datefolderview.cpp:43
QList< Filter * > FilterList
Definition: filter.h:68