File indexing completed on 2025-03-09 03:57:06
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-05-19 0007 * Description : an option to provide database information to the parser 0008 * 0009 * SPDX-FileCopyrightText: 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_DATABASE_OPTION_H 0016 #define DIGIKAM_DATABASE_OPTION_H 0017 0018 // Qt includes 0019 0020 #include <QString> 0021 #include <QMap> 0022 0023 // Local includes 0024 0025 #include "option.h" 0026 #include "ruledialog.h" 0027 0028 class QLineEdit; 0029 0030 namespace Digikam 0031 { 0032 class DbKeysCollection; 0033 class DbKeySelectorView; 0034 0035 class DatabaseOptionDialog : public RuleDialog 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 explicit DatabaseOptionDialog(Rule* const parent); 0042 ~DatabaseOptionDialog() override; 0043 0044 DbKeySelectorView* dbkeySelectorView; 0045 QLineEdit* separatorLineEdit; 0046 0047 private: 0048 0049 // Disable 0050 explicit DatabaseOptionDialog(QWidget*) = delete; 0051 DatabaseOptionDialog(const DatabaseOptionDialog&) = delete; 0052 DatabaseOptionDialog& operator=(const DatabaseOptionDialog&) = delete; 0053 }; 0054 0055 // -------------------------------------------------------- 0056 0057 typedef QMap<QString, DbKeysCollection*> DbOptionKeysMap; 0058 0059 // -------------------------------------------------------- 0060 0061 class DatabaseOption : public Option 0062 { 0063 Q_OBJECT 0064 0065 public: 0066 0067 explicit DatabaseOption(); 0068 ~DatabaseOption() override; 0069 0070 protected: 0071 0072 QString parseOperation(ParseSettings& settings, 0073 const QRegularExpressionMatch& match) override; 0074 0075 private Q_SLOTS: 0076 0077 void slotTokenTriggered(const QString& token) override; 0078 0079 private: 0080 0081 QString parseDatabase(const QString& keyword, ParseSettings& settings); 0082 void addDbKeysCollection(DbKeysCollection* key); 0083 0084 void registerKeysCollection(); 0085 void unregisterKeysCollection(); 0086 0087 private: 0088 0089 DbOptionKeysMap m_map; 0090 0091 private: 0092 0093 // Disable 0094 explicit DatabaseOption(QObject*) = delete; 0095 DatabaseOption(const DatabaseOption&) = delete; 0096 DatabaseOption& operator=(const DatabaseOption&) = delete; 0097 }; 0098 0099 } // namespace Digikam 0100 0101 #endif // DIGIKAM_DATABASE_OPTION_H