diff options
| author | Catalin Badea <catalin.badea392@gmail.com> | 2012-05-24 16:29:25 (GMT) | 
|---|---|---|
| committer | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-11 15:45:27 (GMT) | 
| commit | c09901d69a0b606d8f16a3496c0c4f24c3c7aa1b (patch) | |
| tree | dc6b472d914413b372a6cefdab4cef2eae25aafb /Swift/Controllers | |
| parent | f799cce739f89225258dfbd2e0099e8a71d99af4 (diff) | |
| download | swift-contrib-c09901d69a0b606d8f16a3496c0c4f24c3c7aa1b.zip swift-contrib-c09901d69a0b606d8f16a3496c0c4f24c3c7aa1b.tar.bz2  | |
Added History window based code: controller, events, interface and menu entry.
Diffstat (limited to 'Swift/Controllers')
| -rw-r--r-- | Swift/Controllers/HistoryController.cpp | 33 | ||||
| -rw-r--r-- | Swift/Controllers/HistoryController.h | 31 | ||||
| -rw-r--r-- | Swift/Controllers/MainController.cpp | 3 | ||||
| -rw-r--r-- | Swift/Controllers/MainController.h | 2 | ||||
| -rw-r--r-- | Swift/Controllers/SConscript | 1 | ||||
| -rw-r--r-- | Swift/Controllers/UIEvents/RequestHistoryUIEvent.h | 14 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/HistoryWindow.h | 17 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/HistoryWindowFactory.h | 18 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/UIFactory.h | 2 | 
9 files changed, 121 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(); +	} +} + +} diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h new file mode 100644 index 0000000..465b037 --- /dev/null +++ b/Swift/Controllers/HistoryController.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2012 Catalin Badea + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swiften/Base/boost_bsignals.h" +#include <boost/bind.hpp> +#include <boost/shared_ptr.hpp> + +#include "Swift/Controllers/UIEvents/UIEventStream.h" + +namespace Swift { +	class HistoryWindowFactory; +	class HistoryWindow; + +	class HistoryController { +		public: +			HistoryController(UIEventStream* uiEventStream, HistoryWindowFactory* historyWindowFactory); +			~HistoryController(); + +		private: +			void handleUIEvent(boost::shared_ptr<UIEvent> event); + +		private: +			HistoryWindowFactory* historyWindowFactory_; +			HistoryWindow* historyWindow_; +	}; +} diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index f124298..c92a9c6 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -37,6 +37,7 @@  #include "Swift/Controllers/SystemTray.h"  #include "Swift/Controllers/SystemTrayController.h"  #include "Swift/Controllers/XMLConsoleController.h" +#include "Swift/Controllers/HistoryController.h"  #include "Swift/Controllers/FileTransferListController.h"  #include "Swift/Controllers/UIEvents/UIEventStream.h"  #include "Swift/Controllers/PresenceNotifier.h" @@ -169,6 +170,7 @@ MainController::MainController(  	idleDetector_->onIdleChanged.connect(boost::bind(&MainController::handleInputIdleChanged, this, _1));  	xmlConsoleController_ = new XMLConsoleController(uiEventStream_, uiFactory_); +	historyController_ = new HistoryController(uiEventStream_, uiFactory_);  	fileTransferListController_ = new FileTransferListController(uiEventStream_, uiFactory_); @@ -193,6 +195,7 @@ MainController::~MainController() {  	resetClient();  	delete fileTransferListController_;  	delete xmlConsoleController_; +	delete historyController_;  	delete xmppURIController_;  	delete soundEventController_;  	delete systemTrayController_; diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index eeba9f3..5a767d3 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -52,6 +52,7 @@ namespace Swift {  	class SoundEventController;  	class SoundPlayer;  	class XMLConsoleController; +	class HistoryController;  	class FileTransferListController;  	class UIEventStream;  	class EventWindowFactory; @@ -143,6 +144,7 @@ namespace Swift {  			LoginWindow* loginWindow_;  			UIEventStream* uiEventStream_;  			XMLConsoleController* xmlConsoleController_; +			HistoryController* historyController_;  			FileTransferListController* fileTransferListController_;  			ChatsManager* chatsManager_;  			ProfileController* profileController_; diff --git a/Swift/Controllers/SConscript b/Swift/Controllers/SConscript index eca0d38..d564677 100644 --- a/Swift/Controllers/SConscript +++ b/Swift/Controllers/SConscript @@ -45,6 +45,7 @@ if env["SCONS_STAGE"] == "build" :  			"SoundEventController.cpp",  			"SystemTrayController.cpp",  			"XMLConsoleController.cpp", +			"HistoryController.cpp",  			"FileTransferListController.cpp",  			"StatusTracker.cpp",  			"PresenceNotifier.cpp", diff --git a/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h b/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h new file mode 100644 index 0000000..8562beb --- /dev/null +++ b/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2012 Catalin Badea + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swift/Controllers/UIEvents/UIEvent.h" + +namespace Swift { +	class RequestHistoryUIEvent : public UIEvent { +	}; +} diff --git a/Swift/Controllers/UIInterfaces/HistoryWindow.h b/Swift/Controllers/UIInterfaces/HistoryWindow.h new file mode 100644 index 0000000..379d4b1 --- /dev/null +++ b/Swift/Controllers/UIInterfaces/HistoryWindow.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2012 Catalin Badea + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +namespace Swift { +	class HistoryWindow { +		public: +			virtual ~HistoryWindow() {}; + +			virtual void show() = 0; +			virtual void activate() = 0; +	}; +} diff --git a/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h b/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h new file mode 100644 index 0000000..c84d8d7 --- /dev/null +++ b/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2012 Catalin Badea + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include "Swift/Controllers/UIInterfaces/HistoryWindow.h" + +namespace Swift { +	class UIEventStream; +	class HistoryWindowFactory { +		public: +			virtual ~HistoryWindowFactory() {}; +			virtual HistoryWindow* createHistoryWindow() = 0; +	}; +} diff --git a/Swift/Controllers/UIInterfaces/UIFactory.h b/Swift/Controllers/UIInterfaces/UIFactory.h index cf89dab..d6bea77 100644 --- a/Swift/Controllers/UIInterfaces/UIFactory.h +++ b/Swift/Controllers/UIInterfaces/UIFactory.h @@ -8,6 +8,7 @@  #include <Swift/Controllers/UIInterfaces/ChatListWindowFactory.h>  #include <Swift/Controllers/UIInterfaces/ChatWindowFactory.h> +#include <Swift/Controllers/UIInterfaces/HistoryWindowFactory.h>  #include <Swift/Controllers/UIInterfaces/EventWindowFactory.h>  #include <Swift/Controllers/UIInterfaces/LoginWindowFactory.h>  #include <Swift/Controllers/UIInterfaces/MainWindowFactory.h> @@ -24,6 +25,7 @@ namespace Swift {  	class UIFactory :   			public ChatListWindowFactory,   			public ChatWindowFactory,  +			public HistoryWindowFactory,  			public EventWindowFactory,   			public LoginWindowFactory,   			public MainWindowFactory,   | 
 Swift