]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/searchcriterionvalue.h
SVN_SILENT made messages (.desktop file)
[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 #define DISABLE_NEPOMUK_LEGACY
25 #include <nepomuk/literalterm.h>
26
27 #include <QWidget>
28
29 class QComboBox;
30 class KDateWidget;
31 class KRatingWidget;
32 class KLineEdit;
33
34 /**
35 * @brief Helper class for SearchCriterionSelector.
36 * Represents an input widget for the value of a search criterion.
37 */
38 class SearchCriterionValue : public QWidget
39 {
40 Q_OBJECT
41
42 public:
43 SearchCriterionValue(QWidget* parent = 0);
44 virtual ~SearchCriterionValue();
45
46 /**
47 * Must be overwritten by derived classes and returns
48 * the literal term of the search criterion value.
49 */
50 virtual Nepomuk::Query::LiteralTerm value() const = 0;
51
52 /**
53 * Initializes the widget on the base of the given value-type.
54 * It is in the hand of the derived classes to interprete
55 * the value-type string and create a corresponding value for
56 * the widget (@see SearchCriterionSelector::Comparator).
57 * The default implementation is empty.
58 */
59 virtual void initializeValue(const QString& valueType);
60
61 signals:
62 void valueChanged(const Nepomuk::Query::LiteralTerm& value);
63 };
64
65
66
67 /** @brief Allows to input a date value as search criterion. */
68 class DateValue : public SearchCriterionValue
69 {
70 Q_OBJECT
71
72 public:
73 DateValue(QWidget* parent = 0);
74 virtual ~DateValue();
75 virtual Nepomuk::Query::LiteralTerm value() const;
76 virtual void initializeValue(const QString& valueType);
77
78 private:
79 KDateWidget* m_dateWidget;
80 };
81
82
83
84 /** @brief Allows to input a tag as search criterion. */
85 class TagValue : public SearchCriterionValue
86 {
87 Q_OBJECT
88
89 public:
90 TagValue(QWidget* parent = 0);
91 virtual ~TagValue();
92 virtual Nepomuk::Query::LiteralTerm value() const;
93
94 protected:
95 virtual void showEvent(QShowEvent* event);
96
97 private:
98 QComboBox* m_tags;
99 };
100
101
102
103 /** @brief Allows to input a file size value as search criterion. */
104 class SizeValue : public SearchCriterionValue
105 {
106 Q_OBJECT
107
108 public:
109 SizeValue(QWidget* parent = 0);
110 virtual ~SizeValue();
111 virtual Nepomuk::Query::LiteralTerm value() const;
112
113 private:
114 KLineEdit* m_lineEdit;
115 QComboBox* m_units;
116 };
117
118 /** @brief Allows to input a rating value as search criterion. */
119 class RatingValue : public SearchCriterionValue
120 {
121 Q_OBJECT
122
123 public:
124 RatingValue(QWidget* parent = 0);
125 virtual ~RatingValue();
126 virtual Nepomuk::Query::LiteralTerm value() const;
127
128 private:
129 KRatingWidget* m_ratingWidget;
130 };
131
132 #endif // SEARCHCRITERIONVALUE_H