Theme Editor: Began implementing classes to display project files and settings in...
[kugel-rb.git] / utils / themeeditor / projectmodel.h
blobe3bf93dcb5c11f398fa717cdc4152ae8c85378b8
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef PROJECTMODEL_H
23 #define PROJECTMODEL_H
25 #include <QAbstractItemModel>
27 class ProjectNode;
29 class ProjectModel : public QAbstractItemModel
31 Q_OBJECT
32 public:
33 static const int numColumns = 1;
35 ProjectModel(QObject *parent = 0);
36 virtual ~ProjectModel();
38 QModelIndex index(int row, int column, const QModelIndex& parent) const;
39 QModelIndex parent(const QModelIndex &child) const;
40 int rowCount(const QModelIndex &parent) const;
41 int columnCount(const QModelIndex &parent) const;
42 QVariant data(const QModelIndex &index, int role) const;
43 QVariant headerData(int col, Qt::Orientation orientation, int role) const;
44 Qt::ItemFlags flags(const QModelIndex &index) const;
45 bool setData(const QModelIndex &index, const QVariant &value, int role);
48 signals:
50 public slots:
52 private:
53 ProjectNode* root;
57 /* A simple abstract class required for categories */
58 class ProjectNode
60 public:
61 virtual ProjectNode* parent() const = 0;
62 virtual ProjectNode* child(int row) const = 0;
63 virtual int numChildren() const = 0;
64 virtual int row() const = 0;
65 virtual QVariant data(int column) const = 0;
66 virtual QString title() const = 0;
67 virtual Qt::ItemFlags flags(const QModelIndex& index) const = 0;
68 virtual void activated(const QModelIndex& index) = 0;
72 #endif // PROJECTMODEL_H