Initial commit: added current sources
[kitchenalert] / src / currentalertstablemodel.h
1 /**************************************************************************
2         KitchenAlert v.0.019
3
4         Copyright (C) 2010  Heli Hyvättinen
5
6         This program is free software: you can redistribute it and/or modify
7         it under the terms of the GNU General Public License as published by
8         the Free Software Foundation, either version 3 of the License, or
9         (at your option) any later version.
10
11         This program is distributed in the hope that it will be useful,
12         but WITHOUT ANY WARRANTY; without even the implied warranty of
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14         GNU General Public License for more details.
15
16         You should have received a copy of the GNU General Public License
17         along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 **************************************************************************/
20
21
22
23
24
25 #ifndef CURRENTALERTSTABLEMODEL_H
26 #define CURRENTALERTSTABLEMODEL_H
27
28 #include <QAbstractTableModel>
29 #include "timer.h"
30
31 class CurrentAlertsTableModel : public QAbstractTableModel
32 {
33     Q_OBJECT
34 public:
35     explicit CurrentAlertsTableModel(QObject *parent = 0);
36
37     int rowCount(const QModelIndex &parent) const;
38
39     int columnCount(const QModelIndex &parent) const;
40
41     QVariant data(const QModelIndex &index, int role) const;
42
43     QModelIndex giveIndexForTimer(Timer * ptimer);
44
45 signals:
46
47 public slots:
48
49     void addTimers(QList <Timer *> timers);
50
51     void refreshTimeColumn ();
52
53     void startTimer(QModelIndex index);
54     void snoozeTimer(QModelIndex index);
55     void stopTimer(QModelIndex index);
56
57 private:
58     QList <Timer * > currentTimers_;
59
60     static const int numberOfColumns_ = 3;
61     static const int alertTextColumnNumber_ = 0;
62     static const int timeRemainingColumnNumber_ = 1;
63     static const int statusColumnNumber_ = 2;
64
65 };
66
67 #endif // CURRENTALERTSTABLEMODEL_H