]> git.sven.stormbind.net Git - sven/vym.git/blob - taskmodel.h
eab06d1d2daf4b7debb8e76cc50913e88f383350
[sven/vym.git] / taskmodel.h
1 #ifndef TASKMODEL_H
2 #define TASKMODEL_H
3
4 #include <QAbstractTableModel>
5 #include <QList>
6
7 #include "task.h"
8
9 class BranchItem;
10 class VymModel;
11
12 class TaskModel : public QAbstractTableModel
13 {
14     Q_OBJECT
15     
16 public:
17     TaskModel(QObject *parent=0);
18     QModelIndex index (Task* t);
19     QModelIndex indexRowEnd (Task* t);
20     Task* getTask (const QModelIndex &ix) const;
21     int rowCount(const QModelIndex &parent) const;
22     int columnCount(const QModelIndex &parent) const;
23     QVariant data(const QModelIndex &index, int role) const;
24     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
25     Qt::ItemFlags flags(const QModelIndex &index) const;
26 //    bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
27     bool setData(const QModelIndex &index, Task *t, int role=Qt::EditRole);
28     void emitDataChanged (Task *t);
29     bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex(),Task *t=NULL);
30     bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex());
31
32     int count (VymModel *model=NULL);
33     Task* createTask (BranchItem *bi);
34     void deleteTask (Task* t);
35     void recalcPriorities();
36
37     void setShowParentsLevel (uint i);
38     uint getShowParentsLevel ();
39
40 private:
41     QList <Task*> tasks;
42     uint showParentsLevel;
43  };
44
45 #endif