summaryrefslogtreecommitdiffabout
path: root/kalarmd
Unidiff
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 521781e..751ba57 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -25,99 +25,102 @@
25 25
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qsound.h> 33#include <qsound.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qspinbox.h> 35#include <qspinbox.h>
36#include <stdlib.h> 36#include <stdlib.h>
37#ifndef _WIN32_ 37#ifndef _WIN32_
38#include <unistd.h> 38#include <unistd.h>
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#endif 40#endif
41#include <stdio.h> 41#include <stdio.h>
42#include <fcntl.h> 42#include <fcntl.h>
43 43
44#ifndef DESKTOP_VERSION 44#ifndef DESKTOP_VERSION
45#include <qtopia/alarmserver.h> 45#include <qtopia/alarmserver.h>
46#include <qpe/resource.h> 46#include <qpe/resource.h>
47#include <qtopia/sound.h> 47#include <qtopia/sound.h>
48#endif 48#endif
49 49
50#include "alarmdialog.h" 50#include "alarmdialog.h"
51 51
52 52
53AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 53AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
54 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) 54 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop )
55{ 55{
56 setCaption( "KO/Pi Alarm!" ); 56 setCaption( "KO/Pi Alarm!" );
57 QVBoxLayout* layout = new QVBoxLayout( this); 57 QVBoxLayout* layout = new QVBoxLayout( this);
58 QLabel* l = new QLabel("The following event triggered alarm:",this); 58 QLabel* l = new QLabel("The following event triggered alarm:",this);
59 layout->addWidget ( l ); 59 layout->addWidget ( l );
60 l->setAlignment( AlignCenter); 60 l->setAlignment( AlignCenter);
61 mMessage = new QLabel ( " ", this ); 61 mMessage = new QLabel ( " ", this );
62 int fs = 18; 62 int fs = 18;
63 int fs2 = 12; 63 int fs2 = 12;
64 if ( QApplication::desktop()->width() < 480 ) { 64 if ( QApplication::desktop()->width() < 480 ) {
65 setMaximumSize(220, 260); 65 setMaximumSize(220, 260);
66 fs2 = 10; 66 fs2 = 10;
67 } 67 }
68 else { 68 else {
69 setMaximumSize(440, 440); 69 setMaximumSize(440, 440);
70 } 70 }
71 layout->setSpacing( 3 ); 71 layout->setSpacing( 3 );
72 layout->setMargin( 3 ); 72 layout->setMargin( 3 );
73 73 QFont fo = QApplication::font();
74 l->setFont( QFont("helvetica",fs2, QFont::Bold) ); 74 fo.setBold( true );
75 mMessage->setFont( QFont("helvetica",fs, QFont::Bold) ); 75 fo.setPointSize( fs2 );
76 l->setFont( fo );
77 fo.setPointSize( fs );
78 mMessage->setFont(fo );
76 mMessage->setAlignment( AlignCenter); 79 mMessage->setAlignment( AlignCenter);
77 l = new QLabel("Missed Alarms:",this); 80 l = new QLabel("Missed Alarms:",this);
78 l->setAlignment( AlignCenter); 81 l->setAlignment( AlignCenter);
79 layout->addWidget ( mMessage ); 82 layout->addWidget ( mMessage );
80 layout->addWidget ( l ); 83 layout->addWidget ( l );
81 mMissedAlarms= new QLabel ( "", this ); 84 mMissedAlarms= new QLabel ( "", this );
82 mMissedAlarms->setAlignment( AlignCenter); 85 mMissedAlarms->setAlignment( AlignCenter);
83 86
84 playSoundTimer = new QTimer( this ); 87 playSoundTimer = new QTimer( this );
85 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 88 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
86 89
87 playSoundTimer->stop(); 90 playSoundTimer->stop();
88 91
89 layout->addWidget ( mMissedAlarms ); 92 layout->addWidget ( mMissedAlarms );
90 QHBox *suspendBox = new QHBox( this ); 93 QHBox *suspendBox = new QHBox( this );
91 suspendBox->setSpacing(3); 94 suspendBox->setSpacing(3);
92 layout->addWidget ( suspendBox ); 95 layout->addWidget ( suspendBox );
93 (void)new QLabel("Suspend duration (minutes):",suspendBox); 96 (void)new QLabel("Suspend duration (minutes):",suspendBox);
94 mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); 97 mSuspendSpin = new QSpinBox(1,1440,1,suspendBox);
95 mSuspendSpin->setValue(7); // default suspend duration 98 mSuspendSpin->setValue(7); // default suspend duration
96 QHBox * bbox = new QHBox ( this ); 99 QHBox * bbox = new QHBox ( this );
97 layout->addWidget ( bbox ); 100 layout->addWidget ( bbox );
98 bbox->layout()->setSpacing( 5 ); 101 bbox->layout()->setSpacing( 5 );
99 QPushButton* suspend = new QPushButton( "Suspend", bbox); 102 QPushButton* suspend = new QPushButton( "Suspend", bbox);
100 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 103 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
101 QPushButton* okbut = new QPushButton( "Ok", bbox); 104 QPushButton* okbut = new QPushButton( "Ok", bbox);
102 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 105 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
103 connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 106 connect (suspend , SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
104 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); 107 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
105#ifndef _WIN32_ 108#ifndef _WIN32_
106 if ( QFile::exists ( "/dev/sharp_led" ) ) 109 if ( QFile::exists ( "/dev/sharp_led" ) )
107 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 110 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
108 else 111 else
109#endif 112#endif
110 fd_led = 0; 113 fd_led = 0;
111 statusLED.which = SHARP_LED_SALARM; 114 statusLED.which = SHARP_LED_SALARM;
112 mSilent = false; 115 mSilent = false;
113 mSuspendCounter = 0; 116 mSuspendCounter = 0;
114 setServerNotification( true ); 117 setServerNotification( true );
115} 118}
116void AlarmDialog::reject () 119void AlarmDialog::reject ()
117{ 120{
118 QTimer::singleShot ( 3000, this, SLOT (suspend()) ); 121 QTimer::singleShot ( 3000, this, SLOT (suspend()) );
119 slotSuspend(); 122 slotSuspend();
120} 123}
121AlarmDialog::~AlarmDialog() 124AlarmDialog::~AlarmDialog()
122{ 125{
123} 126}