Remove button, fixed column width, limited text & fixed 00:00:00
[kitchenalert] / src / timer.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 TIMER_H
28 #define TIMER_H
29
30 #include <QObject>
31 #include <QString>
32 #include <QTimer>
33
34
35 #include <QModelIndex>
36
37
38
39 /*! The timer class of KitchenAlert'
40
41   @author Heli Hyvättinen
42   @date 2010-08-12
43   @version 0.1.1
44
45 The timer class of KitchenAlert.
46
47 */
48
49 class Timer : public QObject
50 {
51     Q_OBJECT
52 public:
53     explicit Timer(QObject *parent = 0);
54
55     int getOriginalTimeInSeconds();
56     void setOriginalTimeInSeconds(int seconds);
57
58     int getRemainingTimeInSeconds();
59
60     QString getAlertText();
61     void setAlertText(QString text);
62
63     bool isAlerting();
64
65
66 signals:
67
68     void remainingTimeChanged();
69     void alert(QModelIndex indexOfAlerter);
70
71 public slots:
72     void secondPassed();
73     void start();
74     void stop();
75     void snooze();
76
77
78
79 private:
80     int _originalTime; //seconds!
81     int _remainingTime; //seconds!
82     QString _alertText;
83     QTimer _actualTimer;
84     bool alerting_;
85
86     QModelIndex whereAmI();
87
88 };
89
90 #endif // TIMER_H