]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/dolphinfacetswidget.h
Fix build with Qt 5.14 RC
[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 QComboBox;
26 class QDate;
27 class QEvent;
28
29 /**
30 * @brief Allows to filter search-queries by facets.
31 *
32 * TODO: The current implementation is a temporary
33 * workaround for the 4.9 release and represents no
34 * real facets-implementation yet: There have been
35 * some Dolphin specific user-interface and interaction
36 * issues since 4.6 by embedding the Nepomuk facet-widget
37 * into a QDockWidget (this is unrelated to the
38 * Nepomuk facet-widget itself). Now in combination
39 * with the search-shortcuts in the Places Panel some
40 * existing issues turned into real showstoppers.
41 *
42 * So the longterm plan is to use the Nepomuk facets
43 * again as soon as possible.
44 */
45 class DolphinFacetsWidget : public QWidget
46 {
47 Q_OBJECT
48
49 public:
50 explicit DolphinFacetsWidget(QWidget* parent = nullptr);
51 ~DolphinFacetsWidget() override;
52
53 void resetOptions();
54
55 QString ratingTerm() const;
56 QString facetType() const;
57
58 bool isRatingTerm(const QString& term) const;
59 void setRatingTerm(const QString& term);
60
61 void setFacetType(const QString& type);
62
63 signals:
64 void facetChanged();
65
66 protected:
67 void changeEvent(QEvent* event) override;
68
69 private:
70 void setRating(const int stars);
71 void setTimespan(const QDate& date);
72 void initComboBox(QComboBox* combo);
73
74 private:
75 QComboBox* m_typeSelector;
76 QComboBox* m_dateSelector;
77 QComboBox* m_ratingSelector;
78 };
79
80 #endif