digiKam
searchfieldgroup.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 : 2008-01-20
7  * Description : User interface for searches
8  *
9  * Copyright (C) 2008-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_SEARCH_FIELD_GROUP_H
26 #define DIGIKAM_SEARCH_FIELD_GROUP_H
27 
28 // Qt includes
29 
30 #include <QList>
31 #include <QSet>
32 #include <QWidget>
33 
34 // Local includes
35 
36 #include "dexpanderbox.h"
37 #include "coredbsearchxml.h"
38 
39 class QGridLayout;
40 class QLabel;
41 class QVBoxLayout;
42 
43 namespace Digikam
44 {
45 
46 class SearchFieldGroupLabel;
47 class SearchGroup;
48 class SearchField;
49 class VisibilityController;
50 
51 class SearchFieldGroup : public QWidget
52 {
53  Q_OBJECT
54 
55 public:
56 
57  explicit SearchFieldGroup(SearchGroup* const parent);
58 
59  void addField(SearchField* const field);
60  void setLabel(SearchFieldGroupLabel* const label);
61 
62  SearchField* fieldForName(const QString& fieldName) const;
63  void write(SearchXmlWriter& writer);
64 
65  void reset();
66 
67  void markField(SearchField* const field);
68  void clearMarkedFields();
70 
71 public Q_SLOTS:
72 
73  void setFieldsVisible(bool visible);
74 
75 protected Q_SLOTS:
76 
77  void slotLabelClicked();
78 
79 protected:
80 
82  QGridLayout* m_layout;
85  QSet<SearchField*> m_markedFields;
86 
87 private:
88 
89  // Disable
90  SearchFieldGroup(QWidget*) = delete;
91 };
92 
93 // -----------------------------------------------------------------------
94 
95 class SearchFieldGroupLabel : public QWidget
96 {
97  Q_OBJECT
98 
99 public:
100 
101  explicit SearchFieldGroupLabel(QWidget* const parent);
102 
103  void setTitle(const QString& title);
104 
105 public Q_SLOTS:
106 
107  void displayExpanded();
108  void displayFolded();
109 
110 Q_SIGNALS:
111 
112  void clicked();
113 
114 protected:
115 
116  QString m_title;
118  QLabel* m_expandLabel;
119 };
120 
121 } // namespace Digikam
122 
123 #endif // DIGIKAM_SEARCH_FIELD_GROUP_H
Definition: dexpanderbox.h:105
Definition: searchfieldgroup.h:96
QString m_title
Definition: searchfieldgroup.h:116
void displayFolded()
Definition: searchfieldgroup.cpp:203
DClickLabel * m_titleLabel
Definition: searchfieldgroup.h:117
void displayExpanded()
Definition: searchfieldgroup.cpp:199
SearchFieldGroupLabel(QWidget *const parent)
Definition: searchfieldgroup.cpp:171
QLabel * m_expandLabel
Definition: searchfieldgroup.h:118
void setTitle(const QString &title)
Definition: searchfieldgroup.cpp:193
Definition: searchfieldgroup.h:52
QList< SearchField * > m_fields
Definition: searchfieldgroup.h:81
QGridLayout * m_layout
Definition: searchfieldgroup.h:82
QSet< SearchField * > m_markedFields
Definition: searchfieldgroup.h:85
void slotLabelClicked()
Definition: searchfieldgroup.cpp:126
void write(SearchXmlWriter &writer)
Definition: searchfieldgroup.cpp:103
void markField(SearchField *const field)
Definition: searchfieldgroup.cpp:131
VisibilityController * m_controller
Definition: searchfieldgroup.h:84
SearchFieldGroupLabel * m_label
Definition: searchfieldgroup.h:83
QList< QRect > areaOfMarkedFields() const
Definition: searchfieldgroup.cpp:141
void clearMarkedFields()
Definition: searchfieldgroup.cpp:136
void setLabel(SearchFieldGroupLabel *const label)
Definition: searchfieldgroup.cpp:82
void reset()
Definition: searchfieldgroup.cpp:111
SearchFieldGroup(SearchGroup *const parent)
Definition: searchfieldgroup.cpp:43
void addField(SearchField *const field)
Definition: searchfieldgroup.cpp:53
void setFieldsVisible(bool visible)
Definition: searchfieldgroup.cpp:121
SearchField * fieldForName(const QString &fieldName) const
Definition: searchfieldgroup.cpp:90
Definition: searchfields.h:66
Definition: searchgroup.h:49
Definition: coredbsearchxml.h:224
Definition: visibilitycontroller.h:56
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43