File indexing completed on 2024-05-12 16:01:55

0001 /*
0002    This file is part of the KDE project
0003    ompyright (C) 2000 Werner Trobin <trobin@kde.org>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KIS_TEMPLATE_TREE_H
0009 #define KIS_TEMPLATE_TREE_H
0010 
0011 #include <QList>
0012 #include <QString>
0013 #include "kritaui_export.h"
0014 
0015 class KisTemplate;
0016 class KisTemplateGroup;
0017 
0018 class KRITAUI_EXPORT KisTemplateTree
0019 {
0020 
0021 public:
0022     KisTemplateTree(const QString &templatesResourcePath,
0023                    bool readTree = false);
0024     ~KisTemplateTree();
0025 
0026     QString templatesResourcePath() const {
0027         return m_templatesResourcePath;
0028     }
0029     void readTemplateTree();
0030     void writeTemplateTree();
0031 
0032     bool add(KisTemplateGroup *g);
0033     KisTemplateGroup *find(const QString &name) const;
0034 
0035     KisTemplateGroup *defaultGroup() const {
0036         return m_defaultGroup;
0037     }
0038     KisTemplate *defaultTemplate() const {
0039         return m_defaultTemplate;
0040     }
0041 
0042     QList<KisTemplateGroup*> groups () const { return m_groups; }
0043 
0044 private:
0045     void readGroups();
0046     void readTemplates();
0047     void writeTemplate(KisTemplate *t, KisTemplateGroup *group,
0048                        const QString &localDir);
0049 
0050     QString m_templatesResourcePath;
0051     QList<KisTemplateGroup*> m_groups;
0052     KisTemplateGroup *m_defaultGroup;
0053     KisTemplate *m_defaultTemplate;
0054 };
0055 
0056 #endif