summaryrefslogtreecommitdiffabout
path: root/kalarmd/alarmdialog.cpp
Unidiff
Diffstat (limited to 'kalarmd/alarmdialog.cpp') (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
@@ -47,6 +47,7 @@
47#include <qtopia/alarmserver.h> 47#include <qtopia/alarmserver.h>
48#include <qpe/resource.h> 48#include <qpe/resource.h>
49#include <qtopia/sound.h> 49#include <qtopia/sound.h>
50
50#endif 51#endif
51 52
52#include "alarmdialog.h" 53#include "alarmdialog.h"
@@ -91,14 +92,16 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
91 layout->addWidget ( mMissedAlarms ); 92 layout->addWidget ( mMissedAlarms );
92 mMissedAlarmsCombo = new QComboBox ( this ); 93 mMissedAlarmsCombo = new QComboBox ( this );
93 layout->addWidget ( mMissedAlarmsCombo ); 94 layout->addWidget ( mMissedAlarmsCombo );
94 QVBox *suspendBox = new QVBox( this ); 95
95 suspendBox->setSpacing(3); 96 QLabel* labb = new QLabel("Suspend duration (minutes):",this);
96 layout->addWidget ( suspendBox );
97 QLabel* labb = new QLabel("Suspend duration (minutes):",suspendBox);
98 labb->setAlignment(AlignCenter); 97 labb->setAlignment(AlignCenter);
98 layout->addWidget ( labb );
99 fo = font(); 99 fo = font();
100 fo.setPointSize( 36 ); 100 int pointSize = 36;
101 mSuspendSpin = new QSpinBox(1,1440,1,suspendBox); 101 if ( QApplication::desktop()->width() <= 320 )
102 pointSize = 24;
103 fo.setPointSize( pointSize );
104 mSuspendSpin = new QSpinBox(1,1440,1,this);
102 mSuspendSpin->setFont( fo ); 105 mSuspendSpin->setFont( fo );
103 mSuspendSpin->setValue(7); // default suspend duration 106 mSuspendSpin->setValue(7); // default suspend duration
104 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 107 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
@@ -108,11 +111,17 @@ AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
108 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); 111 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 ));
109#endif 112#endif
110 mSuspendSpin->setFixedSize( 100,62 ); 113 mSuspendSpin->setFixedSize( 100,62 );
111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 114 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
115 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
116 layoutSpin->addStretch ();
117 layoutSpin->addWidget ( mSuspendSpin );
118 layoutSpin->addStretch ();
112 119
113 QVBox * bbox = new QVBox ( this ); 120 QVBox * bbox = new QVBox ( this );
114 layout->addWidget ( bbox ); 121 layout->addWidget ( bbox );
115 bbox->layout()->setSpacing( 2 ); 122 bbox->layout()->setSpacing( 2 );
123 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
124 labb->setAlignment(AlignCenter);
116 mSuspendButton = new QPushButton( "Suspend", bbox); 125 mSuspendButton = new QPushButton( "Suspend", bbox);
117 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 126 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
118 QPushButton* okbut = new QPushButton( "Ok", bbox); 127 QPushButton* okbut = new QPushButton( "Ok", bbox);
@@ -259,15 +268,38 @@ void AlarmDialog::playSound ()
259 qApp->processEvents(); 268 qApp->processEvents();
260 if ( alarmCounter < maxAlarmReplay && ! mSilent) { 269 if ( alarmCounter < maxAlarmReplay && ! mSilent) {
261 ++alarmCounter; 270 ++alarmCounter;
271#ifdef DESKTOP_VERSION
272 mPlayWav = true;
273#endif
262 if ( !mPlayWav || mFileName.length() < 2 ) { 274 if ( !mPlayWav || mFileName.length() < 2 ) {
263 275
264#ifndef DESKTOP_VERSION 276#ifdef DESKTOP_VERSION
277 qDebug("Sound play not possible - file not found");
278#else
265 Sound::soundAlarm (); 279 Sound::soundAlarm ();
266#endif 280#endif
267 } else { 281 } else
282
283 {
284#ifdef DESKTOP_VERSION
285#ifdef _WIN32_
286 QSound::play ( mFileName );
287#else
288
289 QString command = "playwave -r 22050 " + mFileName;
290 qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() );
291 int ret = system ( command.latin1() );
292 if ( ret != 0 ) {
293 qDebug("Sound play command failed: %s ",command.latin1() );
294 }
295
296#endif
297
298#else
268 QSound::play ( mFileName ); 299 QSound::play ( mFileName );
300#endif
269 //qDebug("BEEP!"); 301 //qDebug("BEEP!");
270 } 302 }
271 } else { 303 } else {
272 if ( ! mSilent && mSuspendCounter > 0 ) { 304 if ( ! mSilent && mSuspendCounter > 0 ) {
273 --mSuspendCounter; 305 --mSuspendCounter;