File indexing completed on 2024-05-12 16:01:55
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2000 Werner Trobin <trobin@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KIS_TEMPLATE_GROUP_H 0009 #define KIS_TEMPLATE_GROUP_H 0010 0011 #include <QList> 0012 #include <QStringList> 0013 0014 #include "kritaui_export.h" 0015 0016 class KisTemplate; 0017 0018 class KRITAUI_EXPORT KisTemplateGroup 0019 { 0020 0021 public: 0022 explicit KisTemplateGroup(const QString &name, 0023 const QString &dir = QString(), 0024 int _sortingWeight = 0, 0025 bool touched = false); 0026 ~KisTemplateGroup(); 0027 0028 QString name() const { 0029 return m_name; 0030 } 0031 QStringList dirs() const { 0032 return m_dirs; 0033 } 0034 void addDir(const QString &dir) { 0035 m_dirs.append(dir); m_touched = true; 0036 } 0037 int sortingWeight() const { 0038 return m_sortingWeight; 0039 } 0040 void setSortingWeight(int weight) { 0041 m_sortingWeight = weight; 0042 } 0043 /// If all children are hidden, we are hidden too 0044 bool isHidden() const; 0045 /// if we should hide, we hide all the children 0046 void setHidden(bool hidden = true) const; 0047 0048 QList<KisTemplate*> templates() const { return m_templates; } 0049 0050 bool add(KisTemplate *t, bool force = false, bool touch = true); 0051 KisTemplate *find(const QString &name) const; 0052 0053 bool touched() const { 0054 return m_touched; 0055 } 0056 0057 private: 0058 QString m_name; 0059 QStringList m_dirs; 0060 QList<KisTemplate*> m_templates; 0061 mutable bool m_touched; 0062 int m_sortingWeight; 0063 }; 0064 0065 #endif