From 85dcc894ccf417ec8b057d868afb1d8006634ac4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sat, 28 Nov 2009 19:52:43 +0100
Subject: Some code cleanup.


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;
 	};
 }
-- 
cgit v0.10.2-6-g49f6