author | zautrix <zautrix> | 2005-04-08 22:39:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-08 22:39:42 (UTC) |
commit | c4bab697d650c249cdff45b753b9e6df2a817877 (patch) (side-by-side diff) | |
tree | 2726d1686d42e9d3e42aae780d766df94465281a /kalarmd | |
parent | 9667e6f2589d5b2080cca928814f382761f8dda6 (diff) | |
download | kdepimpi-c4bab697d650c249cdff45b753b9e6df2a817877.zip kdepimpi-c4bab697d650c249cdff45b753b9e6df2a817877.tar.gz kdepimpi-c4bab697d650c249cdff45b753b9e6df2a817877.tar.bz2 |
alarmdialog fix
-rw-r--r-- | kalarmd/alarmdialog.cpp | 5 | ||||
-rw-r--r-- | kalarmd/alarmdialog.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index 53ff488..65073f6 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp @@ -116,48 +116,49 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); #endif mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); layoutSpin->addStretch (); layoutSpin->addWidget ( mSuspendSpin ); layoutSpin->addStretch (); QVBox * bbox = new QVBox ( this ); layout->addWidget ( bbox ); bbox->layout()->setSpacing( 2 ); labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); labb->setAlignment(AlignCenter); mSuspendButton = new QPushButton( "Suspend", bbox); QPushButton* silen = new QPushButton( " Stop sound ", bbox); QPushButton* okbut = new QPushButton( "Ok", bbox); mSuspendButton->setFont( fo ); silen->setFont( fo ); okbut->setFont( fo ); okbut->setDefault( true ); connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); + connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) ); #ifndef _WIN32_ if ( QFile::exists ( "/dev/sharp_led" ) ) fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); else #endif fd_led = 0; statusLED.which = SHARP_LED_SALARM; mSilent = false; mSuspendCounter = 0; setServerNotification( true ); } void AlarmDialog::reject () { QTimer::singleShot ( 3000, this, SLOT (suspend()) ); slotSuspend(); } AlarmDialog::~AlarmDialog() { } void AlarmDialog::silent () { mSilent = true; } void AlarmDialog::accept() @@ -241,48 +242,52 @@ bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, boo mMissedAlarmsCombo->hide(); mMessage->setText(mess); int w =sizeHint().width() ; int h = sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); show(); raise(); //qApp->processEvents(); //repaint(); qApp->processEvents(); #ifndef _WIN32_ if ( fd_led > 0 ) { statusLED.status = LED_SALARM_ON ; ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); } #endif playSoundTimer->start( 1000, true ); return true; } +void AlarmDialog::spinBoxChanged( int ) +{ + mSilent = true; +} void AlarmDialog::playSound () { if (mStopAlarm ) return; if ( mSilent ) return; showNormal(); setActiveWindow(); raise(); mSuspendSpin->setFocus(); qApp->processEvents(); 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"); diff --git a/kalarmd/alarmdialog.h b/kalarmd/alarmdialog.h index 896cf60..1e4636c 100644 --- a/kalarmd/alarmdialog.h +++ b/kalarmd/alarmdialog.h @@ -29,48 +29,49 @@ #include <qdatetime.h> #include <qstring.h> #include <qcombobox.h> #include <qpushbutton.h> #include "sharp_char.h" class QSpinBox; class QLabel; class QString; class AlarmDialog : public QDialog { Q_OBJECT public: AlarmDialog( QWidget *parent = 0, const char *name = 0 ); virtual ~AlarmDialog(); bool eventNotification(QString m, int replay , QString m2 , bool, int, int ); int getSuspendTime( ); void setSuspendTime( int ); void setServerNotification( bool b ); public slots: + void spinBoxChanged( int ); void slotOk(); void slotSuspend(); void reject () ; void silent () ; void accept(); void suspend(); void playSound (); signals: // void suspendSignal(int duration); void addAlarm(const QDateTime &, const QString & ); private: int alarmCounter; int mPauseCount; int mSuspendCounter; int maxAlarmReplay; QTimer* playSoundTimer; bool mStopAlarm; bool mSilent; bool mPlayWav; bool mServerNotification; QLabel* mMessage; QLabel* mMissedAlarms; QSpinBox *mSuspendSpin; |