From 8e90fc4fb400b925dfb7897b47ecb1ffd0d13538 Mon Sep 17 00:00:00 2001
From: Catalin Badea <catalin.badea392@gmail.com>
Date: Mon, 4 Jun 2012 15:00:47 +0300
Subject: Disconnect history controller from the event stream. Fixed coding
 style


diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index 2aa1b6e..4f97006 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -1,21 +1,22 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
-#include "Swift/Controllers/HistoryController.h"
+#include <Swift/Controllers/HistoryController.h>
 
-#include "Swift/Controllers/UIInterfaces/HistoryWindowFactory.h"
-#include "Swift/Controllers/UIEvents/RequestHistoryUIEvent.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(UIEventStream* uiEventStream, HistoryWindowFactory* historyWindowFactory) : uiEventStream_(uiEventStream), historyWindowFactory_(historyWindowFactory), historyWindow_(NULL) {
+	uiEventStream_->onUIEvent.connect(boost::bind(&HistoryController::handleUIEvent, this, _1));
 }
 
 HistoryController::~HistoryController() {
+	uiEventStream_->onUIEvent.disconnect(boost::bind(&HistoryController::handleUIEvent, this, _1));
 	delete historyWindow_;
 }
 
@@ -25,7 +26,6 @@ void HistoryController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) {
 		if (historyWindow_ == NULL) {
 			historyWindow_ = historyWindowFactory_->createHistoryWindow();
 		}
-		historyWindow_->show();
 		historyWindow_->activate();
 	}
 }
diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h
index 465b037..47ae361 100644
--- a/Swift/Controllers/HistoryController.h
+++ b/Swift/Controllers/HistoryController.h
@@ -1,16 +1,16 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
 #pragma once
 
-#include "Swiften/Base/boost_bsignals.h"
+#include <Swiften/Base/boost_bsignals.h>
 #include <boost/bind.hpp>
 #include <boost/shared_ptr.hpp>
 
-#include "Swift/Controllers/UIEvents/UIEventStream.h"
+#include <Swift/Controllers/UIEvents/UIEventStream.h>
 
 namespace Swift {
 	class HistoryWindowFactory;
@@ -25,6 +25,7 @@ namespace Swift {
 			void handleUIEvent(boost::shared_ptr<UIEvent> event);
 
 		private:
+			UIEventStream* uiEventStream_;
 			HistoryWindowFactory* historyWindowFactory_;
 			HistoryWindow* historyWindow_;
 	};
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index dc027d0..e433059 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -37,7 +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/HistoryController.h>
 #include "Swift/Controllers/FileTransferListController.h"
 #include "Swift/Controllers/UIEvents/UIEventStream.h"
 #include "Swift/Controllers/PresenceNotifier.h"
diff --git a/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h b/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h
index 8562beb..025e91f 100644
--- a/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h
+++ b/Swift/Controllers/UIEvents/RequestHistoryUIEvent.h
@@ -1,12 +1,12 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
 #pragma once
 
-#include "Swift/Controllers/UIEvents/UIEvent.h"
+#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
index 379d4b1..cb29120 100644
--- a/Swift/Controllers/UIInterfaces/HistoryWindow.h
+++ b/Swift/Controllers/UIInterfaces/HistoryWindow.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
 #pragma once
@@ -11,7 +11,6 @@ namespace Swift {
 		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
index c84d8d7..135438b 100644
--- a/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h
+++ b/Swift/Controllers/UIInterfaces/HistoryWindowFactory.h
@@ -1,12 +1,12 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
 #pragma once
 
-#include "Swift/Controllers/UIInterfaces/HistoryWindow.h"
+#include <Swift/Controllers/UIInterfaces/HistoryWindow.h>
 
 namespace Swift {
 	class UIEventStream;
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index a54fa03..6868ca5 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -1,11 +1,11 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
-#include "QtHistoryWindow.h"
-#include "QtTabbable.h"
+#include <QtHistoryWindow.h>
+#include <QtTabbable.h>
 
 #include <QCloseEvent>
 #include <QTextEdit>
@@ -14,7 +14,7 @@
 #include <QScrollBar>
 #include <QCheckBox>
 
-#include "QtSwiftUtil.h"
+#include <QtSwiftUtil.h>
 #include <string>
 
 namespace Swift {
@@ -35,16 +35,9 @@ QtHistoryWindow::QtHistoryWindow() {
 	buttonLayout->addStretch();
 
 	setWindowTitle(tr("History"));
-	emit titleUpdated();
 }
 
 QtHistoryWindow::~QtHistoryWindow() {
-	// do nothing
-}
-
-void QtHistoryWindow::show() {
-	QWidget::show();
-	emit windowOpening();
 }
 
 void QtHistoryWindow::activate() {
diff --git a/Swift/QtUI/QtHistoryWindow.h b/Swift/QtUI/QtHistoryWindow.h
index f2e5cc0..eacba8d 100644
--- a/Swift/QtUI/QtHistoryWindow.h
+++ b/Swift/QtUI/QtHistoryWindow.h
@@ -1,13 +1,13 @@
 /*
  * Copyright (c) 2012 Catalin Badea
- * Licensed under the GNU General Public License v3.
- * See Documentation/Licenses/GPLv3.txt for more information.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
  */
 
 #pragma once
 
-#include "Swift/Controllers/UIInterfaces/HistoryWindow.h"
-#include "QtTabbable.h"
+#include <Swift/Controllers/UIInterfaces/HistoryWindow.h>
+#include <QtTabbable.h>
 
 class QTextEdit;
 class QCheckBox;
@@ -20,8 +20,6 @@ namespace Swift {
 		public:
 			QtHistoryWindow();
 			~QtHistoryWindow();
-
-			void show();
 			void activate();
 
 		private:
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index e58bbbe..03a2929 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -9,7 +9,6 @@
 #include <QSplitter>
 
 #include "QtXMLConsoleWidget.h"
-#include "QtHistoryWindow.h"
 #include "QtChatTabs.h"
 #include "QtMainWindow.h"
 #include "QtLoginWindow.h"
@@ -28,6 +27,7 @@
 #include "QtFileTransferListWidget.h"
 #include <Swift/Controllers/Settings/SettingsProviderHierachy.h>
 #include <Swift/QtUI/QtUISettingConstants.h>
+#include <QtHistoryWindow.h>
 
 namespace Swift {
 
-- 
cgit v0.10.2-6-g49f6