-rw-r--r-- | kalarmd/alarmdialog.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index ddb125a..18ce9da 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp @@ -206,118 +206,122 @@ void AlarmDialog::slotSuspend() mess +=mMessage->text(); #ifndef DESKTOP_VERSION if ( mServerNotification ) AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); #endif emit addAlarm( nextA , mess ); slotOk(); } void AlarmDialog::setServerNotification( bool b ) { mServerNotification = b; } int AlarmDialog::getSuspendTime( ) { return mSuspendSpin->value(); } void AlarmDialog::setSuspendTime( int val ) { mSuspendSpin->setValue( val ); } bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) { if ( mess.left( 9) != "Suspended" ) mSuspendCounter = suspendtimes; mPauseCount = pause; mFileName = fn; mPlayWav = playwav; if ( !QFile::exists( fn ) ) mFileName = ""; alarmCounter = 0 ; maxAlarmReplay = replay ; mStopAlarm = false; mSilent = false; if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { mMissedAlarmsCombo->show(); QString newItem = mMessage->text().stripWhiteSpace(); newItem.replace( QRegExp("\n"), QString(" ") ); mMissedAlarmsCombo->insertItem( newItem ); mMissedAlarms->setText( "Missed alarms:"); } else mMissedAlarmsCombo->hide(); mMessage->setText(mess); int w = minimumSizeHint().width() ; int h = minimumSizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); + if ( w < 220 ) w = 220; + if ( h < 220 ) h = 220; setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); - hide(); + showNormal(); + setActiveWindow(); + raise(); + setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); + //hide(); #ifndef _WIN32_ if ( fd_led > 0 ) { statusLED.status = LED_SALARM_ON ; ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); } #endif okbut->setDefault( true ); QTimer::singleShot( 1, this, SLOT ( forceRepaint() ) ); // playSoundTimer->start( 1000, true ); return true; } void AlarmDialog::forceRepaint() { - - showNormal(); setActiveWindow(); - raise(); + repaint(); mSuspendSpin->setFocus(); playSoundTimer->start( 1000, true ); } void AlarmDialog::spinBoxChanged( int v ) { okbut->setDefault( false ); mSilent = true; } void AlarmDialog::playSound () { if (mStopAlarm ) return; if ( mSilent ) return; //showNormal(); setActiveWindow(); //raise(); mSuspendSpin->setFocus(); if ( alarmCounter < maxAlarmReplay && ! mSilent) { ++alarmCounter; #ifdef DESKTOP_VERSION mPlayWav = true; #endif if ( !mPlayWav || mFileName.length() < 2 ) { #ifdef DESKTOP_VERSION qDebug("Sound play not possible - file not found"); #else Sound::soundAlarm (); #endif } else { #ifdef DESKTOP_VERSION #ifdef _WIN32_ QSound::play ( mFileName ); #else QString command = "playwave -r 22050 " + mFileName; qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() ); int ret = system ( command.latin1() ); if ( ret != 0 ) { qDebug("Sound play command failed: %s ",command.latin1() ); } |