]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/dolphinfacetswidget.h
[dolphin/search] Reset search options when needed
[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 class QButtonGroup;
26 class QDate;
27 class QEvent;
28 class QRadioButton;
29
30 /**
31 * @brief Allows to filter search-queries by facets.
32 *
33 * TODO: The current implementation is a temporary
34 * workaround for the 4.9 release and represents no
35 * real facets-implementation yet: There have been
36 * some Dolphin specific user-interface and interaction
37 * issues since 4.6 by embedding the Nepomuk facet-widget
38 * into a QDockWidget (this is unrelated to the
39 * Nepomuk facet-widget itself). Now in combination
40 * with the search-shortcuts in the Places Panel some
41 * existing issues turned into real showstoppers.
42 *
43 * So the longterm plan is to use the Nepomuk facets
44 * again as soon as possible.
45 */
46 class DolphinFacetsWidget : public QWidget
47 {
48 Q_OBJECT
49
50 public:
51 explicit DolphinFacetsWidget(QWidget* parent = nullptr);
52 ~DolphinFacetsWidget() override;
53
54 void resetOptions();
55
56 QString ratingTerm() const;
57 QString facetType() const;
58
59 bool isRatingTerm(const QString& term) const;
60 void setRatingTerm(const QString& term);
61
62 void setFacetType(const QString& type);
63
64 signals:
65 void facetChanged();
66
67 protected:
68 void changeEvent(QEvent* event) override;
69
70 private:
71 void setRating(const int stars);
72 void setTimespan(const QDate& date);
73
74 /**
75 * @return New radiobutton which is connected to the
76 * slotFacedChanged() slot whenever it has
77 * been toggled.
78 */
79 QRadioButton* createRadioButton(const QString& text,
80 QButtonGroup* group);
81
82 private:
83 QRadioButton* m_anyType;
84 QRadioButton* m_folders;
85 QRadioButton* m_documents;
86 QRadioButton* m_images;
87 QRadioButton* m_audio;
88 QRadioButton* m_videos;
89
90 QRadioButton* m_anytime;
91 QRadioButton* m_today;
92 QRadioButton* m_yesterday;
93 QRadioButton* m_thisWeek;
94 QRadioButton* m_thisMonth;
95 QRadioButton* m_thisYear;
96
97 QRadioButton* m_anyRating;
98 QRadioButton* m_oneOrMore;
99 QRadioButton* m_twoOrMore;
100 QRadioButton* m_threeOrMore;
101 QRadioButton* m_fourOrMore;
102 QRadioButton* m_maxRating;
103 };
104
105 #endif