Ready to be packaged
[kitchenalert] / src / currentalertstablemodel.h
1 /**************************************************************************
2         KitchenAlert
3
4         Copyright (C) 2010  Heli Hyvättinen
5
6         This file is part of KitchenAlert.
7
8         Kitchen Alert is free software: you can redistribute it and/or modify
9         it under the terms of the GNU General Public License as published by
10         the Free Software Foundation, either version 3 of the License, or
11         (at your option) any later version.
12
13         This program is distributed in the hope that it will be useful,
14         but WITHOUT ANY WARRANTY; without even the implied warranty of
15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16         GNU General Public License for more details.
17
18         You should have received a copy of the GNU General Public License
19         along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 **************************************************************************/
22
23
24
25
26
27 #ifndef CURRENTALERTSTABLEMODEL_H
28 #define CURRENTALERTSTABLEMODEL_H
29
30 #include <QAbstractTableModel>
31 #include <QMainWindow>
32 #include "timer.h"
33
34
35 /*! Class that contains the model that holds the timers'
36
37   @author Heli Hyvättinen
38   @date 2010-06-26
39   @version 0.09
40
41 Class that contains the model that holds the timers
42
43 */
44
45
46 class CurrentAlertsTableModel : public QAbstractTableModel
47 {
48     Q_OBJECT
49 public:
50     explicit CurrentAlertsTableModel(QObject *parent = 0);
51
52     int rowCount(const QModelIndex &parent) const;
53
54     int columnCount(const QModelIndex &parent) const;
55
56     QVariant data(const QModelIndex &index, int role) const;
57
58     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
59
60     QModelIndex giveIndexForTimer(Timer * ptimer);
61
62     bool isThisTimerAlerting(QModelIndex index);
63
64 signals:
65
66 public slots:
67
68     void addTimers(QList <Timer *> timers);
69
70     void refreshTimeColumn ();
71
72     void startTimer(QModelIndex index);
73     void snoozeTimer(QModelIndex index);
74     void stopTimer(QModelIndex index);
75
76
77     void setUpdateViewOnChanges(bool update);
78
79 private:
80     QList <Timer * > currentTimers_;
81
82     static const int numberOfColumns_ = 3;
83     static const int alertTextColumnNumber_ = 0;
84     static const int timeRemainingColumnNumber_ = 1;
85     static const int statusColumnNumber_ = 2;
86
87
88
89     bool updateViewOnChanges_;
90
91 };
92
93 #endif // CURRENTALERTSTABLEMODEL_H