From 046832c821276cb07b86519ab3c0dae4ff68173d Mon Sep 17 00:00:00 2001 From: Robert Bieber Date: Mon, 14 Jun 2010 06:20:07 +0000 Subject: Theme Editor: Stripped out the sub-classes for ProjectModel and turned ProjectModel into a list model, also replaced the project tree view with a list view git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26839 a1c6a512-1295-4272-9138-f99709370657 --- utils/themeeditor/projectmodel.h | 67 ++++------------------------------------ 1 file changed, 6 insertions(+), 61 deletions(-) (limited to 'utils/themeeditor/projectmodel.h') diff --git a/utils/themeeditor/projectmodel.h b/utils/themeeditor/projectmodel.h index c7147fa83f..d577f00a69 100644 --- a/utils/themeeditor/projectmodel.h +++ b/utils/themeeditor/projectmodel.h @@ -22,13 +22,12 @@ #ifndef PROJECTMODEL_H #define PROJECTMODEL_H -#include -#include +#include +#include -class ProjectNode; class EditorWindow; -class ProjectModel : public QAbstractItemModel +class ProjectModel : public QAbstractListModel { Q_OBJECT public: @@ -42,16 +41,8 @@ public: ProjectModel(QString config, EditorWindow* mainWindow, QObject *parent = 0); virtual ~ProjectModel(); - QModelIndex index(int row, int column, const QModelIndex& parent) const; - QModelIndex parent(const QModelIndex &child) const; - int rowCount(const QModelIndex &parent) const; - int columnCount(const QModelIndex &parent) const; + int rowCount(const QModelIndex& parent) const; QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int col, Qt::Orientation orientation, int role) const; - Qt::ItemFlags flags(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); - - void loadFile(QString file); signals: @@ -59,55 +50,9 @@ public slots: void activated(const QModelIndex& index); private: - ProjectNode* root; EditorWindow* mainWindow; + QMap settings; + QList files; }; -/* A simple abstract class required for categories */ -class ProjectNode -{ -public: - virtual ProjectNode* parent() const = 0; - virtual ProjectNode* child(int row) const = 0; - virtual int numChildren() const = 0; - virtual int row() const = 0; - virtual QVariant data(int column) const = 0; - virtual Qt::ItemFlags flags(int column) const = 0; - virtual void activated() = 0; - - int indexOf(ProjectNode* child){ return children.indexOf(child); } - -protected: - QList children; - ProjectModel* model; - -}; - -/* A simple implementation of ProjectNode for the root */ -class ProjectRoot : public ProjectNode -{ -public: - ProjectRoot(QString config, ProjectModel* model); - 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(){ } - -private: - QHash settings; - -}; - - #endif // PROJECTMODEL_H -- cgit v1.2.3