summaryrefslogtreecommitdiff
path: root/library/sound.cpp
Unidiff
Diffstat (limited to 'library/sound.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/sound.cpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/library/sound.cpp b/library/sound.cpp
index 373fd4c..602fcf0 100644
--- a/library/sound.cpp
+++ b/library/sound.cpp
@@ -27,2 +27,9 @@
27 27
28#include <unistd.h>
29#include <fcntl.h>
30#include <sys/ioctl.h>
31#include <sys/soundcard.h>
32
33#include "config.h"
34#include <qmessagebox.h>
28#ifndef QT_NO_SOUND 35#ifndef QT_NO_SOUND
@@ -101,7 +108,9 @@ public:
101 { 108 {
109 loopsleft=0;
102 } 110 }
103 111
104 void playLoop() 112 void playLoop(int loopcnt = -1)
105 { 113 {
106 // needs server support 114 // needs server support
115 loopsleft = loopcnt;
107 116
@@ -113,6 +122,16 @@ public:
113 122
114 void timerEvent(QTimerEvent*) 123 void timerEvent ( QTimerEvent *e )
115 { 124 {
125 if (loopsleft >= 0) {
126 if (--loopsleft <= 0)
127 killTimer (e->timerId());
128 return;
129 }
116 play(); 130 play();
117 } 131 }
132
133 bool isFinished ( ) const
134 {
135 return ( loopsleft == 0 );
136 }
118 137
@@ -120,2 +139,3 @@ private:
120 QString filename; 139 QString filename;
140 int loopsleft;
121}; 141};
@@ -141,3 +161,3 @@ void Sound::play()
141 d->killTimers(); 161 d->killTimers();
142 d->play(); 162 d->playLoop(1);
143#endif 163#endif
@@ -160,2 +180,8 @@ void Sound::stop()
160 180
181bool Sound::isFinished() const
182{
183#ifndef QT_NO_SOUND
184 return d->isFinished();
185#endif
186}
161 187
@@ -163,10 +189,4 @@ void Sound::soundAlarm()
163{ 189{
164#ifdef QT_QWS_CUSTOM 190#ifndef QT_NO_COP
165# ifndef QT_NO_COP
166 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); 191 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
167# endif
168#else
169# ifndef QT_NO_SOUND
170 QSound::play(Resource::findSound("alarm"));
171# endif
172#endif 192#endif