File indexing completed on 2025-01-19 03:59:45
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2015-06-16 0007 * Description : Advanced Configuration tab for metadata. 0008 * 0009 * SPDX-FileCopyrightText: 2015 by Veaceslav Munteanu <veaceslav dot munteanu90 at gmail.com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_ADVANCED_METADATA_TAB_H 0016 #define DIGIKAM_ADVANCED_METADATA_TAB_H 0017 0018 // Qt includes 0019 0020 #include <QWidget> 0021 0022 // Local includes 0023 0024 #include "dmetadatasettingscontainer.h" 0025 0026 class QStandardItemModel; 0027 class QStandardItem; 0028 0029 namespace Digikam 0030 { 0031 0032 class AdvancedMetadataTab : public QWidget 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 0038 explicit AdvancedMetadataTab(QWidget* const parent = nullptr); 0039 ~AdvancedMetadataTab() override; 0040 0041 void applySettings(); 0042 0043 public Q_SLOTS: 0044 0045 void slotSaveProfile(); 0046 void slotLoadProfile(); 0047 void slotResetToDefault(); 0048 void slotRevertChanges(); 0049 void slotAddNewNamespace(); 0050 void slotEditNamespace(); 0051 0052 private Q_SLOTS: 0053 0054 void slotUnifyChecked(bool value); 0055 void slotAllTagsChecked(bool value); 0056 void slotIndexChanged(); 0057 void slotRevertChangesAvailable(); 0058 0059 private: 0060 0061 /** 0062 * @brief The NsRoles enum will encode data from NamespaceEntry in 0063 * model items, so we could retrieve and save it later 0064 */ 0065 enum NsRoles 0066 { 0067 NAME_ROLE = Qt::UserRole + 1, 0068 ISTAG_ROLE = Qt::UserRole + 2, 0069 SEPARATOR_ROLE = Qt::UserRole + 3, 0070 NSTYPE_ROLE = Qt::UserRole + 5, 0071 0072 ZEROSTAR_ROLE = Qt::UserRole + 6, 0073 ONESTAR_ROLE = Qt::UserRole + 7, 0074 TWOSTAR_ROLE = Qt::UserRole + 8, 0075 THREESTAR_ROLE = Qt::UserRole + 9, 0076 FOURSTAR_ROLE = Qt::UserRole + 10, 0077 FIVESTAR_ROLE = Qt::UserRole + 11, 0078 0079 SPECIALOPTS_ROLE = Qt::UserRole + 12, 0080 0081 ALTNAME_ROLE = Qt::UserRole + 13, 0082 SUBSPACE_ROLE = Qt::UserRole + 14, 0083 ALTNAMEOPTS_ROLE = Qt::UserRole + 15, 0084 0085 ISDEFAULT_ROLE = Qt::UserRole + 16 0086 }; 0087 0088 private: 0089 0090 void connectButtons(); 0091 0092 /** 0093 * @brief setModelData for one model 0094 * @param model - model to be populated 0095 * @param container - namespace container to get data 0096 */ 0097 void setModelData(QStandardItemModel* const model, const QList<NamespaceEntry>& container); 0098 void setUi(); 0099 0100 void setDataToItem(QStandardItem* const item, const NamespaceEntry& entry); 0101 0102 /** 0103 * @brief getModelIndex - the view can have up to 6 models 0104 * based on tags, comments, rating selection 0105 * and read/ write operation selected 0106 * @return - return index of correct model in d->models 0107 */ 0108 int getModelIndex(); 0109 0110 QList<NamespaceEntry>& getCurrentContainer(); 0111 0112 void setModels(); 0113 0114 void updateContainer(); 0115 0116 void saveModelData(QStandardItemModel* const model, QList<NamespaceEntry>& container); 0117 0118 private: 0119 0120 class Private; 0121 Private* d; 0122 }; 0123 0124 } // namespace Digikam 0125 0126 #endif // DIGIKAM_ADVANCED_METADATA_TAB_H