summaryrefslogtreecommitdiffabout
path: root/kalarmd
authorzautrix <zautrix>2005-04-01 21:26:34 (UTC)
committer zautrix <zautrix>2005-04-01 21:26:34 (UTC)
commitefb66afca923f23a94b19da1fa12555956e70844 (patch) (unidiff)
tree0259b37dc87cc74308b3600f79675dc785216d11 /kalarmd
parent12fc62df25e15f6b20d8026ceb09118ca3ed7205 (diff)
downloadkdepimpi-efb66afca923f23a94b19da1fa12555956e70844.zip
kdepimpi-efb66afca923f23a94b19da1fa12555956e70844.tar.gz
kdepimpi-efb66afca923f23a94b19da1fa12555956e70844.tar.bz2
alarm fixes
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 7b888ab..bdeee4a 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -63,22 +63,21 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
63 setCaption( "KO/Pi Alarm!" ); 63 setCaption( "KO/Pi Alarm!" );
64 QVBoxLayout* layout = new QVBoxLayout( this); 64 QVBoxLayout* layout = new QVBoxLayout( this);
65 QLabel* l = new QLabel("The following event triggered alarm:",this); 65 QLabel* l = new QLabel("The following event triggered alarm:",this);
66 layout->addWidget ( l ); 66 layout->addWidget ( l );
67 l->setAlignment( AlignCenter); 67 l->setAlignment( AlignCenter);
68 mMessage = new QLabel ( " ", this ); 68 mMessage = new QLabel ( " ", this );
69 int fs = 18; 69 int fs = 18;
70 int fs2 = 12; 70 int fs2 = 12;
71 int baseSize = 6;
71 if ( QApplication::desktop()->width() < 480 ) { 72 if ( QApplication::desktop()->width() < 480 ) {
72 setMaximumSize(220, 260);
73 fs2 = 10; 73 fs2 = 10;
74 } 74 fs = 12;
75 else { 75 baseSize = 4;
76 setMaximumSize(440, 440);
77 } 76 }
78 layout->setSpacing( 3 ); 77 layout->setSpacing( 3 );
79 layout->setMargin( 3 ); 78 layout->setMargin( 3 );
80 QFont fo = QApplication::font(); 79 QFont fo = QApplication::font();
81 fo.setBold( true ); 80 fo.setBold( true );
82 fo.setPointSize( fs2 ); 81 fo.setPointSize( fs2 );
83 l->setFont( fo ); 82 l->setFont( fo );
84 fo.setPointSize( fs ); 83 fo.setPointSize( fs );
@@ -98,28 +97,29 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
98 layout->addWidget ( mMissedAlarmsCombo ); 97 layout->addWidget ( mMissedAlarmsCombo );
99 98
100 QLabel* labb = new QLabel("Suspend duration (minutes):",this); 99 QLabel* labb = new QLabel("Suspend duration (minutes):",this);
101 labb->setAlignment(AlignCenter); 100 labb->setAlignment(AlignCenter);
102 layout->addWidget ( labb ); 101 layout->addWidget ( labb );
103 fo = font(); 102 fo = font();
104 int pointSize = 36; 103 int pointSize = 36;
105 if ( QApplication::desktop()->width() <= 320 ) 104 if ( QApplication::desktop()->width() <= 320 )
106 pointSize = 24; 105 pointSize = 18;
107 fo.setPointSize( pointSize ); 106 fo.setPointSize( pointSize );
108 mSuspendSpin = new QSpinBox(1,1440,1,this); 107 mSuspendSpin = new QSpinBox(1,1440,1,this);
109 mSuspendSpin->setFont( fo ); 108 mSuspendSpin->setFont( fo );
110 mSuspendSpin->setValue(7); // default suspend duration 109 mSuspendSpin->setValue(7); // default suspend duration
111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 110 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
112
113#if QT_VERSION < 0x030000 113#if QT_VERSION < 0x030000
114 mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 )); 114 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
115 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); 115 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
116#endif 116#endif
117 mSuspendSpin->setFixedSize( 100,62 ); 117 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
118 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 118 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
119 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 119 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
120 layoutSpin->addStretch (); 120 layoutSpin->addStretch ();
121 layoutSpin->addWidget ( mSuspendSpin ); 121 layoutSpin->addWidget ( mSuspendSpin );
122 layoutSpin->addStretch (); 122 layoutSpin->addStretch ();
123 123
124 QVBox * bbox = new QVBox ( this ); 124 QVBox * bbox = new QVBox ( this );
125 layout->addWidget ( bbox ); 125 layout->addWidget ( bbox );
@@ -239,40 +239,44 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo
239 mMessage->setText(mess); 239 mMessage->setText(mess);
240 int w =sizeHint().width() ; 240 int w =sizeHint().width() ;
241 int h = sizeHint().height() ; 241 int h = sizeHint().height() ;
242 int dw = QApplication::desktop()->width(); 242 int dw = QApplication::desktop()->width();
243 int dh = QApplication::desktop()->height(); 243 int dh = QApplication::desktop()->height();
244 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 244 setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
245 show(); 245 show();
246 raise(); 246 raise();
247 qApp->processEvents(); 247 //qApp->processEvents();
248 repaint(); 248 //repaint();
249 qApp->processEvents(); 249 qApp->processEvents();
250 250
251#ifndef _WIN32_ 251#ifndef _WIN32_
252 if ( fd_led > 0 ) { 252 if ( fd_led > 0 ) {
253 statusLED.status = LED_SALARM_ON ; 253 statusLED.status = LED_SALARM_ON ;
254 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); 254 ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED);
255 } 255 }
256#endif 256#endif
257 playSoundTimer->start( 1000, true ); 257 playSoundTimer->start( 1000, true );
258 return true; 258 return true;
259 259
260} 260}
261 261
262 262
263void AlarmDialog::playSound () 263void AlarmDialog::playSound ()
264{ 264{
265
265 if (mStopAlarm ) 266 if (mStopAlarm )
266 return; 267 return;
268 if (mSilent )
269 return;
267 showNormal(); 270 showNormal();
268 setActiveWindow(); 271 setActiveWindow();
269 mSuspendSpin->setFocus(); 272 mSuspendSpin->setFocus();
270 raise(); 273 raise();
274 repaint();
271 275
272 qApp->processEvents(); 276 qApp->processEvents();
273 if ( alarmCounter < maxAlarmReplay && ! mSilent) { 277 if ( alarmCounter < maxAlarmReplay && ! mSilent) {
274 ++alarmCounter; 278 ++alarmCounter;
275#ifdef DESKTOP_VERSION 279#ifdef DESKTOP_VERSION
276 mPlayWav = true; 280 mPlayWav = true;
277#endif 281#endif
278 if ( !mPlayWav || mFileName.length() < 2 ) { 282 if ( !mPlayWav || mFileName.length() < 2 ) {
@@ -297,17 +301,17 @@ void AlarmDialog::playSound ()
297 qDebug("Sound play command failed: %s ",command.latin1() ); 301 qDebug("Sound play command failed: %s ",command.latin1() );
298 } 302 }
299 303
300#endif 304#endif
301 305
302#else 306#else
303 QSound::play ( mFileName ); 307 QSound::play ( mFileName );
304#endif 308#endif
305 //qDebug("BEEP!"); 309 qDebug("BEEP!");
306 } 310 }
307 } else { 311 } else {
308 if ( ! mSilent && mSuspendCounter > 0 ) { 312 if ( ! mSilent && mSuspendCounter > 0 ) {
309 --mSuspendCounter; 313 --mSuspendCounter;
310 reject (); 314 reject ();
311 hide(); 315 hide();
312 return; 316 return;
313 } 317 }