-rw-r--r-- | kalarmd/alarmdialog.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index 7ead3b9..7b888ab 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp | |||
@@ -1,312 +1,316 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the KDE alarm daemon. | 2 | This file is part of the KDE alarm daemon. |
3 | Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qapp.h> | 28 | #include <qapp.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qsound.h> | 33 | #include <qsound.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #ifndef DESKTOP_VERSION | ||
35 | #define protected public | 36 | #define protected public |
36 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
37 | #undef protected | 38 | #undef protected |
39 | #else | ||
40 | #include <qspinbox.h> | ||
41 | #endif | ||
38 | #include <stdlib.h> | 42 | #include <stdlib.h> |
39 | #ifndef _WIN32_ | 43 | #ifndef _WIN32_ |
40 | #include <unistd.h> | 44 | #include <unistd.h> |
41 | #include <sys/ioctl.h> | 45 | #include <sys/ioctl.h> |
42 | #endif | 46 | #endif |
43 | #include <stdio.h> | 47 | #include <stdio.h> |
44 | #include <fcntl.h> | 48 | #include <fcntl.h> |
45 | 49 | ||
46 | #ifndef DESKTOP_VERSION | 50 | #ifndef DESKTOP_VERSION |
47 | #include <qtopia/alarmserver.h> | 51 | #include <qtopia/alarmserver.h> |
48 | #include <qpe/resource.h> | 52 | #include <qpe/resource.h> |
49 | #include <qtopia/sound.h> | 53 | #include <qtopia/sound.h> |
50 | 54 | ||
51 | #endif | 55 | #endif |
52 | 56 | ||
53 | #include "alarmdialog.h" | 57 | #include "alarmdialog.h" |
54 | 58 | ||
55 | 59 | ||
56 | AlarmDialog::AlarmDialog(QWidget *parent,const char *name) | 60 | AlarmDialog::AlarmDialog(QWidget *parent,const char *name) |
57 | : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) | 61 | : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) |
58 | { | 62 | { |
59 | setCaption( "KO/Pi Alarm!" ); | 63 | setCaption( "KO/Pi Alarm!" ); |
60 | QVBoxLayout* layout = new QVBoxLayout( this); | 64 | QVBoxLayout* layout = new QVBoxLayout( this); |
61 | QLabel* l = new QLabel("The following event triggered alarm:",this); | 65 | QLabel* l = new QLabel("The following event triggered alarm:",this); |
62 | layout->addWidget ( l ); | 66 | layout->addWidget ( l ); |
63 | l->setAlignment( AlignCenter); | 67 | l->setAlignment( AlignCenter); |
64 | mMessage = new QLabel ( " ", this ); | 68 | mMessage = new QLabel ( " ", this ); |
65 | int fs = 18; | 69 | int fs = 18; |
66 | int fs2 = 12; | 70 | int fs2 = 12; |
67 | if ( QApplication::desktop()->width() < 480 ) { | 71 | if ( QApplication::desktop()->width() < 480 ) { |
68 | setMaximumSize(220, 260); | 72 | setMaximumSize(220, 260); |
69 | fs2 = 10; | 73 | fs2 = 10; |
70 | } | 74 | } |
71 | else { | 75 | else { |
72 | setMaximumSize(440, 440); | 76 | setMaximumSize(440, 440); |
73 | } | 77 | } |
74 | layout->setSpacing( 3 ); | 78 | layout->setSpacing( 3 ); |
75 | layout->setMargin( 3 ); | 79 | layout->setMargin( 3 ); |
76 | QFont fo = QApplication::font(); | 80 | QFont fo = QApplication::font(); |
77 | fo.setBold( true ); | 81 | fo.setBold( true ); |
78 | fo.setPointSize( fs2 ); | 82 | fo.setPointSize( fs2 ); |
79 | l->setFont( fo ); | 83 | l->setFont( fo ); |
80 | fo.setPointSize( fs ); | 84 | fo.setPointSize( fs ); |
81 | mMessage->setFont(fo ); | 85 | mMessage->setFont(fo ); |
82 | mMessage->setAlignment( AlignCenter); | 86 | mMessage->setAlignment( AlignCenter); |
83 | layout->addWidget ( mMessage ); | 87 | layout->addWidget ( mMessage ); |
84 | mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); | 88 | mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); |
85 | mMissedAlarms->setAlignment( AlignCenter); | 89 | mMissedAlarms->setAlignment( AlignCenter); |
86 | 90 | ||
87 | playSoundTimer = new QTimer( this ); | 91 | playSoundTimer = new QTimer( this ); |
88 | connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); | 92 | connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); |
89 | 93 | ||
90 | playSoundTimer->stop(); | 94 | playSoundTimer->stop(); |
91 | 95 | ||
92 | layout->addWidget ( mMissedAlarms ); | 96 | layout->addWidget ( mMissedAlarms ); |
93 | mMissedAlarmsCombo = new QComboBox ( this ); | 97 | mMissedAlarmsCombo = new QComboBox ( this ); |
94 | layout->addWidget ( mMissedAlarmsCombo ); | 98 | layout->addWidget ( mMissedAlarmsCombo ); |
95 | 99 | ||
96 | QLabel* labb = new QLabel("Suspend duration (minutes):",this); | 100 | QLabel* labb = new QLabel("Suspend duration (minutes):",this); |
97 | labb->setAlignment(AlignCenter); | 101 | labb->setAlignment(AlignCenter); |
98 | layout->addWidget ( labb ); | 102 | layout->addWidget ( labb ); |
99 | fo = font(); | 103 | fo = font(); |
100 | int pointSize = 36; | 104 | int pointSize = 36; |
101 | if ( QApplication::desktop()->width() <= 320 ) | 105 | if ( QApplication::desktop()->width() <= 320 ) |
102 | pointSize = 24; | 106 | pointSize = 24; |
103 | fo.setPointSize( pointSize ); | 107 | fo.setPointSize( pointSize ); |
104 | mSuspendSpin = new QSpinBox(1,1440,1,this); | 108 | mSuspendSpin = new QSpinBox(1,1440,1,this); |
105 | mSuspendSpin->setFont( fo ); | 109 | mSuspendSpin->setFont( fo ); |
106 | mSuspendSpin->setValue(7); // default suspend duration | 110 | mSuspendSpin->setValue(7); // default suspend duration |
107 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); | 111 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); |
108 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); | 112 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); |
109 | #if QT_VERSION < 0x030000 | 113 | #if QT_VERSION < 0x030000 |
110 | mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 )); | 114 | mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 )); |
111 | mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); | 115 | mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); |
112 | #endif | 116 | #endif |
113 | mSuspendSpin->setFixedSize( 100,62 ); | 117 | mSuspendSpin->setFixedSize( 100,62 ); |
114 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); | 118 | mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); |
115 | QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); | 119 | QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); |
116 | layoutSpin->addStretch (); | 120 | layoutSpin->addStretch (); |
117 | layoutSpin->addWidget ( mSuspendSpin ); | 121 | layoutSpin->addWidget ( mSuspendSpin ); |
118 | layoutSpin->addStretch (); | 122 | layoutSpin->addStretch (); |
119 | 123 | ||
120 | QVBox * bbox = new QVBox ( this ); | 124 | QVBox * bbox = new QVBox ( this ); |
121 | layout->addWidget ( bbox ); | 125 | layout->addWidget ( bbox ); |
122 | bbox->layout()->setSpacing( 2 ); | 126 | bbox->layout()->setSpacing( 2 ); |
123 | labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); | 127 | labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); |
124 | labb->setAlignment(AlignCenter); | 128 | labb->setAlignment(AlignCenter); |
125 | mSuspendButton = new QPushButton( "Suspend", bbox); | 129 | mSuspendButton = new QPushButton( "Suspend", bbox); |
126 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); | 130 | QPushButton* silen = new QPushButton( " Stop sound ", bbox); |
127 | QPushButton* okbut = new QPushButton( "Ok", bbox); | 131 | QPushButton* okbut = new QPushButton( "Ok", bbox); |
128 | mSuspendButton->setFont( fo ); | 132 | mSuspendButton->setFont( fo ); |
129 | silen->setFont( fo ); | 133 | silen->setFont( fo ); |
130 | okbut->setFont( fo ); | 134 | okbut->setFont( fo ); |
131 | okbut->setDefault( true ); | 135 | okbut->setDefault( true ); |
132 | connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); | 136 | connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); |
133 | connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); | 137 | connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); |
134 | connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); | 138 | connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); |
135 | #ifndef _WIN32_ | 139 | #ifndef _WIN32_ |
136 | if ( QFile::exists ( "/dev/sharp_led" ) ) | 140 | if ( QFile::exists ( "/dev/sharp_led" ) ) |
137 | fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); | 141 | fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); |
138 | else | 142 | else |
139 | #endif | 143 | #endif |
140 | fd_led = 0; | 144 | fd_led = 0; |
141 | statusLED.which = SHARP_LED_SALARM; | 145 | statusLED.which = SHARP_LED_SALARM; |
142 | mSilent = false; | 146 | mSilent = false; |
143 | mSuspendCounter = 0; | 147 | mSuspendCounter = 0; |
144 | setServerNotification( true ); | 148 | setServerNotification( true ); |
145 | } | 149 | } |
146 | void AlarmDialog::reject () | 150 | void AlarmDialog::reject () |
147 | { | 151 | { |
148 | QTimer::singleShot ( 3000, this, SLOT (suspend()) ); | 152 | QTimer::singleShot ( 3000, this, SLOT (suspend()) ); |
149 | slotSuspend(); | 153 | slotSuspend(); |
150 | } | 154 | } |
151 | AlarmDialog::~AlarmDialog() | 155 | AlarmDialog::~AlarmDialog() |
152 | { | 156 | { |
153 | } | 157 | } |
154 | void AlarmDialog::silent () | 158 | void AlarmDialog::silent () |
155 | { | 159 | { |
156 | mSilent = true; | 160 | mSilent = true; |
157 | } | 161 | } |
158 | void AlarmDialog::accept() | 162 | void AlarmDialog::accept() |
159 | { | 163 | { |
160 | slotOk(); | 164 | slotOk(); |
161 | } | 165 | } |
162 | 166 | ||
163 | void AlarmDialog::suspend() | 167 | void AlarmDialog::suspend() |
164 | { | 168 | { |
165 | #ifdef DESKTOP_VERSION | 169 | #ifdef DESKTOP_VERSION |
166 | 170 | ||
167 | #else | 171 | #else |
168 | Sound::soundAlarm (); | 172 | Sound::soundAlarm (); |
169 | #endif | 173 | #endif |
170 | } | 174 | } |
171 | void AlarmDialog::slotOk() | 175 | void AlarmDialog::slotOk() |
172 | { | 176 | { |
173 | mStopAlarm = true; | 177 | mStopAlarm = true; |
174 | mMissedAlarms->setText("(No missed Alarms)"); | 178 | mMissedAlarms->setText("(No missed Alarms)"); |
175 | mMessage->setText(""); | 179 | mMessage->setText(""); |
176 | mMissedAlarmsCombo->clear(); | 180 | mMissedAlarmsCombo->clear(); |
177 | #ifndef _WIN32_ | 181 | #ifndef _WIN32_ |
178 | if ( fd_led > 0 ) { | 182 | if ( fd_led > 0 ) { |
179 | statusLED.status = LED_SALARM_OFF ; | 183 | statusLED.status = LED_SALARM_OFF ; |
180 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 184 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
181 | } | 185 | } |
182 | #endif | 186 | #endif |
183 | QDialog::accept(); | 187 | QDialog::accept(); |
184 | } | 188 | } |
185 | 189 | ||
186 | void AlarmDialog::slotSuspend() | 190 | void AlarmDialog::slotSuspend() |
187 | { | 191 | { |
188 | //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); | 192 | //qDebug("AlarmDialog::suspend() "); // emit suspendSignal(mSuspendSpin->value()); |
189 | mStopAlarm = true; | 193 | mStopAlarm = true; |
190 | QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); | 194 | QDateTime nextA = QDateTime::currentDateTime().addSecs( mSuspendSpin->value() * 60 ); |
191 | QString mess = "suspend_alarm" +mFileName+"+++" ; | 195 | QString mess = "suspend_alarm" +mFileName+"+++" ; |
192 | if ( mMessage->text().left( 10 ) !="Suspended:" ) | 196 | if ( mMessage->text().left( 10 ) !="Suspended:" ) |
193 | mess += "Suspended:\n"; | 197 | mess += "Suspended:\n"; |
194 | mess +=mMessage->text(); | 198 | mess +=mMessage->text(); |
195 | #ifndef DESKTOP_VERSION | 199 | #ifndef DESKTOP_VERSION |
196 | if ( mServerNotification ) | 200 | if ( mServerNotification ) |
197 | AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); | 201 | AlarmServer::addAlarm ( nextA,"koalarm",mess.latin1()); |
198 | #endif | 202 | #endif |
199 | emit addAlarm( nextA , mess ); | 203 | emit addAlarm( nextA , mess ); |
200 | slotOk(); | 204 | slotOk(); |
201 | } | 205 | } |
202 | 206 | ||
203 | void AlarmDialog::setServerNotification( bool b ) | 207 | void AlarmDialog::setServerNotification( bool b ) |
204 | { | 208 | { |
205 | mServerNotification = b; | 209 | mServerNotification = b; |
206 | } | 210 | } |
207 | int AlarmDialog::getSuspendTime( ) | 211 | int AlarmDialog::getSuspendTime( ) |
208 | { | 212 | { |
209 | return mSuspendSpin->value(); | 213 | return mSuspendSpin->value(); |
210 | 214 | ||
211 | } | 215 | } |
212 | void AlarmDialog::setSuspendTime( int val ) | 216 | void AlarmDialog::setSuspendTime( int val ) |
213 | { | 217 | { |
214 | mSuspendSpin->setValue( val ); | 218 | mSuspendSpin->setValue( val ); |
215 | } | 219 | } |
216 | bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) | 220 | bool AlarmDialog::eventNotification( QString mess, int replay , QString fn, bool playwav, int pause , int suspendtimes) |
217 | { | 221 | { |
218 | if ( mess.left( 9) != "Suspended" ) | 222 | if ( mess.left( 9) != "Suspended" ) |
219 | mSuspendCounter = suspendtimes; | 223 | mSuspendCounter = suspendtimes; |
220 | mPauseCount = pause; | 224 | mPauseCount = pause; |
221 | mFileName = fn; | 225 | mFileName = fn; |
222 | mPlayWav = playwav; | 226 | mPlayWav = playwav; |
223 | if ( !QFile::exists( fn ) ) | 227 | if ( !QFile::exists( fn ) ) |
224 | mFileName = ""; | 228 | mFileName = ""; |
225 | alarmCounter = 0 ; | 229 | alarmCounter = 0 ; |
226 | maxAlarmReplay = replay ; | 230 | maxAlarmReplay = replay ; |
227 | mStopAlarm = false; | 231 | mStopAlarm = false; |
228 | mSilent = false; | 232 | mSilent = false; |
229 | if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { | 233 | if ( !mMessage->text().stripWhiteSpace().isEmpty() ) { |
230 | mMissedAlarmsCombo->show(); | 234 | mMissedAlarmsCombo->show(); |
231 | mMissedAlarmsCombo->insertItem( mMessage->text().stripWhiteSpace() ); | 235 | mMissedAlarmsCombo->insertItem( mMessage->text().stripWhiteSpace() ); |
232 | mMissedAlarms->setText( "Missed alarms:"); | 236 | mMissedAlarms->setText( "Missed alarms:"); |
233 | } else | 237 | } else |
234 | mMissedAlarmsCombo->hide(); | 238 | mMissedAlarmsCombo->hide(); |
235 | mMessage->setText(mess); | 239 | mMessage->setText(mess); |
236 | int w =sizeHint().width() ; | 240 | int w =sizeHint().width() ; |
237 | int h = sizeHint().height() ; | 241 | int h = sizeHint().height() ; |
238 | int dw = QApplication::desktop()->width(); | 242 | int dw = QApplication::desktop()->width(); |
239 | int dh = QApplication::desktop()->height(); | 243 | int dh = QApplication::desktop()->height(); |
240 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 244 | setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
241 | show(); | 245 | show(); |
242 | raise(); | 246 | raise(); |
243 | qApp->processEvents(); | 247 | qApp->processEvents(); |
244 | repaint(); | 248 | repaint(); |
245 | qApp->processEvents(); | 249 | qApp->processEvents(); |
246 | 250 | ||
247 | #ifndef _WIN32_ | 251 | #ifndef _WIN32_ |
248 | if ( fd_led > 0 ) { | 252 | if ( fd_led > 0 ) { |
249 | statusLED.status = LED_SALARM_ON ; | 253 | statusLED.status = LED_SALARM_ON ; |
250 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); | 254 | ioctl (fd_led, SHARP_LED_SETSTATUS, &statusLED); |
251 | } | 255 | } |
252 | #endif | 256 | #endif |
253 | playSoundTimer->start( 1000, true ); | 257 | playSoundTimer->start( 1000, true ); |
254 | return true; | 258 | return true; |
255 | 259 | ||
256 | } | 260 | } |
257 | 261 | ||
258 | 262 | ||
259 | void AlarmDialog::playSound () | 263 | void AlarmDialog::playSound () |
260 | { | 264 | { |
261 | if (mStopAlarm ) | 265 | if (mStopAlarm ) |
262 | return; | 266 | return; |
263 | showNormal(); | 267 | showNormal(); |
264 | setActiveWindow(); | 268 | setActiveWindow(); |
265 | mSuspendSpin->setFocus(); | 269 | mSuspendSpin->setFocus(); |
266 | raise(); | 270 | raise(); |
267 | 271 | ||
268 | qApp->processEvents(); | 272 | qApp->processEvents(); |
269 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { | 273 | if ( alarmCounter < maxAlarmReplay && ! mSilent) { |
270 | ++alarmCounter; | 274 | ++alarmCounter; |
271 | #ifdef DESKTOP_VERSION | 275 | #ifdef DESKTOP_VERSION |
272 | mPlayWav = true; | 276 | mPlayWav = true; |
273 | #endif | 277 | #endif |
274 | if ( !mPlayWav || mFileName.length() < 2 ) { | 278 | if ( !mPlayWav || mFileName.length() < 2 ) { |
275 | 279 | ||
276 | #ifdef DESKTOP_VERSION | 280 | #ifdef DESKTOP_VERSION |
277 | qDebug("Sound play not possible - file not found"); | 281 | qDebug("Sound play not possible - file not found"); |
278 | #else | 282 | #else |
279 | Sound::soundAlarm (); | 283 | Sound::soundAlarm (); |
280 | #endif | 284 | #endif |
281 | } else | 285 | } else |
282 | 286 | ||
283 | { | 287 | { |
284 | #ifdef DESKTOP_VERSION | 288 | #ifdef DESKTOP_VERSION |
285 | #ifdef _WIN32_ | 289 | #ifdef _WIN32_ |
286 | QSound::play ( mFileName ); | 290 | QSound::play ( mFileName ); |
287 | #else | 291 | #else |
288 | 292 | ||
289 | QString command = "playwave -r 22050 " + mFileName; | 293 | QString command = "playwave -r 22050 " + mFileName; |
290 | qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() ); | 294 | qDebug("KO: Playing file %s with 22kHz",mFileName.latin1() ); |
291 | int ret = system ( command.latin1() ); | 295 | int ret = system ( command.latin1() ); |
292 | if ( ret != 0 ) { | 296 | if ( ret != 0 ) { |
293 | qDebug("Sound play command failed: %s ",command.latin1() ); | 297 | qDebug("Sound play command failed: %s ",command.latin1() ); |
294 | } | 298 | } |
295 | 299 | ||
296 | #endif | 300 | #endif |
297 | 301 | ||
298 | #else | 302 | #else |
299 | QSound::play ( mFileName ); | 303 | QSound::play ( mFileName ); |
300 | #endif | 304 | #endif |
301 | //qDebug("BEEP!"); | 305 | //qDebug("BEEP!"); |
302 | } | 306 | } |
303 | } else { | 307 | } else { |
304 | if ( ! mSilent && mSuspendCounter > 0 ) { | 308 | if ( ! mSilent && mSuspendCounter > 0 ) { |
305 | --mSuspendCounter; | 309 | --mSuspendCounter; |
306 | reject (); | 310 | reject (); |
307 | hide(); | 311 | hide(); |
308 | return; | 312 | return; |
309 | } | 313 | } |
310 | } | 314 | } |
311 | playSoundTimer->start( mPauseCount * 1000, true ); | 315 | playSoundTimer->start( mPauseCount * 1000, true ); |
312 | } | 316 | } |