File indexing completed on 2025-03-09 03:57:07

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-08-08
0007  * Description : an option to provide metadata 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_METADATA_OPTION_H
0016 #define DIGIKAM_METADATA_OPTION_H
0017 
0018 // Qt includes
0019 
0020 #include <QString>
0021 
0022 // Local includes
0023 
0024 #include "option.h"
0025 #include "ruledialog.h"
0026 
0027 class QLineEdit;
0028 
0029 namespace Digikam
0030 {
0031 
0032 class MetadataPanel;
0033 
0034 class MetadataOptionDialog : public RuleDialog
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit MetadataOptionDialog(Rule* const parent);
0041     ~MetadataOptionDialog() override;
0042 
0043 public:
0044 
0045     MetadataPanel* metadataPanel;
0046     QLineEdit*     separatorLineEdit;
0047 
0048 private:
0049 
0050     // Disable
0051     explicit MetadataOptionDialog(QWidget*)                      = delete;
0052     MetadataOptionDialog(const MetadataOptionDialog&)            = delete;
0053     MetadataOptionDialog& operator=(const MetadataOptionDialog&) = delete;
0054 };
0055 
0056 // --------------------------------------------------------
0057 
0058 class MetadataOption : public Option
0059 {
0060     Q_OBJECT
0061 
0062 public:
0063 
0064     explicit MetadataOption();
0065     ~MetadataOption()                                            override = default;
0066 
0067 protected:
0068 
0069     QString parseOperation(ParseSettings& settings,
0070                            const QRegularExpressionMatch& match) override;
0071 
0072 private Q_SLOTS:
0073 
0074     void slotTokenTriggered(const QString& token)                override;
0075 
0076 private:
0077 
0078     QString parseMetadata(const QString& token, ParseSettings& settings);
0079 
0080 private:
0081 
0082     // Disable
0083     explicit MetadataOption(QObject*)                = delete;
0084     MetadataOption(const MetadataOption&)            = delete;
0085     MetadataOption& operator=(const MetadataOption&) = delete;
0086 };
0087 
0088 } // namespace Digikam
0089 
0090 #endif // DIGIKAM_METADATA_OPTION_H