]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/searchcriterionvalue.h
I'm very sorry for breaking the build: I forgot to add the new files :-(
[dolphin.git] / src / search / searchcriterionvalue.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Adam Kidder <thekidder@gmail.com> *
3 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #ifndef SEARCHCRITERIONVALUE_H
22 #define SEARCHCRITERIONVALUE_H
23
24 #include <QWidget>
25
26 class QComboBox;
27 class KDateWidget;
28 class KRatingWidget;
29 class KLineEdit;
30
31 /**
32 * @brief Helper class for SearchCriterionSelector.
33 * Represents an input widget for the value of a search criterion.
34 */
35 class SearchCriterionValue : public QWidget
36 {
37 Q_OBJECT
38
39 public:
40 SearchCriterionValue(QWidget* parent = 0);
41 virtual ~SearchCriterionValue();
42
43 /**
44 * Must be overwritten by derived classes and returns
45 * the string representation of the search criterion value.
46 */
47 virtual QString value() const = 0;
48
49 /**
50 * Initializes the widget on the base of the given value-type.
51 * It is in the hand of the derived classes to interprete
52 * the value-type string and create a corresponding value for
53 * the widget (@see SearchCriterionSelector::Comparator).
54 * The default implementation is empty.
55 */
56 virtual void initializeValue(const QString& valueType);
57
58 signals:
59 void valueChanged(const QString& value);
60 };
61
62
63
64 /** @brief Allows to input a date value as search criterion. */
65 class DateValue : public SearchCriterionValue
66 {
67 Q_OBJECT
68
69 public:
70 DateValue(QWidget* parent = 0);
71 virtual ~DateValue();
72 virtual QString value() const;
73 virtual void initializeValue(const QString& valueType);
74
75 private:
76 KDateWidget* m_dateWidget;
77 };
78
79
80
81 /** @brief Allows to input a tag as search criterion. */
82 class TagValue : public SearchCriterionValue
83 {
84 Q_OBJECT
85
86 public:
87 TagValue(QWidget* parent = 0);
88 virtual ~TagValue();
89 virtual QString value() const;
90
91 protected:
92 virtual void showEvent(QShowEvent* event);
93
94 private:
95 QComboBox* m_tags;
96 };
97
98
99
100 /** @brief Allows to input a file size value as search criterion. */
101 class SizeValue : public SearchCriterionValue
102 {
103 Q_OBJECT
104
105 public:
106 SizeValue(QWidget* parent = 0);
107 virtual ~SizeValue();
108 virtual QString value() const;
109
110 private:
111 KLineEdit* m_lineEdit;
112 QComboBox* m_units;
113 };
114
115 /** @brief Allows to input a rating value as search criterion. */
116 class RatingValue : public SearchCriterionValue
117 {
118 Q_OBJECT
119
120 public:
121 RatingValue(QWidget* parent = 0);
122 virtual ~RatingValue();
123 virtual QString value() const;
124
125 private:
126 KRatingWidget* m_ratingWidget;
127 };
128
129 #endif // SEARCHCRITERIONVALUE_H