summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-14 20:41:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-14 20:45:34 (GMT)
commitddc0ef9f5520d1e1e18e134f1a8fbdb678bbbc94 (patch)
treea2c6780381a627186c871f2aefbcc1c48ee8b0a1 /Swift
parent704d14b48f1baaa9b037787451e0239fdc7f0daa (diff)
downloadswift-contrib-ddc0ef9f5520d1e1e18e134f1a8fbdb678bbbc94.zip
swift-contrib-ddc0ef9f5520d1e1e18e134f1a8fbdb678bbbc94.tar.bz2
Added initial Growl for Windows notifier (GNTP).
The notifier doesn't handle callbacks yet. Release-Notes: Replaced Snarl notifications with Growl for Windows notifications.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp14
-rw-r--r--Swift/Controllers/MainController.h5
-rw-r--r--Swift/QtUI/QtSwift.cpp8
-rw-r--r--Swift/QtUI/QtSwift.h7
4 files changed, 18 insertions, 16 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 56ebb0c..de7009c 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -57,6 +57,7 @@
#include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h"
#include "Swift/Controllers/CertificateStorageFactory.h"
#include "Swift/Controllers/CertificateStorageTrustChecker.h"
+#include "Swiften/Network/NetworkFactories.h"
namespace Swift {
@@ -67,6 +68,7 @@ static const String SHOW_NOTIFICATIONS = "showNotifications";
MainController::MainController(
EventLoop* eventLoop,
+ NetworkFactories* networkFactories,
ChatWindowFactory* chatWindowFactory,
MainWindowFactory *mainWindowFactory,
LoginWindowFactory *loginWindowFactory,
@@ -83,8 +85,8 @@ MainController::MainController(
Notifier* notifier,
bool useDelayForLatency) :
eventLoop_(eventLoop),
- networkFactories_(eventLoop),
- idleDetector_(&idleQuerier_, networkFactories_.getTimerFactory(), 100),
+ networkFactories_(networkFactories),
+ idleDetector_(&idleQuerier_, networkFactories_->getTimerFactory(), 100),
storagesFactory_(storagesFactory),
certificateStorageFactory_(certificateStorageFactory),
chatWindowFactory_(chatWindowFactory),
@@ -234,7 +236,7 @@ void MainController::handleConnected() {
rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
- chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, chatWindowFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, chatListWindowFactory_, useDelayForLatency_, networkFactories_.getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager());
+ chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, chatWindowFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, chatListWindowFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager());
client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
chatsManager_->setAvatarManager(client_->getAvatarManager());
@@ -369,7 +371,7 @@ void MainController::performLoginFromCachedCredentials() {
storages_ = storagesFactory_->createStorages(jid_.toBare());
certificateStorage_ = certificateStorageFactory_->createCertificateStorage(jid_.toBare());
certificateTrustChecker_ = new CertificateStorageTrustChecker(certificateStorage_);
- client_ = new Swift::Client(eventLoop_, &networkFactories_, clientJID, password_, storages_);
+ client_ = new Swift::Client(eventLoop_, networkFactories_, clientJID, password_, storages_);
client_->setCertificateTrustChecker(certificateTrustChecker_);
// FIXME: Remove this line to activate the trust checker
//client_->setAlwaysTrustCertificates();
@@ -381,7 +383,7 @@ void MainController::performLoginFromCachedCredentials() {
client_->setSoftwareVersion(CLIENT_NAME, buildVersion);
client_->getVCardManager()->onVCardChanged.connect(boost::bind(&MainController::handleVCardReceived, this, _1, _2));
- presenceNotifier_ = new PresenceNotifier(client_->getStanzaChannel(), notifier_, client_->getMUCRegistry(), client_->getAvatarManager(), client_->getNickResolver(), client_->getPresenceOracle(), networkFactories_.getTimerFactory());
+ presenceNotifier_ = new PresenceNotifier(client_->getStanzaChannel(), notifier_, client_->getMUCRegistry(), client_->getAvatarManager(), client_->getNickResolver(), client_->getPresenceOracle(), networkFactories_->getTimerFactory());
presenceNotifier_->onNotificationActivated.connect(boost::bind(&MainController::handleNotificationClicked, this, _1));
eventNotifier_ = new EventNotifier(eventController_, notifier_, client_->getAvatarManager(), client_->getNickResolver());
eventNotifier_->onNotificationActivated.connect(boost::bind(&MainController::handleNotificationClicked, this, _1));
@@ -486,7 +488,7 @@ void MainController::setReconnectTimer() {
if (reconnectTimer_) {
reconnectTimer_->stop();
}
- reconnectTimer_ = networkFactories_.getTimerFactory()->createTimer(timeBeforeNextReconnect_ * 1000);
+ reconnectTimer_ = networkFactories_->getTimerFactory()->createTimer(timeBeforeNextReconnect_ * 1000);
reconnectTimer_->onTick.connect(boost::bind(&MainController::reconnectAfterError, this));
reconnectTimer_->start();
}
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 1256345..0427307 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -10,7 +10,6 @@
#include <boost/shared_ptr.hpp>
#include <vector>
-#include "Swiften/Network/BoostNetworkFactories.h"
#include "Swiften/Network/Timer.h"
#include "SwifTools/Idle/PlatformIdleQuerier.h"
#include "SwifTools/Idle/ActualIdleDetector.h"
@@ -64,11 +63,13 @@ namespace Swift {
class Dock;
class Storages;
class StoragesFactory;
+ class NetworkFactories;
class MainController {
public:
MainController(
EventLoop* eventLoop,
+ NetworkFactories* networkFactories,
ChatWindowFactory* chatWindowFactory,
MainWindowFactory *mainWindowFactory,
LoginWindowFactory *loginWindowFactory,
@@ -114,7 +115,7 @@ namespace Swift {
private:
EventLoop* eventLoop_;
- BoostNetworkFactories networkFactories_;
+ NetworkFactories* networkFactories_;
PlatformIdleQuerier idleQuerier_;
ActualIdleDetector idleDetector_;
StoragesFactory* storagesFactory_;
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 04b9d02..65eb534 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -42,7 +42,7 @@
#include "SwifTools/Notifier/GrowlNotifier.h"
#elif defined(HAVE_SNARL)
#include "QtWin32NotifierWindow.h"
-#include "SwifTools/Notifier/SnarlNotifier.h"
+#include "SwifTools/Notifier/GNTPNotifier.h"
#elif defined(SWIFTEN_PLATFORM_LINUX)
#include "FreeDesktopNotifier.h"
#else
@@ -76,7 +76,7 @@ po::options_description QtSwift::getOptionsDescription() {
}
-QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
+QtSwift::QtSwift(po::variables_map options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(NULL) {
if (options.count("netbook-mode")) {
splitter_ = new QSplitter();
} else {
@@ -109,8 +109,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
#if defined(HAVE_GROWL)
notifier_ = new GrowlNotifier(SWIFT_APPLICATION_NAME);
#elif defined(HAVE_SNARL)
- notifierWindow_ = new QtWin32NotifierWindow();
- notifier_ = new SnarlNotifier(SWIFT_APPLICATION_NAME, notifierWindow_, applicationPathProvider_->getResourcePath("/images/logo-icon-32.png"));
+ notifier_ = new GNTPNotifier(SWIFT_APPLICATION_NAME, applicationPathProvider_->getResourcePath("/images/logo-icon-128.png"), networkFactories_.getConnectionFactory());
#elif defined(SWIFTEN_PLATFORM_LINUX)
notifier_ = new FreeDesktopNotifier(SWIFT_APPLICATION_NAME);
#else
@@ -144,6 +143,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
mucSearchWindowFactories_.push_back(mucSearchWindowFactory);
MainController* mainController = new MainController(
&clientMainThreadCaller_,
+ &networkFactories_,
chatWindowFactory_,
rosterWindowFactory,
loginWindowFactory,
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index a41e2d1..68933dd 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -10,6 +10,7 @@
#include <boost/program_options/options_description.hpp>
#include <Swiften/TLS/PlatformTLSFactories.h>
+#include <Swiften/Network/BoostNetworkFactories.h>
#include "Swiften/Base/String.h"
#include "Swiften/Base/Platform.h"
#include "Swiften/EventLoop/Qt/QtEventLoop.h"
@@ -56,7 +57,9 @@ namespace Swift {
static po::options_description getOptionsDescription();
~QtSwift();
private:
+ QtEventLoop clientMainThreadCaller_;
PlatformTLSFactories tlsFactories_;
+ BoostNetworkFactories networkFactories_;
std::vector<MainController*> mainControllers_;
QtChatWindowFactory *chatWindowFactory_;
std::vector<QtMainWindowFactory*> rosterWindowFactories_;
@@ -66,7 +69,6 @@ namespace Swift {
std::vector<QtSystemTray*> systemTrays_;
std::vector<QtChatListWindowFactory*> chatListWindowFactories_;
std::vector<QtMUCSearchWindowFactory*> mucSearchWindowFactories_;
- QtEventLoop clientMainThreadCaller_;
QtSettingsProvider *settings_;
QSplitter* splitter_;
QtSoundPlayer* soundPlayer_;
@@ -80,8 +82,5 @@ namespace Swift {
#if defined(SWIFTEN_PLATFORM_MACOSX)
CocoaApplication cocoaApplication_;
#endif
-#if defined(HAVE_SNARL)
- Win32NotifierWindow* notifierWindow_;
-#endif
};
}