From ceddd2f1e87fd884d9a9af59b20e47353085dff5 Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Wed, 9 Jun 2010 07:51:22 +0000 Subject: Theme Editor: Working on the project viewer infrastructure git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26714 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/projectmodel.h | 42 +++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'utils/themeeditor/projectmodel.h') 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 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 -- cgit v1.2.3