From 8149107ade43f9c9fff8fe134f1bce5b5e8b2234 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Fri, 20 Nov 2009 19:27:23 +0100
Subject: Use QSound for sounds.


diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp
index 4aa6b8e..246509e 100644
--- a/Swift/QtUI/QtSoundPlayer.cpp
+++ b/Swift/QtUI/QtSoundPlayer.cpp
@@ -1,40 +1,18 @@
 #include "QtSoundPlayer.h"
 
-#ifdef Q_WS_X11
-#include "mediaobject.h"
-#include "audiooutput.h"
-#else
-#include <phonon/MediaObject>
-#include <phonon/AudioOutput>
-#endif
+#include <QSound>
 
-namespace Swift{
+namespace Swift {
 	
 QtSoundPlayer::QtSoundPlayer() {
-	audioOutput_ = new Phonon::AudioOutput(Phonon::NotificationCategory);
-	
-	messageReceived_ = new Phonon::MediaObject();
-	messageReceived_->setCurrentSource(Phonon::MediaSource(":/sounds/message-received.wav"));
-	Phonon::createPath(messageReceived_, audioOutput_);
-	connect(messageReceived_, SIGNAL(finished()), this, SLOT(handleFinished()));
 }
 
-QtSoundPlayer::~QtSoundPlayer() {
-	delete messageReceived_;
-	delete audioOutput_;
-}
-	
 void QtSoundPlayer::playSound(SoundEffect sound) {
 	switch (sound) {
 		case MessageReceived: 
-			//messageReceived_->stop();
-			messageReceived_->play();
+			QSound::play(":/sounds/message-received.wav");
 			break;
 	}
 }
 
-void QtSoundPlayer::handleFinished() {
-	messageReceived_->stop();
-}
-
 }
diff --git a/Swift/QtUI/QtSoundPlayer.h b/Swift/QtUI/QtSoundPlayer.h
index b9109a7..a75f042 100644
--- a/Swift/QtUI/QtSoundPlayer.h
+++ b/Swift/QtUI/QtSoundPlayer.h
@@ -4,22 +4,12 @@
 
 #include <QObject>
 
-namespace Phonon {
-	class AudioOutput;
-	class MediaObject;
-}
-
 namespace Swift {
 	class QtSoundPlayer : public QObject, public SoundPlayer {
-		Q_OBJECT
+			Q_OBJECT
 		public:
 			QtSoundPlayer();
-			~QtSoundPlayer();
+
 			void playSound(SoundEffect sound);
-		private:
-			Phonon::AudioOutput* audioOutput_;
-			Phonon::MediaObject* messageReceived_;
-		private slots:
-			void handleFinished();
 	};
 }
-- 
cgit v0.10.2-6-g49f6