summaryrefslogtreecommitdiffabout
path: root/kalarmd
Side-by-side diff
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp52
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;