diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-03-19 09:17:18 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-03-19 15:10:33 (GMT) |
commit | 580d3d49ea3df7bb1c00cb1052203d17ccaa9a8e (patch) | |
tree | c823ef404a7a70c261248c41530827caab07fc52 /Swift/Controllers/MainController.cpp | |
parent | 5d9a6702c244eb4ab30ce96465d9deceedfe955a (diff) | |
download | swift-contrib-580d3d49ea3df7bb1c00cb1052203d17ccaa9a8e.zip swift-contrib-580d3d49ea3df7bb1c00cb1052203d17ccaa9a8e.tar.bz2 |
Start of event viewer.
Creates a basic event viewer framework, and plugs it into the Swift controllers, so that messages are displayed (in a very ugly way). Still a long way to go.
Diffstat (limited to 'Swift/Controllers/MainController.cpp')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index cbfb065..d013f5f 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -11,8 +11,10 @@ #include "Swift/Controllers/UIInterfaces/ChatWindowFactory.h" #include "Swift/Controllers/Chat/ChatsManager.h" #include "Swift/Controllers/EventController.h" +#include "Swift/Controllers/EventWindowController.h" #include "Swift/Controllers/UIInterfaces/LoginWindow.h" #include "Swift/Controllers/UIInterfaces/LoginWindowFactory.h" +#include "Swift/Controllers/UIInterfaces/EventWindowFactory.h" #include "Swift/Controllers/MainWindow.h" #include "Swift/Controllers/MainWindowFactory.h" #include "Swift/Controllers/Chat/MUCController.h" @@ -53,18 +55,20 @@ static const String CLIENT_VERSION = "0.3"; static const String CLIENT_NODE = "http://swift.im"; -MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) +MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), client_(NULL), presenceSender_(NULL), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), treeWidgetFactory_(treeWidgetFactory), settings_(settings), xmppRosterController_(NULL), rosterController_(NULL), loginWindow_(NULL), clientVersionResponder_(NULL), nickResolver_(NULL), discoResponder_(NULL) { application_ = application; presenceOracle_ = NULL; avatarManager_ = NULL; chatsManager_ = NULL; + eventController_ = NULL; + eventWindowFactory_ = eventWindowFactory; uiEventStream_ = new UIEventStream(); avatarStorage_ = new AvatarFileStorage(application_->getAvatarDir()); - eventController_ = new EventController(); eventController_->onEventQueueLengthChange.connect(boost::bind(&MainController::handleEventQueueLengthChange, this, _1)); + systemTrayController_ = new SystemTrayController(eventController_, systemTray); soundEventController_ = new SoundEventController(eventController_, soundPlayer, settings->getBoolSetting("playSounds", true)); loginWindow_ = loginWindowFactory_->createLoginWindow(uiEventStream_); @@ -89,6 +93,7 @@ MainController::~MainController() { delete avatarStorage_; delete xmlConsoleController_; delete uiEventStream_; + delete eventController_; resetClient(); } @@ -103,6 +108,8 @@ void MainController::resetClient() { nickResolver_ = NULL; delete avatarManager_; avatarManager_ = NULL; + delete eventWindowController_; + eventWindowController_ = NULL; delete rosterController_; rosterController_ = NULL; delete xmppRosterController_; @@ -126,26 +133,29 @@ void MainController::handleConnected() { xmppRoster_ = boost::shared_ptr<XMPPRoster>(new XMPPRoster()); presenceOracle_ = new PresenceOracle(client_); nickResolver_ = new NickResolver(xmppRoster_); - chatsManager_ = new ChatsManager(jid_, client_, client_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_); - lastSentPresence_ = boost::shared_ptr<Presence>(); client_->onPresenceReceived.connect(boost::bind(&MainController::handleIncomingPresence, this, _1)); + chatsManager_ = new ChatsManager(jid_, client_, client_, eventController_, chatWindowFactory_, treeWidgetFactory_, nickResolver_, presenceOracle_, serverDiscoInfo_, presenceSender_); + client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1)); + avatarManager_ = new AvatarManager(client_, client_, avatarStorage_, chatsManager_); + chatsManager_->setAvatarManager(avatarManager_); - client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1)); rosterController_ = new RosterController(jid_, xmppRoster_, avatarManager_, mainWindowFactory_, treeWidgetFactory_, nickResolver_); - rosterController_->onStartChatRequest.connect(boost::bind(&ChatsManager::handleChatRequest, chatsManager_, _1)); - rosterController_->onJoinMUCRequest.connect(boost::bind(&ChatsManager::handleJoinMUCRequest, chatsManager_, _1, _2)); rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2)); rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this)); + rosterController_->onStartChatRequest.connect(boost::bind(&ChatsManager::handleChatRequest, chatsManager_, _1)); + rosterController_->onJoinMUCRequest.connect(boost::bind(&ChatsManager::handleJoinMUCRequest, chatsManager_, _1, _2)); xmppRosterController_ = new XMPPRosterController(client_, xmppRoster_); xmppRosterController_->requestRoster(); + eventWindowController_ = new EventWindowController(eventController_, eventWindowFactory_); + clientVersionResponder_ = new SoftwareVersionResponder(CLIENT_NAME, CLIENT_VERSION, client_); loginWindow_->morphInto(rosterController_->getWindow()); |