summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/Makefile.inc2
-rw-r--r--Swift/QtUI/QtSoundPlayer.cpp29
-rw-r--r--Swift/QtUI/QtSoundPlayer.h21
-rw-r--r--Swift/QtUI/QtSwift.cpp5
-rw-r--r--Swift/QtUI/QtSwift.h2
-rw-r--r--Swift/QtUI/Swift.pro10
-rw-r--r--Swift/QtUI/Swift.qrc13
7 files changed, 70 insertions, 12 deletions
diff --git a/Swift/QtUI/Makefile.inc b/Swift/QtUI/Makefile.inc
index 8b0ab30..3ec32d7 100644
--- a/Swift/QtUI/Makefile.inc
+++ b/Swift/QtUI/Makefile.inc
@@ -25,4 +25,4 @@ Swift/QtUI/Swiften.pri:
cd Swift/QtUI && ./qmakeish.py ../../Makefile > Swiften.pri
Swift/QtUI/DefaultTheme.qrc:
- cd Swift/QtUI && ../../tools/ThemeQRC.py ../../resources/themes/Default > DefaultTheme.qrc
+ cd Swift/QtUI && ../../tools/ThemeQRC.py ../resources/themes/Default > DefaultTheme.qrc
diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp
new file mode 100644
index 0000000..937d077
--- /dev/null
+++ b/Swift/QtUI/QtSoundPlayer.cpp
@@ -0,0 +1,29 @@
+#include "QtSoundPlayer.h"
+
+#include <phonon/MediaObject>
+#include <phonon/AudioOutput>
+
+namespace Swift{
+
+QtSoundPlayer::QtSoundPlayer() {
+ audioOutput_ = new Phonon::AudioOutput(Phonon::NotificationCategory);
+
+ messageReceived_ = new Phonon::MediaObject();
+ messageReceived_->setCurrentSource(Phonon::MediaSource(":/sounds/messageReceived.wav"));
+ Phonon::Path path = Phonon::createPath(messageReceived_, audioOutput_);
+}
+
+QtSoundPlayer::~QtSoundPlayer() {
+ delete messageReceived_;
+ delete audioOutput_;
+}
+
+void QtSoundPlayer::playSound(SoundEffect sound) {
+ switch (sound) {
+ case MessageReceived:
+ messageReceived_->play();
+ break;
+ }
+}
+
+} \ No newline at end of file
diff --git a/Swift/QtUI/QtSoundPlayer.h b/Swift/QtUI/QtSoundPlayer.h
new file mode 100644
index 0000000..e0ccf18
--- /dev/null
+++ b/Swift/QtUI/QtSoundPlayer.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "Swift/Controllers/SoundPlayer.h"
+
+
+namespace Phonon {
+ class AudioOutput;
+ class MediaObject;
+}
+
+namespace Swift {
+ class QtSoundPlayer : public SoundPlayer{
+ public:
+ QtSoundPlayer();
+ ~QtSoundPlayer();
+ void playSound(SoundEffect sound);
+ private:
+ Phonon::AudioOutput* audioOutput_;
+ Phonon::MediaObject* messageReceived_;
+ };
+}
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index caa3624..e1fac9c 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -5,6 +5,7 @@
#include "QtMainWindowFactory.h"
#include "QtTreeWidgetFactory.h"
#include "QtSystemTray.h"
+#include "QtSoundPlayer.h"
#include <boost/bind.hpp>
#include <QSplitter>
@@ -30,6 +31,7 @@ QtSwift::QtSwift(bool netbookMode) {
rosterWindowFactory_ = new QtMainWindowFactory(treeWidgetFactory_);
chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter_);
systemTray_ = new QtSystemTray();
+ soundPlayer_ = new QtSoundPlayer();
QCoreApplication::setApplicationName("Swift");
QCoreApplication::setOrganizationName("Swift");
QCoreApplication::setOrganizationDomain("swift.im");
@@ -38,7 +40,7 @@ QtSwift::QtSwift(bool netbookMode) {
if (splitter_) {
splitter_->show();
}
- mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_);
+ mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_, soundPlayer_);
}
QtSwift::~QtSwift() {
@@ -51,6 +53,7 @@ QtSwift::~QtSwift() {
delete application_;
delete systemTray_;
delete splitter_;
+ delete soundPlayer_;
}
}
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index a9b8efb..223316e 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -18,6 +18,7 @@ namespace Swift {
class QtLoginWindowFactory;
class QtTreeWidgetFactory;
class QtSystemTray;
+ class QtSoundPlayer;
class QtSwift : public QObject {
Q_OBJECT
@@ -34,6 +35,7 @@ namespace Swift {
QtSettingsProvider *settings_;
QtSystemTray* systemTray_;
QSplitter* splitter_;
+ QtSoundPlayer* soundPlayer_;
Application* application_;
};
}
diff --git a/Swift/QtUI/Swift.pro b/Swift/QtUI/Swift.pro
index e9579d6..5b9ea72 100644
--- a/Swift/QtUI/Swift.pro
+++ b/Swift/QtUI/Swift.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
-QT += webkit
+QT += webkit phonon
CONFIG += debug
unix:!mac {
TARGET = swift
@@ -34,10 +34,10 @@ win32 {
# Resources
win32 {
- RC_FILE = ../../resources/Windows/Swift.rc
+ RC_FILE = ../resources/Windows/Swift.rc
}
mac {
- ICON = ../../resources/MacOSX/Swift.icns
+ ICON = ../resources/MacOSX/Swift.icns
}
DEFINES += BOOST_SIGNALS_NAMESPACE=bsignals BOOST_ALL_NO_LIB
@@ -59,6 +59,7 @@ HEADERS += \
QtTreeWidgetItem.h \
QtChatView.h \
QtChatTabs.h \
+ QtSoundPlayer.h \
QtSystemTray.h \
QtTabbable.h \
ChatSnippet.h \
@@ -80,6 +81,7 @@ SOURCES += \
QtTreeWidget.cpp \
QtChatView.cpp \
QtChatTabs.cpp \
+ QtSoundPlayer.cpp \
QtSystemTray.cpp \
ChatSnippet.cpp \
MessageSnippet.cpp \
@@ -91,6 +93,6 @@ RESOURCES += Swift.qrc DefaultTheme.qrc
win32 {
DefaultThemeQRC.target = DefaultTheme.qrc
- DefaultThemeQRC.commands = ..\..\tools\ThemeQRC.py ../../resources/themes/Default > DefaultTheme.qrc
+ DefaultThemeQRC.commands = ..\..\tools\ThemeQRC.py ../resources/themes/Default > DefaultTheme.qrc
QMAKE_EXTRA_TARGETS = DefaultThemeQRC
}
diff --git a/Swift/QtUI/Swift.qrc b/Swift/QtUI/Swift.qrc
index 4e3b9df..11794af 100644
--- a/Swift/QtUI/Swift.qrc
+++ b/Swift/QtUI/Swift.qrc
@@ -1,11 +1,12 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
- <file alias="logo-shaded-text.256.png">../../resources/logo/logo-shaded-text.256.png</file>
- <file alias="icons/certificate.png">../../resources/icons/certificate.png</file>
- <file alias="icons/error.png">../../resources/icons/error.png</file>
- <file alias="icons/avatar.png">../../resources/icons/avatar.png</file>
- <file alias="icons/tray-standard.png">../../resources/icons/tray-standard.png</file>
- <file alias="icons/new-chat.png">../../resources/icons/new-chat.png</file>
+ <file alias="logo-shaded-text.256.png">../resources/logo/logo-shaded-text.256.png</file>
+ <file alias="icons/certificate.png">../resources/icons/certificate.png</file>
+ <file alias="icons/error.png">../resources/icons/error.png</file>
+ <file alias="icons/avatar.png">../resources/icons/avatar.png</file>
+ <file alias="icons/tray-standard.png">../resources/icons/tray-standard.png</file>
+ <file alias="icons/new-chat.png">../resources/icons/new-chat.png</file>
+ <file alias="sounds/message-received.wav">../resources/sounds/message-received.wav</file>
</qresource>
</RCC>