summaryrefslogtreecommitdiffstats
path: root/pica-client/sound.cpp
diff options
context:
space:
mode:
authorme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2014-08-09 18:42:42 +0000
committerme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2014-08-09 18:42:42 +0000
commit55e8fd1fa6e0d67ca5df68e4ea630c53677023e0 (patch)
treeb7a72b0b73feaed6a44d71594b3dd85d8a13f560 /pica-client/sound.cpp
parentb94a048ee50d89e0a7a06eade5772dd4d2707d37 (diff)
downloadpica-pica-55e8fd1fa6e0d67ca5df68e4ea630c53677023e0.tar.gz
pica-pica-55e8fd1fa6e0d67ca5df68e4ea630c53677023e0.zip
playing sound on new message arrival - added wav file, new class Sound, menu item in systray menu for muting
git-svn-id: svn://localhost/project_picapica/trunk@318 fb96df88-216d-11de-830c-f3023f12d8ac
Diffstat (limited to 'pica-client/sound.cpp')
-rw-r--r--pica-client/sound.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/pica-client/sound.cpp b/pica-client/sound.cpp
new file mode 100644
index 0000000..0caff3e
--- /dev/null
+++ b/pica-client/sound.cpp
@@ -0,0 +1,37 @@
+#include "sound.h"
+
+#ifndef WIN32
+
+#include <QProcess>
+
+#else
+
+//link with winmm.lib
+#include <Mmsystem.h>
+#include <windows.h>
+
+#endif
+
+
+bool Sound::is_muted = false;
+
+Sound::Sound()
+{
+}
+
+void Sound::mute(bool yes)
+{
+ is_muted = yes;
+}
+
+void Sound::play(const QString sndfile)
+{
+ if (is_muted)
+ return;
+
+#ifndef WIN32
+ QProcess::execute("aplay -q " + sndfile);
+#else
+ sndPlaySound(sndfile.toAscii().constData(), SND_ASYNC | SND_NODEFAULT);
+#endif
+}