blob: 0aaacdf25fe716d16eec5a73e383e3a6c68f2003 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/*
* Copyright (c) 2011 Vlad Voicu
* Licensed under the Simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include <Swift/Controllers/ViewHistoryController.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <Swift/Controllers/UIEvents/RequestViewHistoryUIEvent.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/Controllers/UIInterfaces/ViewHistoryWindowFactory.h>
#include <Swift/Controllers/Roster/RosterController.h>
namespace Swift {
ViewHistoryController::ViewHistoryController(RosterController* rosterController, ViewHistoryWindowFactory* viewHistoryWindowFactory, UIEventStream* uiEventStream): rosterController(rosterController), viewHistoryWindowFactory(viewHistoryWindowFactory), uiEventStream(uiEventStream), viewHistoryWindow(NULL) {
uiEventStream->onUIEvent.connect(boost::bind(&ViewHistoryController::handleUIEvent, this, _1));
}
ViewHistoryController::~ViewHistoryController() {
}
void ViewHistoryController::handleUIEvent(UIEvent::ref event) {
RequestViewHistoryUIEvent::ref viewHistoryEvent = boost::dynamic_pointer_cast<RequestViewHistoryUIEvent>(event);
if (!viewHistoryWindow) {
viewHistoryWindow = viewHistoryWindowFactory->createViewHistoryWindow();
}
}
void ViewHistoryController::setAvailable(bool b) {
if (viewHistoryWindow) {
viewHistoryWindow->setEnabled(b);
}
}
}
|