diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-11-28 18:52:43 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-11-28 18:52:43 (GMT) |
commit | 85dcc894ccf417ec8b057d868afb1d8006634ac4 (patch) | |
tree | b32c7b747c91727c9caf00076c0b2468038242a7 /Swift/Controllers | |
parent | 27f8faea9b516f45c932c6b36a626b78d92438d4 (diff) | |
download | swift-contrib-85dcc894ccf417ec8b057d868afb1d8006634ac4.zip swift-contrib-85dcc894ccf417ec8b057d868afb1d8006634ac4.tar.bz2 |
Some code cleanup.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/SystemTrayController.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/SystemTrayController.h | 4 | ||||
-rw-r--r-- | Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/UIEvents/UIEventStream.h | 6 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h | 3 | ||||
-rw-r--r-- | Swift/Controllers/XMLConsoleController.cpp | 21 | ||||
-rw-r--r-- | Swift/Controllers/XMLConsoleController.h | 9 |
7 files changed, 28 insertions, 18 deletions
diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp index 8caf79a..0fdd4b5 100644 --- a/Swift/Controllers/SystemTrayController.cpp +++ b/Swift/Controllers/SystemTrayController.cpp @@ -14,7 +14,7 @@ SystemTrayController::SystemTrayController(EventController* eventController, Sys } void SystemTrayController::handleEventQueueLengthChange(int length) { - systemTray_->setUnreadMessages(length > 0 ? true : false); + systemTray_->setUnreadMessages(length > 0); } diff --git a/Swift/Controllers/SystemTrayController.h b/Swift/Controllers/SystemTrayController.h index 1c6d270..6d2aa31 100644 --- a/Swift/Controllers/SystemTrayController.h +++ b/Swift/Controllers/SystemTrayController.h @@ -3,11 +3,15 @@ namespace Swift { class EventController; class SystemTray; + class SystemTrayController { public: SystemTrayController(EventController* eventController, SystemTray* systemTray); + private: void handleEventQueueLengthChange(int length); + + private: EventController* eventController_; SystemTray* systemTray_; }; diff --git a/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h b/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h index 63492b3..1712d39 100644 --- a/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h +++ b/Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h @@ -4,6 +4,5 @@ namespace Swift { class RequestXMLConsoleUIEvent : public UIEvent { - }; } diff --git a/Swift/Controllers/UIEvents/UIEventStream.h b/Swift/Controllers/UIEvents/UIEventStream.h index a20c578..60961c1 100644 --- a/Swift/Controllers/UIEvents/UIEventStream.h +++ b/Swift/Controllers/UIEvents/UIEventStream.h @@ -3,13 +3,15 @@ #include <boost/signals.hpp> #include <boost/shared_ptr.hpp> - #include "Swift/Controllers/UIEvents/UIEvent.h" namespace Swift { class UIEventStream { public: boost::signal<void (boost::shared_ptr<UIEvent>)> onUIEvent; - void send(boost::shared_ptr<UIEvent> event) {onUIEvent(event);}; + + void send(boost::shared_ptr<UIEvent> event) { + onUIEvent(event); + }; }; } diff --git a/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h b/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h index fa7707a..26ae5c0 100644 --- a/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h +++ b/Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h @@ -6,7 +6,8 @@ namespace Swift { class UIEventStream; class XMLConsoleWidgetFactory { public: - virtual XMLConsoleWidget* createXMLConsoleWidget() = 0; virtual ~XMLConsoleWidgetFactory() {}; + + virtual XMLConsoleWidget* createXMLConsoleWidget() = 0; }; } diff --git a/Swift/Controllers/XMLConsoleController.cpp b/Swift/Controllers/XMLConsoleController.cpp index ebc9912..4629573 100644 --- a/Swift/Controllers/XMLConsoleController.cpp +++ b/Swift/Controllers/XMLConsoleController.cpp @@ -1,25 +1,26 @@ #include "Swift/Controllers/XMLConsoleController.h" #include "Swift/Controllers/UIInterfaces/XMLConsoleWidgetFactory.h" - #include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h" namespace Swift { -XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) { - uiEventStream_ = uiEventStream; - xmlConsoleWidgetFactory_ = xmlConsoleWidgetFactory; - uiEventStream_->onUIEvent.connect(boost::bind(&XMLConsoleController::handleUIEvent, this, _1)); - xmlConsoleWidget_ = NULL; + +XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : xmlConsoleWidgetFactory(xmlConsoleWidgetFactory), xmlConsoleWidget(NULL) { + uiEventStream->onUIEvent.connect(boost::bind(&XMLConsoleController::handleUIEvent, this, _1)); +} + +XMLConsoleController::~XMLConsoleController() { + delete xmlConsoleWidget; } void XMLConsoleController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { boost::shared_ptr<RequestXMLConsoleUIEvent> event = boost::dynamic_pointer_cast<RequestXMLConsoleUIEvent>(rawEvent); if (event != NULL) { - if (xmlConsoleWidget_ == NULL) { - xmlConsoleWidget_ = xmlConsoleWidgetFactory_->createXMLConsoleWidget(); + if (xmlConsoleWidget == NULL) { + xmlConsoleWidget = xmlConsoleWidgetFactory->createXMLConsoleWidget(); } - xmlConsoleWidget_->show(); - xmlConsoleWidget_->activate(); + xmlConsoleWidget->show(); + xmlConsoleWidget->activate(); } } diff --git a/Swift/Controllers/XMLConsoleController.h b/Swift/Controllers/XMLConsoleController.h index f97e6c1..52a8269 100644 --- a/Swift/Controllers/XMLConsoleController.h +++ b/Swift/Controllers/XMLConsoleController.h @@ -12,10 +12,13 @@ namespace Swift { class XMLConsoleController { public: XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory); + ~XMLConsoleController(); + private: void handleUIEvent(boost::shared_ptr<UIEvent> event); - UIEventStream* uiEventStream_; - XMLConsoleWidgetFactory* xmlConsoleWidgetFactory_; - XMLConsoleWidget* xmlConsoleWidget_; + + private: + XMLConsoleWidgetFactory* xmlConsoleWidgetFactory; + XMLConsoleWidget* xmlConsoleWidget; }; } |