-rw-r--r-- | kalarmd/alarmdialog.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index 65073f6..d72a8c2 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp | |||
@@ -96,11 +96,11 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | |||
96 | layout->addWidget ( mMissedAlarms ); | 96 | layout->addWidget ( mMissedAlarms ); |
97 | mMissedAlarmsCombo = new QComboBox ( this ); | 97 | mMissedAlarmsCombo = new QComboBox ( this ); |
98 | layout->addWidget ( mMissedAlarmsCombo ); | 98 | layout->addWidget ( mMissedAlarmsCombo ); |
99 | 99 | ||
100 | QLabel* labb = new QLabel("Suspend duration (minutes):",this); | 100 | QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this); |
101 | labb->setAlignment(AlignCenter); | 101 | labb->setAlignment(AlignCenter); |
102 | layout->addWidget ( labb ); | 102 | //layout->addWidget ( labb ); |
103 | fo = font(); | 103 | fo = font(); |
104 | int pointSize = 36; | 104 | int pointSize = 36; |
105 | if ( QApplication::desktop()->width() <= 320 ) | 105 | if ( QApplication::desktop()->width() <= 320 ) |
106 | pointSize = 18; | 106 | pointSize = 18; |
@@ -118,8 +118,9 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | |||
118 | mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); | 118 | mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); |
119 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); | 119 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); |
120 | QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); | 120 | QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); |
121 | layoutSpin->addStretch (); | 121 | layoutSpin->addStretch (); |
122 | layoutSpin->addWidget ( labb ); | ||
122 | layoutSpin->addWidget ( mSuspendSpin ); | 123 | layoutSpin->addWidget ( mSuspendSpin ); |
123 | layoutSpin->addStretch (); | 124 | layoutSpin->addStretch (); |
124 | 125 | ||
125 | QVBox * bbox = new QVBox ( this ); | 126 | QVBox * bbox = new QVBox ( this ); |
@@ -128,9 +129,9 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | |||
128 | labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); | 129 | labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); |
129 | labb->setAlignment(AlignCenter); | 130 | labb->setAlignment(AlignCenter); |
130 | mSuspendButton = new QPushButton( "Suspend", bbox); | 131 | mSuspendButton = new QPushButton( "Suspend", bbox); |
131 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); | 132 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); |
132 | QPushButton* okbut = new QPushButton( "Ok", bbox); | 133 | okbut = new QPushButton( "Ok", bbox); |
133 | mSuspendButton->setFont( fo ); | 134 | mSuspendButton->setFont( fo ); |
134 | silen->setFont( fo ); | 135 | silen->setFont( fo ); |
135 | okbut->setFont( fo ); | 136 | okbut->setFont( fo ); |
136 | okbut->setDefault( true ); | 137 | okbut->setDefault( true ); |
@@ -240,32 +241,40 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo | |||
240 | mMissedAlarms->setText( "Missed alarms:"); | 241 | mMissedAlarms->setText( "Missed alarms:"); |
241 | } else | 242 | } else |
242 | mMissedAlarmsCombo->hide(); | 243 | mMissedAlarmsCombo->hide(); |
243 | mMessage->setText(mess); | 244 | mMessage->setText(mess); |
244 | int w =sizeHint().width() ; | 245 | int w = minimumSizeHint().width() ; |
245 | int h = sizeHint().height() ; | 246 | int h = minimumSizeHint().height() ; |
246 | int dw = QApplication::desktop()->width(); | 247 | int dw = QApplication::desktop()->width(); |
247 | int dh = QApplication::desktop()->height(); | 248 | int dh = QApplication::desktop()->height(); |
248 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 249 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
249 | show(); | 250 | hide(); |
250 | raise(); | ||
251 | //qApp->processEvents(); | ||
252 | //repaint(); | ||
253 | qApp->processEvents(); | ||
254 | 251 | ||
255 | #ifndef _WIN32_ | 252 | #ifndef _WIN32_ |
256 | if ( fd_led > 0 ) { | 253 | if ( fd_led > 0 ) { |
257 | statusLED.status = LED_SALARM_ON ; | 254 | statusLED.status = LED_SALARM_ON ; |
258 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 255 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
259 | } | 256 | } |
260 | #endif | 257 | #endif |
261 | playSoundTimer->start( 1000, true ); | 258 | okbut->setDefault( true ); |
259 | QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) ); | ||
260 | // playSoundTimer->start( 1000, true ); | ||
262 | return true; | 261 | return true; |
263 | 262 | ||
264 | } | 263 | } |
265 | 264 | ||
266 | void AlarmDialog::spinBoxChanged( int ) | 265 | void AlarmDialog::forceRepaint() |
267 | { | 266 | { |
267 | |||
268 | showNormal(); | ||
269 | setActiveWindow(); | ||
270 | raise(); | ||
271 | playSoundTimer->start( 1000, true ); | ||
272 | |||
273 | } | ||
274 | void AlarmDialog::spinBoxChanged( int v ) | ||
275 | { | ||
276 | okbut->setDefault( false ); | ||
268 | mSilent = true; | 277 | mSilent = true; |
269 | } | 278 | } |
270 | 279 | ||
271 | void AlarmDialog::playSound () | 280 | void AlarmDialog::playSound () |
@@ -278,11 +287,8 @@ void AlarmDialog::playSound () | |||
278 | showNormal(); | 287 | showNormal(); |
279 | setActiveWindow(); | 288 | setActiveWindow(); |
280 | raise(); | 289 | raise(); |
281 | mSuspendSpin->setFocus(); | 290 | mSuspendSpin->setFocus(); |
282 | |||
283 | |||
284 | qApp->processEvents(); | ||
285 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { | 291 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { |
286 | ++alarmCounter; | 292 | ++alarmCounter; |
287 | #ifdef DESKTOP_VERSION | 293 | #ifdef DESKTOP_VERSION |
288 | mPlayWav = true; | 294 | mPlayWav = true; |