digiKam
ratingfilter.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2007-10-09
7  * Description : a widget to filter album contents by rating
8  *
9  * Copyright (C) 2007-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2007 by Arnd Baecker <arnd dot baecker at web dot de>
11  * Copyright (C) 2014 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_RATING_FILTER_H
27 #define DIGIKAM_RATING_FILTER_H
28 
29 // Local includes
30 
31 #include "dlayoutbox.h"
32 #include "itemfiltersettings.h"
33 #include "ratingwidget.h"
34 
35 class QAction;
36 
37 namespace Digikam
38 {
39 
41 {
42  Q_OBJECT
43 
44 public:
45 
46  explicit RatingFilterWidget(QWidget* const parent);
47  ~RatingFilterWidget() override;
48 
51 
52  void setExcludeUnratedItems(bool excluded);
54 
55 Q_SIGNALS:
56 
58 
59 protected:
60 
61  void mousePressEvent(QMouseEvent*) override;
62  void mouseMoveEvent(QMouseEvent*) override;
63  void mouseReleaseEvent(QMouseEvent*) override;
64 
65 private:
66 
67  void updateRatingTooltip();
68 
69 private Q_SLOTS:
70 
71  void slotRatingChanged();
72 
73 private:
74 
75  class Private;
76  Private* const d;
77 };
78 
79 // -----------------------------------------------------------------------------
80 
81 class RatingFilter : public DHBox
82 {
83  Q_OBJECT
84 
85 public:
86 
87  explicit RatingFilter(QWidget* const parent);
88  ~RatingFilter() override;
89 
90  void setRating(int val);
91  int rating() const;
92 
95 
96  void setExcludeUnratedItems(bool excluded);
98 
99 Q_SIGNALS:
100 
102 
103 private Q_SLOTS:
104 
105  void slotOptionsMenu();
106  void slotOptionsTriggered(QAction*);
107 
108 private:
109 
110  class Private;
111  Private* const d;
112 };
113 
114 } // namespace Digikam
115 
116 #endif // DIGIKAM_RATING_FILTER_H
Definition: dlayoutbox.h:45
RatingCondition
Possible conditions used to filter rating: >=, =, <=.
Definition: itemfiltersettings.h:110
Definition: ratingfilter.h:41
void signalRatingFilterChanged(int, ItemFilterSettings::RatingCondition, bool)
void setRatingFilterCondition(ItemFilterSettings::RatingCondition cond)
Definition: ratingfilter.cpp:94
void mousePressEvent(QMouseEvent *) override
Definition: ratingfilter.cpp:138
ItemFilterSettings::RatingCondition ratingFilterCondition()
Definition: ratingfilter.cpp:101
~RatingFilterWidget() override
Definition: ratingfilter.cpp:84
bool isUnratedItemsExcluded()
Definition: ratingfilter.cpp:112
void setExcludeUnratedItems(bool excluded)
Definition: ratingfilter.cpp:106
RatingFilterWidget(QWidget *const parent)
Definition: ratingfilter.cpp:67
void mouseMoveEvent(QMouseEvent *) override
Definition: ratingfilter.cpp:117
void mouseReleaseEvent(QMouseEvent *) override
Definition: ratingfilter.cpp:168
Definition: ratingfilter.h:82
ItemFilterSettings::RatingCondition ratingFilterCondition()
Definition: ratingfilter.cpp:280
RatingFilter(QWidget *const parent)
Definition: ratingfilter.cpp:233
~RatingFilter() override
Definition: ratingfilter.cpp:270
void setRating(int val)
Definition: ratingfilter.cpp:347
void setRatingFilterCondition(ItemFilterSettings::RatingCondition cond)
Definition: ratingfilter.cpp:275
bool isUnratedItemsExcluded()
Definition: ratingfilter.cpp:291
void setExcludeUnratedItems(bool excluded)
Definition: ratingfilter.cpp:285
void signalRatingFilterChanged(int, ItemFilterSettings::RatingCondition, bool)
int rating() const
Definition: ratingfilter.cpp:352
Definition: ratingwidget.h:46
Definition: datefolderview.cpp:43