Timer can now tell where it was loaded from
[kitchenalert] / src / createtimersequencedialog.cpp
1 /**************************************************************************
2         KitchenAlert
3
4         Copyright (C) 2010-2011  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 #include "createtimersequencedialog.h"
28 #include "ui_createtimersequencedialog.h"
29
30 CreateTimerSequenceDialog::CreateTimerSequenceDialog(QWidget *parent) :
31     QDialog(parent),
32     ui(new Ui::CreateTimerSequenceDialog)
33 {
34     ui->setupUi(this);
35 }
36
37 CreateTimerSequenceDialog::~CreateTimerSequenceDialog()
38 {
39     delete ui;
40 }
41
42 void CreateTimerSequenceDialog::changeEvent(QEvent *e)
43 {
44     QDialog::changeEvent(e);
45     switch (e->type()) {
46     case QEvent::LanguageChange:
47         ui->retranslateUi(this);
48         break;
49     default:
50         break;
51     }
52 }
53
54
55 QList<Timer*> CreateTimerSequenceDialog::getTimers()
56 {
57     QList<Timer *> timers;
58     Timer* ptimer =new Timer();
59     int timeInSeconds = (ui->Timer1HoursSpinBox->value() * 60 * 60)  + (ui->timer1minutesSpinBox->value() * 60) + ui->timer1SecondsSpinBox->value();
60     ptimer->setOriginalTimeInSeconds(timeInSeconds);
61     ptimer->setAlertText(ui->timer1AlertText->text());
62     timers.append(ptimer);
63
64     return timers;
65
66
67 }