diff options
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; +	} +} +  }  | 
 Swift