All Buffers is dead! Long live All buffers!
[quassel.git] / src / qtui / mainwin.cpp
index 431dacd..01fb3b7 100644 (file)
@@ -41,6 +41,7 @@
 #include "chatmonitorview.h"
 #include "chatview.h"
 #include "client.h"
+#include "clientsyncer.h"
 #include "clientbacklogmanager.h"
 #include "coreinfodlg.h"
 #include "coreconnectdlg.h"
@@ -157,7 +158,6 @@ void MainWin::init() {
   setupActions();
   setupBufferWidget();
   setupMenus();
-  setupViews();
   setupTopicWidget();
   setupChatMonitor();
   setupNickWidget();
@@ -175,7 +175,11 @@ void MainWin::init() {
   setDisconnectedState();  // Disable menus and stuff
 
   show();
-  showCoreConnectionDlg(true); // autoconnect if appropriate
+  if(Quassel::runMode() != Quassel::Monolithic) {
+    showCoreConnectionDlg(true); // autoconnect if appropriate
+  } else {
+    startInternalCore();
+  }
 }
 
 MainWin::~MainWin() {
@@ -298,20 +302,15 @@ void MainWin::setupBufferWidget() {
   setCentralWidget(_bufferWidget);
 }
 
-void MainWin::setupViews() {
-  addBufferView();
-}
-
 void MainWin::addBufferView(int bufferViewConfigId) {
   addBufferView(Client::bufferViewManager()->bufferViewConfig(bufferViewConfigId));
 }
 
 void MainWin::addBufferView(BufferViewConfig *config) {
-  BufferViewDock *dock;
-  if(config)
-    dock = new BufferViewDock(config, this);
-  else
-    dock = new BufferViewDock(this);
+  if(!config)
+    return;
+
+  BufferViewDock *dock = new BufferViewDock(config, this);
 
   //create the view and initialize it's filter
   BufferView *view = new BufferView(dock);
@@ -618,6 +617,13 @@ void MainWin::setDisconnectedState() {
   updateIcon();
 }
 
+void MainWin::startInternalCore() {
+  ClientSyncer *syncer = new ClientSyncer();
+  Client::registerClientSyncer(syncer);
+  connect(syncer, SIGNAL(syncFinished()), syncer, SLOT(deleteLater()), Qt::QueuedConnection);
+  syncer->useInternalCore();
+}
+
 void MainWin::showCoreConnectionDlg(bool autoConnect) {
   CoreConnectDlg(autoConnect, this).exec();
 }