summaryrefslogtreecommitdiff
path: root/utils/themeeditor/projectmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/projectmodel.h')
-rw-r--r--utils/themeeditor/projectmodel.h42
1 files changed, 37 insertions, 5 deletions
diff --git a/utils/themeeditor/projectmodel.h b/utils/themeeditor/projectmodel.h
index e3bf93dcb5..62cf00818c 100644
--- a/utils/themeeditor/projectmodel.h
+++ b/utils/themeeditor/projectmodel.h
@@ -32,7 +32,12 @@ Q_OBJECT
32public: 32public:
33 static const int numColumns = 1; 33 static const int numColumns = 1;
34 34
35 ProjectModel(QObject *parent = 0); 35 static QString fileFilter()
36 {
37 return QObject::tr("Project Files (*.cfg);;All Files (*.*)");
38 }
39
40 ProjectModel(QString config, QObject *parent = 0);
36 virtual ~ProjectModel(); 41 virtual ~ProjectModel();
37 42
38 QModelIndex index(int row, int column, const QModelIndex& parent) const; 43 QModelIndex index(int row, int column, const QModelIndex& parent) const;
@@ -51,7 +56,6 @@ public slots:
51 56
52private: 57private:
53 ProjectNode* root; 58 ProjectNode* root;
54
55}; 59};
56 60
57/* A simple abstract class required for categories */ 61/* A simple abstract class required for categories */
@@ -63,10 +67,38 @@ public:
63 virtual int numChildren() const = 0; 67 virtual int numChildren() const = 0;
64 virtual int row() const = 0; 68 virtual int row() const = 0;
65 virtual QVariant data(int column) const = 0; 69 virtual QVariant data(int column) const = 0;
66 virtual QString title() const = 0; 70 virtual Qt::ItemFlags flags(int column) const = 0;
67 virtual Qt::ItemFlags flags(const QModelIndex& index) const = 0; 71 virtual void activated() = 0;
68 virtual void activated(const QModelIndex& index) = 0; 72
73 int indexOf(ProjectNode* child){ return children.indexOf(child); }
74
75protected:
76 QList<ProjectNode*> children;
69 77
70}; 78};
71 79
80/* A simple implementation of ProjectNode for the root */
81class ProjectRoot : public ProjectNode
82{
83public:
84 ProjectRoot(QString config);
85 virtual ~ProjectRoot();
86
87 virtual ProjectNode* parent() const{ return 0; }
88 virtual ProjectNode* child(int row) const
89 {
90 if(row >= 0 && row < children.count())
91 return children[row];
92 else
93 return 0;
94 }
95 virtual int numChildren() const{ return children.count(); }
96 virtual int row() const{ return 0; }
97 virtual QVariant data(int column) const{ return QVariant(); }
98 virtual Qt::ItemFlags flags(int column) const{ return 0; }
99 virtual void activated(){ }
100
101};
102
103
72#endif // PROJECTMODEL_H 104#endif // PROJECTMODEL_H