summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Niedzielski <machekku@uaznia.net>2012-12-21 19:58:24 (GMT)
committerMaciej Niedzielski <machekku@uaznia.net>2013-01-09 12:34:06 (GMT)
commit4ed137080a3d80d20a2cead47f741e3dd2f2d42e (patch)
treef030f0d9b8e61733de4e2bec9cef7715d380af8f /Swift/QtUI/QtSoundPlayer.cpp
parenta8e2d82a1be5e94ac39523fc3e0606fcc261e913 (diff)
downloadswift-4ed137080a3d80d20a2cead47f741e3dd2f2d42e.zip
swift-4ed137080a3d80d20a2cead47f741e3dd2f2d42e.tar.bz2
Highlighting support
Change-Id: Ib6bd42cecff018998117bc1e7db279a62b3af434 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/QtUI/QtSoundPlayer.cpp')
-rw-r--r--Swift/QtUI/QtSoundPlayer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp
index 387c6f3..63f76f0 100644
--- a/Swift/QtUI/QtSoundPlayer.cpp
+++ b/Swift/QtUI/QtSoundPlayer.cpp
@@ -16,10 +16,11 @@ namespace Swift {
QtSoundPlayer::QtSoundPlayer(ApplicationPathProvider* applicationPathProvider) : applicationPathProvider(applicationPathProvider) {
}
-void QtSoundPlayer::playSound(SoundEffect sound) {
+void QtSoundPlayer::playSound(SoundEffect sound, const std::string& soundResource) {
+
switch (sound) {
case MessageReceived:
- playSound("/sounds/message-received.wav");
+ playSound(soundResource.empty() ? "/sounds/message-received.wav" : soundResource);
break;
}
}
@@ -29,6 +30,9 @@ void QtSoundPlayer::playSound(const std::string& soundResource) {
if (boost::filesystem::exists(resourcePath)) {
QSound::play(resourcePath.string().c_str());
}
+ else if (boost::filesystem::exists(soundResource)) {
+ QSound::play(soundResource.c_str());
+ }
else {
std::cerr << "Unable to find sound: " << soundResource << std::endl;
}