File indexing completed on 2025-01-05 03:57:18
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-06-20 0007 * Description : metadata template manager. 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_TEMPLATE_MANAGER_H 0017 #define DIGIKAM_TEMPLATE_MANAGER_H 0018 0019 // Qt includes 0020 0021 #include <QList> 0022 #include <QObject> 0023 #include <QString> 0024 0025 // Local includes 0026 0027 #include "digikam_export.h" 0028 0029 namespace Digikam 0030 { 0031 0032 class Template; 0033 0034 class DIGIKAM_GUI_EXPORT TemplateManager : public QObject 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 0040 bool load(); 0041 bool save(); 0042 void clear(); 0043 0044 void insert(const Template& t); 0045 void remove(const Template& t); 0046 0047 Template fromIndex(int index) const; 0048 Template findByTitle(const QString& title) const; 0049 Template findByContents(const Template& tref) const; 0050 QList<Template> templateList() const; 0051 0052 static TemplateManager* defaultManager(); 0053 0054 Q_SIGNALS: 0055 0056 void signalTemplateAdded(const Template&); 0057 void signalTemplateRemoved(const Template&); 0058 0059 private: 0060 0061 void insertPrivate(const Template& t); 0062 void removePrivate(const Template& t); 0063 0064 private: 0065 0066 // Disable 0067 TemplateManager(); 0068 explicit TemplateManager(QObject*); 0069 ~TemplateManager() override; 0070 0071 private: 0072 0073 friend class TemplateManagerCreator; 0074 0075 class Private; 0076 Private* const d; 0077 }; 0078 0079 } // namespace Digikam 0080 0081 #endif // DIGIKAM_TEMPLATE_MANAGER_H