diff options
Diffstat (limited to 'src/SessionTreeModel.h')
-rw-r--r-- | src/SessionTreeModel.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/SessionTreeModel.h b/src/SessionTreeModel.h new file mode 100644 index 0000000..34b830e --- /dev/null +++ b/src/SessionTreeModel.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2010,2011 - RZ Uni Freiburg + * Copyright (c) 2010,2011 - OpenSLX Project + * + * This program/file is free software distributed under the GPL version 2. + * See http://gpl.openslx.org/ + * + * If you have any feedback please consult http://feedback.openslx.org/ and + * send your feedback to feedback@openslx.org + * + * General information about OpenSLX - libChooser can be found under + * http://openslx.org + * + */ + +#ifndef VMCHOOSER_SESSIONTREEMODEL_H +#define VMCHOOSER_SESSIONTREEMODEL_H + +#include <QAbstractItemModel> +#include <QModelIndex> +#include <QVariant> + +class SessionTreeItem; +class Session; + +class SessionTreeModel : public QAbstractItemModel { + Q_OBJECT + + public: + explicit SessionTreeModel(QObject *parent = 0); + ~SessionTreeModel(); + + QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + void addItems(const QList<Session*>& sessions, const QString& section); + + + private: + SessionTreeItem* root_; +}; + +#endif // VMCHOOSER_SESSIONTREEMODEL_H |