summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/PresenceNotifier.cpp2
-rw-r--r--Swift/Controllers/UnitTest/PresenceNotifierTest.cpp2
-rw-r--r--Swift/QtUI/QtSwift.cpp7
-rw-r--r--Swift/QtUI/QtSwift.h6
-rw-r--r--Swift/QtUI/QtWin32NotifierWindow.h29
-rw-r--r--Swift/QtUI/SConscript3
6 files changed, 47 insertions, 2 deletions
diff --git a/Swift/Controllers/PresenceNotifier.cpp b/Swift/Controllers/PresenceNotifier.cpp
index ce7ae40..0c46f9b 100644
--- a/Swift/Controllers/PresenceNotifier.cpp
+++ b/Swift/Controllers/PresenceNotifier.cpp
@@ -90,7 +90,7 @@ void PresenceNotifier::showNotification(const JID& jid, Notifier::Type type) {
}
String title = name + " (" + getStatusType(jid) + ")";
String message = getStatusMessage(jid);
- notifier->showMessage(type, title, message, avatarManager->getAvatar(jid), boost::bind(&PresenceNotifier::handleNotificationActivated, this, jid));
+ notifier->showMessage(type, title, message, avatarManager->getAvatarPath(jid), boost::bind(&PresenceNotifier::handleNotificationActivated, this, jid));
}
void PresenceNotifier::handleNotificationActivated(JID jid) {
diff --git a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp
index 85433f3..a410665 100644
--- a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp
+++ b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp
@@ -145,7 +145,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture {
sendPresence(user1, StatusShow::Online);
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size()));
- CPPUNIT_ASSERT_EQUAL(ByteArray("abcdef"), notifier->notifications[0].picture);
+ CPPUNIT_ASSERT_EQUAL(boost::filesystem::path("/avatars/user1@bar.com/bla"), notifier->notifications[0].picture);
}
void testNotificationActivationEmitsSignal() {
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index ee97fc6..0118416 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -38,6 +38,9 @@
#include "SwifTools/AutoUpdater/PlatformAutoUpdaterFactory.h"
#if defined(HAVE_GROWL)
#include "SwifTools/Notifier/GrowlNotifier.h"
+#elif defined(HAVE_SNARL)
+#include "QtWin32NotifierWindow.h"
+#include "SwifTools/Notifier/SnarlNotifier.h"
#else
#include "SwifTools/Notifier/NullNotifier.h"
#endif
@@ -97,6 +100,9 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
soundPlayer_ = new QtSoundPlayer(applicationPathProvider_);
#if defined(HAVE_GROWL)
notifier_ = new GrowlNotifier(SWIFT_APPLICATION_NAME);
+#elif defined(HAVE_SNARL)
+ notifierWindow_ = new QtWin32NotifierWindow();
+ notifier_ = new SnarlNotifier(SWIFT_APPLICATION_NAME, notifierWindow_);
#else
notifier_ = new NullNotifier();
#endif
@@ -155,6 +161,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
}
QtSwift::~QtSwift() {
+ delete notifier_;
delete autoUpdater_;
delete chatWindowFactory_;
foreach (QtMainWindowFactory* factory, rosterWindowFactories_) {
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index abc8c75..092c45e 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -20,6 +20,9 @@
#if defined(SWIFTEN_PLATFORM_MACOSX)
#include "Swiften/Application/CocoaApplication.h"
#endif
+#if defined(HAVE_SNARL)
+#include "SwifTools/Notifier/Win32NotifierWindow.h"
+#endif
namespace po = boost::program_options;
@@ -75,6 +78,9 @@ namespace Swift {
#if defined(SWIFTEN_PLATFORM_MACOSX)
CocoaApplication cocoaApplication_;
#endif
+#if defined(HAVE_SNARL)
+ Win32NotifierWindow* notifierWindow_;
+#endif
};
}
diff --git a/Swift/QtUI/QtWin32NotifierWindow.h b/Swift/QtUI/QtWin32NotifierWindow.h
new file mode 100644
index 0000000..b8d9c77
--- /dev/null
+++ b/Swift/QtUI/QtWin32NotifierWindow.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <QWidget>
+
+#include "SwifTools/Notifier/Win32NotifierWindow.h"
+
+namespace Swift {
+ class QtWin32NotifierWindow : public QWidget, public Win32NotifierWindow {
+ public:
+ QtWin32NotifierWindow(QWidget* parent = NULL) {
+ setVisible(false);
+ }
+
+ bool winEvent (MSG* message, long* result ) {
+ onMessageReceived(message);
+ return false;
+ }
+
+ virtual HWND getID() const {
+ return winId();
+ }
+ };
+}
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 634207c..933133d 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -38,6 +38,9 @@ myenv.MergeFlags(env.get("EXPAT_FLAGS", ""))
if myenv.get("HAVE_GROWL", False) :
myenv.MergeFlags(myenv["GROWL_FLAGS"])
myenv.Append(CPPDEFINES = ["HAVE_GROWL"])
+if myenv.get("HAVE_SNARL", False) :
+ myenv.MergeFlags(myenv["SNARL_FLAGS"])
+ myenv.Append(CPPDEFINES = ["HAVE_SNARL"])
myenv.MergeFlags(myenv["PLATFORM_FLAGS"])
myenv.Tool("qt4", toolpath = ["#/BuildTools/SCons/Tools"])