diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-05 13:49:26 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-05 13:49:26 (GMT) |
commit | 21e358a55e6eee1036fe95993c5715382d08c0c8 (patch) | |
tree | c512cb0b6640c1fee942cf55fa76954a8100568c /Swift/Controllers/WhiteboardManager.cpp | |
parent | dfeab948530982d10a7754a93a37cd8422888378 (diff) | |
download | swift-contrib-21e358a55e6eee1036fe95993c5715382d08c0c8.zip swift-contrib-21e358a55e6eee1036fe95993c5715382d08c0c8.tar.bz2 |
Moved whiteboard handling to WhiteboardManager
Diffstat (limited to 'Swift/Controllers/WhiteboardManager.cpp')
-rw-r--r-- | Swift/Controllers/WhiteboardManager.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp new file mode 100644 index 0000000..3a87387 --- /dev/null +++ b/Swift/Controllers/WhiteboardManager.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include <Swift/Controllers/WhiteboardManager.h> + +#include <boost/bind.hpp> + +#include <Swift/Controllers/UIEvents/RequestWhiteboardUIEvent.h> +#include <Swiften/Client/StanzaChannel.h> + +namespace Swift { + WhiteboardManager::WhiteboardManager(WhiteboardWindowFactory* whiteboardWindowFactory, UIEventStream* uiEventStream, StanzaChannel* stanzaChannel) : whiteboardWindowFactory_(whiteboardWindowFactory), uiEventStream_(uiEventStream), stanzaChannel_(stanzaChannel) { + uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&WhiteboardManager::handleUIEvent, this, _1)); + } + + WhiteboardManager::~WhiteboardManager() { + } + + void WhiteboardManager::handleUIEvent(boost::shared_ptr<UIEvent> event) { + boost::shared_ptr<RequestWhiteboardUIEvent> whiteboardEvent = boost::dynamic_pointer_cast<RequestWhiteboardUIEvent>(event); + if(whiteboardEvent) { + WhiteboardWindow* window = whiteboardWindowFactory_->createWhiteboardWindow(stanzaChannel_, whiteboardEvent->getContact()); + window->show(); + } + } +} |