]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/dolphinfacetswidget.h
Merge branch 'master' into frameworks
[dolphin.git] / src / search / dolphinfacetswidget.h
1 /***************************************************************************
2 * Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef DOLPHINFACETSWIDGET_H
21 #define DOLPHINFACETSWIDGET_H
22
23 #include <QWidget>
24
25 #include <config-baloo.h>
26 #ifdef HAVE_BALOO
27 #include <Baloo/Term>
28 #endif
29
30 class QButtonGroup;
31 class QCheckBox;
32 class QDate;
33 class QRadioButton;
34
35 /**
36 * @brief Allows to filter search-queries by facets.
37 *
38 * TODO: The current implementation is a temporary
39 * workaround for the 4.9 release and represents no
40 * real facets-implementation yet: There have been
41 * some Dolphin specific user-interface and interaction
42 * issues since 4.6 by embedding the Nepomuk facet-widget
43 * into a QDockWidget (this is unrelated to the
44 * Nepomuk facet-widget itself). Now in combination
45 * with the search-shortcuts in the Places Panel some
46 * existing issues turned into real showstoppers.
47 *
48 * So the longterm plan is to use the Nepomuk facets
49 * again as soon as possible.
50 */
51 class DolphinFacetsWidget : public QWidget
52 {
53 Q_OBJECT
54
55 public:
56 explicit DolphinFacetsWidget(QWidget* parent = 0);
57 virtual ~DolphinFacetsWidget();
58
59 #ifdef HAVE_BALOO
60 Baloo::Term ratingTerm() const;
61 QString facetType() const;
62
63 bool isRatingTerm(const Baloo::Term& term) const;
64 void setRatingTerm(const Baloo::Term& term);
65 #endif
66
67 void setFacetType(const QString& type);
68
69 signals:
70 void facetChanged();
71
72 private:
73 void setRating(const int stars);
74 void setTimespan(const QDate& date);
75
76 /**
77 * @return New radiobutton which is connected to the
78 * slotFacedChanged() slot whenever it has
79 * been toggled.
80 */
81 QRadioButton* createRadioButton(const QString& text,
82 QButtonGroup* group);
83
84 private:
85 QRadioButton* m_anyType;
86 QRadioButton* m_documents;
87 QRadioButton* m_images;
88 QRadioButton* m_audio;
89 QRadioButton* m_videos;
90
91 QRadioButton* m_anytime;
92 QRadioButton* m_today;
93 QRadioButton* m_yesterday;
94 QRadioButton* m_thisWeek;
95 QRadioButton* m_thisMonth;
96 QRadioButton* m_thisYear;
97
98 QRadioButton* m_anyRating;
99 QRadioButton* m_oneOrMore;
100 QRadioButton* m_twoOrMore;
101 QRadioButton* m_threeOrMore;
102 QRadioButton* m_fourOrMore;
103 QRadioButton* m_maxRating;
104 };
105
106 #endif