author | zautrix <zautrix> | 2005-03-27 09:46:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-27 09:46:04 (UTC) |
commit | b170a7414ff72016285ea207caa7ccf786530e77 (patch) (side-by-side diff) | |
tree | cb635d155fed20ecb33f877659a00d88bedb309e /kalarmd | |
parent | ee6f7d5329658c567882e8e496c65eef8874496e (diff) | |
download | kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.zip kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.tar.gz kdepimpi-b170a7414ff72016285ea207caa7ccf786530e77.tar.bz2 |
many fixes
-rw-r--r-- | kalarmd/alarmdialog.cpp | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index c939ae0..7ead3b9 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp @@ -44,12 +44,13 @@ #include <fcntl.h> #ifndef DESKTOP_VERSION #include <qtopia/alarmserver.h> #include <qpe/resource.h> #include <qtopia/sound.h> + #endif #include "alarmdialog.h" AlarmDialog::AlarmDialog(QWidget *parent,const char *name) @@ -88,34 +89,42 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name) playSoundTimer->stop(); layout->addWidget ( mMissedAlarms ); mMissedAlarmsCombo = new QComboBox ( this ); layout->addWidget ( mMissedAlarmsCombo ); - QVBox *suspendBox = new QVBox( this ); - suspendBox->setSpacing(3); - layout->addWidget ( suspendBox ); - QLabel* labb = new QLabel("Suspend duration (minutes):",suspendBox); + + QLabel* labb = new QLabel("Suspend duration (minutes):",this); labb->setAlignment(AlignCenter); + layout->addWidget ( labb ); fo = font(); - fo.setPointSize( 36 ); - mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); + int pointSize = 36; + if ( QApplication::desktop()->width() <= 320 ) + pointSize = 24; + fo.setPointSize( pointSize ); + mSuspendSpin = new QSpinBox(1,1440,1,this); mSuspendSpin->setFont( fo ); mSuspendSpin->setValue(7); // default suspend duration mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); #if QT_VERSION < 0x030000 mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 )); mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); #endif mSuspendSpin->setFixedSize( 100,62 ); - mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); + 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 ); @@ -256,21 +265,44 @@ void AlarmDialog::playSound () mSuspendSpin->setFocus(); raise(); qApp->processEvents(); if ( alarmCounter < maxAlarmReplay && ! mSilent) { ++alarmCounter; +#ifdef DESKTOP_VERSION + mPlayWav = true; +#endif if ( !mPlayWav || mFileName.length() < 2 ) { -#ifndef DESKTOP_VERSION +#ifdef DESKTOP_VERSION + qDebug("Sound play not possible - file not found"); +#else Sound::soundAlarm (); #endif - } else { + } 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() ); + } + +#endif + +#else QSound::play ( mFileName ); +#endif //qDebug("BEEP!"); - } + } } else { if ( ! mSilent && mSuspendCounter > 0 ) { --mSuspendCounter; reject (); hide(); return; |