From 706276e0fdffb0af86d8178973bbf5ae3722733d Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sun, 21 Jun 2009 16:39:42 +0100
Subject: Enable netbook mode with any commandline parameters


diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 8670ddb..caa3624 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -19,19 +19,25 @@
 
 namespace Swift{
 
-QtSwift::QtSwift() {
-	QSplitter* splitter = new QSplitter();
+QtSwift::QtSwift(bool netbookMode) {
+	if (netbookMode) {
+		splitter_ = new QSplitter();
+	} else {
+		splitter_ = NULL;
+	}
 	treeWidgetFactory_ = new QtTreeWidgetFactory(); 
-	loginWindowFactory_ = new QtLoginWindowFactory(splitter);
+	loginWindowFactory_ = new QtLoginWindowFactory(splitter_);
 	rosterWindowFactory_ = new QtMainWindowFactory(treeWidgetFactory_);
-	chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter);
+	chatWindowFactory_ = new QtChatWindowFactory(treeWidgetFactory_, splitter_);
 	systemTray_ = new QtSystemTray();
 	QCoreApplication::setApplicationName("Swift");
 	QCoreApplication::setOrganizationName("Swift");
 	QCoreApplication::setOrganizationDomain("swift.im");
 	settings_ = new QtSettingsProvider();
 	application_ = new PlatformApplication("Swift");
-	splitter->show();
+	if (splitter_) {
+		splitter_->show();
+	}
 	mainController_ = new MainController(chatWindowFactory_, rosterWindowFactory_, loginWindowFactory_, treeWidgetFactory_, settings_, application_, systemTray_);
 }
 
@@ -44,6 +50,7 @@ QtSwift::~QtSwift() {
 	delete settings_;
 	delete application_;
 	delete systemTray_;
+	delete splitter_;
 }
 
 }
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index 5c6656a..a9b8efb 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -8,6 +8,8 @@
 #include "QtChatWindowFactory.h"
 #include "QtSettingsProvider.h"
 
+class QSplitter;
+
 namespace Swift {
 	class Application;
 	class MainController;
@@ -20,7 +22,7 @@ namespace Swift {
 	class QtSwift : public QObject {
 		Q_OBJECT
 		public:
-			QtSwift();
+			QtSwift(bool netbookMode);
 			~QtSwift();
 		private:
 			MainController *mainController_;
@@ -31,6 +33,7 @@ namespace Swift {
 			QtMainEventLoop clientMainThreadCaller_;
 			QtSettingsProvider *settings_;
 			QtSystemTray* systemTray_;
+			QSplitter* splitter_;
 			Application* application_;
 	};
 }
diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp
index 7a438fd..a7a715c 100644
--- a/Swift/QtUI/main.cpp
+++ b/Swift/QtUI/main.cpp
@@ -5,6 +5,7 @@
 int main(int argc, char* argv[])
 {
 	QApplication app(argc, argv);
-	Swift::QtSwift swift;
+	bool netbookMode = argc > 1;
+	Swift::QtSwift swift(netbookMode);
 	return app.exec();
 }
-- 
cgit v0.10.2-6-g49f6