source: src/gui/alarmdialog.cpp @ a35aa83

qt5
Last change on this file since a35aa83 was 6ae1026, checked in by pavelpa <pavelpa@…>, 13 years ago

started work on alarm(libaalarm)

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#include "alarmdialog.h"
2
3#include <QApplication>
4#include <alarm.h>
5
6const int SNOOZE_TIME = 5; // in minutes
7
8AlarmDialog::AlarmDialog(int argc, char *argv[], QWidget *aParent)
9    : QDialog(aParent)
10    , mEventId(0)
11    , mAlarmId(0)
12{
13    setupUi(this);
14
15    if(argc<3)
16    {
17        // not enough arguments passed to the dialog
18        // Usage: $ ./dialog eventId alarmId
19        // Example: $ ./dialog 521 13
20        //
21        // TODO: handle this case
22    }
23    else
24    {
25        mEventId = QString(argv[1]).toInt();
26        mAlarmId = QString(argv[2]).toInt();
27    }
28
29    connect(stopPB, SIGNAL(clicked()), qApp, SLOT(quit()));
30    connect(appPB, SIGNAL(clicked()), SLOT(runApp()));
31    connect(snoozePB, SIGNAL(clicked()), SLOT(snooze()));
32
33    message->setText(QString(argv[1]).append("-").append(QString(argv[2])));
34}
35
36void AlarmDialog::runApp()
37{
38}
39
40void AlarmDialog::snooze()
41{
42    if(mEventId==0) // not valid event ID
43        return;
44
45    Alarm alarm;
46    alarm.addAlarm(mEventId,QDateTime::currentDateTime().addSecs(60*SNOOZE_TIME));
47    qApp->quit();
48}
49
Note: See TracBrowser for help on using the repository browser.