diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-20 17:14:02 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-20 18:25:17 (GMT) |
commit | b3dc968b7c424351bac87bfed42681bd0500d86c (patch) | |
tree | 1f3ec7ee8f8b3e9d3e274ba77684b8606dc96377 /Swift/QtUI/QtSoundPlayer.cpp | |
parent | 5fa4903a7c1c7a7733afdd1d6c4c5dcccec97b19 (diff) | |
download | swift-contrib-b3dc968b7c424351bac87bfed42681bd0500d86c.zip swift-contrib-b3dc968b7c424351bac87bfed42681bd0500d86c.tar.bz2 |
Don't bundle sounds.
Diffstat (limited to 'Swift/QtUI/QtSoundPlayer.cpp')
-rw-r--r-- | Swift/QtUI/QtSoundPlayer.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp index 94d2ea5..7fd6564 100644 --- a/Swift/QtUI/QtSoundPlayer.cpp +++ b/Swift/QtUI/QtSoundPlayer.cpp @@ -7,18 +7,31 @@ #include "QtSoundPlayer.h" #include <QSound> +#include <iostream> + +#include "Swiften/Application/ApplicationPathProvider.h" namespace Swift { -QtSoundPlayer::QtSoundPlayer() { +QtSoundPlayer::QtSoundPlayer(ApplicationPathProvider* applicationPathProvider) : applicationPathProvider(applicationPathProvider) { } void QtSoundPlayer::playSound(SoundEffect sound) { switch (sound) { - case MessageReceived: - QSound::play(":/sounds/message-received.wav"); + case MessageReceived: + playSound("/sounds/message-received.wav"); break; } } +void QtSoundPlayer::playSound(const String& soundResource) { + boost::filesystem::path resourcePath = applicationPathProvider->getResourcePath(soundResource); + if (boost::filesystem::exists(resourcePath)) { + QSound::play(resourcePath.string().c_str()); + } + else { + std::cerr << "Unable to find sound: " << soundResource << std::endl; + } +} + } |