digiKam
databaseoption.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-19
7  * Description : an option to provide database information to the parser
8  *
9  * Copyright (C) 2009-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_DATABASE_OPTION_H
25 #define DIGIKAM_DATABASE_OPTION_H
26 
27 // Qt includes
28 
29 #include <QString>
30 #include <QMap>
31 
32 // Local includes
33 
34 #include "option.h"
35 #include "ruledialog.h"
36 
37 class QLineEdit;
38 
39 namespace Digikam
40 {
41 class DbKeysCollection;
42 class DbKeySelectorView;
43 
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit DatabaseOptionDialog(Rule* const parent);
51  ~DatabaseOptionDialog() override;
52 
54  QLineEdit* separatorLineEdit;
55 
56 private:
57 
58  // Disable
59  explicit DatabaseOptionDialog(QWidget*) = delete;
61  DatabaseOptionDialog& operator=(const DatabaseOptionDialog&) = delete;
62 };
63 
64 // --------------------------------------------------------
65 
66 typedef QMap<QString, DbKeysCollection*> DbOptionKeysMap;
67 
68 // --------------------------------------------------------
69 
70 class DatabaseOption : public Option
71 {
72  Q_OBJECT
73 
74 public:
75 
76  explicit DatabaseOption();
77  ~DatabaseOption() override;
78 
79 protected:
80 
81  QString parseOperation(ParseSettings& settings, const QRegularExpressionMatch &match) override;
82 
83 private Q_SLOTS:
84 
85  void slotTokenTriggered(const QString& token) override;
86 
87 private:
88 
89  QString parseDatabase(const QString& keyword, ParseSettings& settings);
90  void addDbKeysCollection(DbKeysCollection* key);
91 
92  void registerKeysCollection();
93  void unregisterKeysCollection();
94 
95 private:
96 
97  DbOptionKeysMap m_map;
98 
99 private:
100 
101  // Disable
102  explicit DatabaseOption(QObject*) = delete;
103  DatabaseOption(const DatabaseOption&) = delete;
104  DatabaseOption& operator=(const DatabaseOption&) = delete;
105 };
106 
107 } // namespace Digikam
108 
109 #endif // DIGIKAM_DATABASE_OPTION_H
Definition: databaseoption.h:45
QLineEdit * separatorLineEdit
Definition: databaseoption.h:54
DbKeySelectorView * dbkeySelectorView
Definition: databaseoption.h:53
DatabaseOptionDialog(Rule *const parent)
Definition: databaseoption.cpp:49
~DatabaseOptionDialog() override
Definition: databaseoption.cpp:74
Definition: databaseoption.h:71
QString parseOperation(ParseSettings &settings, const QRegularExpressionMatch &match) override
Definition: databaseoption.cpp:149
DatabaseOption()
Definition: databaseoption.cpp:80
~DatabaseOption() override
Definition: databaseoption.cpp:93
Definition: dbkeyselector.h:89
A class for managing / grouping database keys.
Definition: dbkeyscollection.h:47
Definition: option.h:35
Definition: parsesettings.h:43
Definition: ruledialog.h:38
Definition: rule.h:42
Definition: datefolderview.cpp:43
QMap< QString, DbKeysCollection * > DbOptionKeysMap
Definition: databaseoption.h:66