digiKam
dbkeyselector.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 : 2010-05-22
7  * Description : database key selector.
8  *
9  * Copyright (C) 2010-2012 by Andi Clemens <andi dot clemens at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_DB_KEY_SELECTOR_H
25 #define DIGIKAM_DB_KEY_SELECTOR_H
26 
27 // Qt includes
28 
29 #include <QTreeWidgetItem>
30 #include <QTreeWidget>
31 #include <QStringList>
32 
33 // Local includes
34 
35 #include "searchtextbar.h"
36 #include "databaseoption.h"
37 
38 namespace Digikam
39 {
40 class DbHeaderListItem;
41 
42 class DbKeySelectorItem : public QTreeWidgetItem
43 {
44 
45 public:
46 
47  explicit DbKeySelectorItem(DbHeaderListItem* const parent, const QString& title, const QString& desc);
48  ~DbKeySelectorItem() override;
49 
50  QString key() const;
51  QString description() const;
52 
53 private:
54 
55  QString m_key;
56  QString m_description;
57 
58 private:
59 
60  // Disable
61  DbKeySelectorItem(const DbKeySelectorItem&) = delete;
62  DbKeySelectorItem& operator=(const DbKeySelectorItem&) = delete;
63 };
64 
65 // ------------------------------------------------------------------------------------
66 
67 class DbKeySelector : public QTreeWidget
68 {
69  Q_OBJECT
70 
71 public:
72 
73  explicit DbKeySelector(QWidget* const parent);
74  ~DbKeySelector() override;
75 
76  void setKeysMap(const DbOptionKeysMap& map);
77  QStringList checkedKeysList();
78 
79 private:
80 
81  // Disable
82  DbKeySelector(const DbKeySelector&) = delete;
83  DbKeySelector& operator=(const DbKeySelector&) = delete;
84 };
85 
86 // ------------------------------------------------------------------------------------
87 
88 class DbKeySelectorView : public QWidget
89 {
90  Q_OBJECT
91 
92 public:
93 
94  explicit DbKeySelectorView(QWidget* const parent);
95  ~DbKeySelectorView() override;
96 
97  void setKeysMap(const DbOptionKeysMap& map);
98  QStringList checkedKeysList() const;
99 
100 private Q_SLOTS:
101 
102  void slotSearchTextChanged(const SearchTextSettings&);
103 
104 private:
105 
106  void removeChildlessHeaders();
107 
108 private:
109 
110  // Disable
111  DbKeySelectorView(const DbKeySelectorView&) = delete;
112  DbKeySelectorView& operator=(const DbKeySelectorView&) = delete;
113 
114 private:
115 
116  class Private;
117  Private* const d;
118 };
119 
120 } // namespace Digikam
121 
122 #endif // DIGIKAM_DB_KEY_SELECTOR_H
Definition: dbheaderlistitem.h:38
Definition: dbkeyselector.h:43
DbKeySelectorItem(DbHeaderListItem *const parent, const QString &title, const QString &desc)
Definition: dbkeyselector.cpp:50
QString description() const
Definition: dbkeyselector.cpp:84
~DbKeySelectorItem() override
Definition: dbkeyselector.cpp:75
QString key() const
Definition: dbkeyselector.cpp:79
Definition: dbkeyselector.h:89
void setKeysMap(const DbOptionKeysMap &map)
Definition: dbkeyselector.cpp:198
~DbKeySelectorView() override
Definition: dbkeyselector.cpp:193
QStringList checkedKeysList() const
Definition: dbkeyselector.cpp:203
DbKeySelectorView(QWidget *const parent)
Definition: dbkeyselector.cpp:171
Definition: dbkeyselector.h:68
~DbKeySelector() override
Definition: dbkeyselector.cpp:108
DbKeySelector(QWidget *const parent)
Definition: dbkeyselector.cpp:91
QStringList checkedKeysList()
Definition: dbkeyselector.cpp:135
void setKeysMap(const DbOptionKeysMap &map)
Definition: dbkeyselector.cpp:112
Definition: searchtextbar.h:43
Definition: datefolderview.cpp:43
QMap< QString, DbKeysCollection * > DbOptionKeysMap
Definition: databaseoption.h:66