diff options
Diffstat (limited to 'Swift/Controllers/HistoryController.cpp')
-rw-r--r-- | Swift/Controllers/HistoryController.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp new file mode 100644 index 0000000..2aa1b6e --- /dev/null +++ b/Swift/Controllers/HistoryController.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2012 Catalin Badea + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swift/Controllers/HistoryController.h" + +#include "Swift/Controllers/UIInterfaces/HistoryWindowFactory.h" +#include "Swift/Controllers/UIEvents/RequestHistoryUIEvent.h" + +namespace Swift { + +HistoryController::HistoryController(UIEventStream* uiEventStream, HistoryWindowFactory* historyWindowFactory) : historyWindowFactory_(historyWindowFactory), historyWindow_(NULL) { + uiEventStream->onUIEvent.connect(boost::bind(&HistoryController::handleUIEvent, this, _1)); +} + +HistoryController::~HistoryController() { + delete historyWindow_; +} + +void HistoryController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { + boost::shared_ptr<RequestHistoryUIEvent> event = boost::dynamic_pointer_cast<RequestHistoryUIEvent>(rawEvent); + if (event != NULL) { + if (historyWindow_ == NULL) { + historyWindow_ = historyWindowFactory_->createHistoryWindow(); + } + historyWindow_->show(); + historyWindow_->activate(); + } +} + +} |