summaryrefslogtreecommitdiffstats
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
public:
static const int numColumns = 1;
- ProjectModel(QObject *parent = 0);
+ static QString fileFilter()
+ {
+ return QObject::tr("Project Files (*.cfg);;All Files (*.*)");
+ }
+
+ ProjectModel(QString config, QObject *parent = 0);
virtual ~ProjectModel();
QModelIndex index(int row, int column, const QModelIndex& parent) const;
@@ -51,7 +56,6 @@ public slots:
private:
ProjectNode* root;
-
};
/* A simple abstract class required for categories */
@@ -63,10 +67,38 @@ public:
virtual int numChildren() const = 0;
virtual int row() const = 0;
virtual QVariant data(int column) const = 0;
- virtual QString title() const = 0;
- virtual Qt::ItemFlags flags(const QModelIndex& index) const = 0;
- virtual void activated(const QModelIndex& index) = 0;
+ virtual Qt::ItemFlags flags(int column) const = 0;
+ virtual void activated() = 0;
+
+ int indexOf(ProjectNode* child){ return children.indexOf(child); }
+
+protected:
+ QList<ProjectNode*> children;
};
+/* A simple implementation of ProjectNode for the root */
+class ProjectRoot : public ProjectNode
+{
+public:
+ ProjectRoot(QString config);
+ virtual ~ProjectRoot();
+
+ virtual ProjectNode* parent() const{ return 0; }
+ virtual ProjectNode* child(int row) const
+ {
+ if(row >= 0 && row < children.count())
+ return children[row];
+ else
+ return 0;
+ }
+ virtual int numChildren() const{ return children.count(); }
+ virtual int row() const{ return 0; }
+ virtual QVariant data(int column) const{ return QVariant(); }
+ virtual Qt::ItemFlags flags(int column) const{ return 0; }
+ virtual void activated(){ }
+
+};
+
+
#endif // PROJECTMODEL_H