diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-06-18 20:34:41 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-06-18 20:35:22 (GMT) |
commit | 9a457c621bd75a9929cc0616b7659dba2945fdac (patch) | |
tree | fa1b7e541355edb1983dea78728892ddf89f08ff /Swift/Controllers | |
parent | 38e83db22eed41e115c1483323a62c62be34dbec (diff) | |
download | swift-contrib-9a457c621bd75a9929cc0616b7659dba2945fdac.zip swift-contrib-9a457c621bd75a9929cc0616b7659dba2945fdac.tar.bz2 |
System Tray
We need to have a look at the icons somewhat, but these will do for the second.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 6 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 5 | ||||
-rw-r--r-- | Swift/Controllers/Makefile.inc | 3 | ||||
-rw-r--r-- | Swift/Controllers/SystemTray.h | 9 | ||||
-rw-r--r-- | Swift/Controllers/SystemTrayController.cpp | 21 | ||||
-rw-r--r-- | Swift/Controllers/SystemTrayController.h | 14 |
6 files changed, 55 insertions, 3 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index ff53450..e9177f8 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -17,6 +17,8 @@ #include "Swift/Controllers/MUCController.h" #include "Swift/Controllers/NickResolver.h" #include "Swift/Controllers/RosterController.h" +#include "Swift/Controllers/SystemTray.h" +#include "Swift/Controllers/SystemTrayController.h" #include "Swift/Controllers/XMPPRosterController.h" #include "Swiften/Base/foreach.h" #include "Swiften/Base/String.h" @@ -40,13 +42,14 @@ static const String CLIENT_NODE = "http://swift.im"; typedef std::pair<JID, ChatController*> JIDChatControllerPair; typedef std::pair<JID, MUCController*> JIDMUCControllerPair; -MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application) +MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray) : client_(NULL), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), treeWidgetFactory_(treeWidgetFactory), settings_(settings), xmppRosterController_(NULL), rosterController_(NULL), loginWindow_(NULL), clientVersionResponder_(NULL), nickResolver_(NULL), discoResponder_(NULL), serverDiscoInfo_(new DiscoInfo()), presenceOracle_(NULL) { application_ = application; eventController_ = new EventController(); eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1)); + systemTrayController_ = new SystemTrayController(eventController_, systemTray); loginWindow_ = loginWindowFactory_->createLoginWindow(settings->getStringSetting("jid"), settings->getStringSetting("pass"), settings->getStringSetting("certificate")); loginWindow_->onLoginRequest.connect(boost::bind(&MainController::handleLoginRequest, this, _1, _2, _3, _4)); } @@ -65,6 +68,7 @@ MainController::~MainController() { delete presenceOracle_; delete nickResolver_; delete client_; + delete systemTrayController_; } void MainController::handleConnected() { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index e09d4fa..8b3a702 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -37,10 +37,12 @@ namespace Swift { class TreeWidgetFactory; class MUCController; class PresenceOracle; + class SystemTray; + class SystemTrayController; class MainController { public: - MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory* treeWidgetFactory, SettingsProvider *settings, Application* application); + MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory* treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray); ~MainController(); @@ -79,6 +81,7 @@ namespace Swift { std::map<JID, ChatController*> chatControllers_; boost::shared_ptr<DiscoInfo> serverDiscoInfo_; PresenceOracle* presenceOracle_; + SystemTrayController* systemTrayController_; }; } #endif diff --git a/Swift/Controllers/Makefile.inc b/Swift/Controllers/Makefile.inc index ff3192e..1a6ab4e 100644 --- a/Swift/Controllers/Makefile.inc +++ b/Swift/Controllers/Makefile.inc @@ -6,7 +6,8 @@ SWIFT_CONTROLLERS_SOURCES += \ Swift/Controllers/RosterController.cpp \ Swift/Controllers/XMPPRosterController.cpp \ Swift/Controllers/MUCController.cpp \ - Swift/Controllers/EventController.cpp + Swift/Controllers/EventController.cpp \ + Swift/Controllers/SystemTrayController.cpp include Swift/Controllers/UnitTest/Makefile.inc diff --git a/Swift/Controllers/SystemTray.h b/Swift/Controllers/SystemTray.h new file mode 100644 index 0000000..89ae614 --- /dev/null +++ b/Swift/Controllers/SystemTray.h @@ -0,0 +1,9 @@ +#pragma once + +namespace Swift { + class SystemTray { + public: + virtual ~SystemTray(){}; + virtual void setUnreadMessages(bool some) = 0; + }; +} diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp new file mode 100644 index 0000000..8caf79a --- /dev/null +++ b/Swift/Controllers/SystemTrayController.cpp @@ -0,0 +1,21 @@ +#include "Swift/Controllers/SystemTrayController.h" + +#include <boost/bind.hpp> + +#include "Swift/Controllers/EventController.h" +#include "Swift/Controllers/SystemTray.h" + +namespace Swift { + +SystemTrayController::SystemTrayController(EventController* eventController, SystemTray* systemTray) { + eventController_ = eventController; + systemTray_ = systemTray; + eventController_->onEventQueueLengthChange.connect(boost::bind(&SystemTrayController::handleEventQueueLengthChange, this, _1)); +} + +void SystemTrayController::handleEventQueueLengthChange(int length) { + systemTray_->setUnreadMessages(length > 0 ? true : false); +} + + +} diff --git a/Swift/Controllers/SystemTrayController.h b/Swift/Controllers/SystemTrayController.h new file mode 100644 index 0000000..1c6d270 --- /dev/null +++ b/Swift/Controllers/SystemTrayController.h @@ -0,0 +1,14 @@ +#pragma once + +namespace Swift { + class EventController; + class SystemTray; + class SystemTrayController { + public: + SystemTrayController(EventController* eventController, SystemTray* systemTray); + private: + void handleEventQueueLengthChange(int length); + EventController* eventController_; + SystemTray* systemTray_; + }; +} |