forked from len0rd/rockbox
Theme Editor: Working on the project viewer infrastructure
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26714 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6efc8d5bc1
commit
ceddd2f1e8
8 changed files with 226 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue