1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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>
29 class ProjectModel
: public QAbstractItemModel
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
);
57 /* A simple abstract class required for categories */
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