Finished logical separation of core and GUI. Monolithic build should work as expected.
[quassel.git] / core / core.cpp
index 4d14402..7c341d5 100644 (file)
  ***************************************************************************/
 
 #include "core.h"
+#include "server.h"
+#include "quassel.h"
+#include "coreproxy.h"
 
 #include <QSettings>
 
+Core::Core() {
+  if(core) qFatal("Trying to instantiate more than one Core object!");
+
+  connect(coreProxy, SIGNAL(gsRequestConnect(QString, quint16)), this, SLOT(connectToIrc(QString, quint16)));
+  connect(coreProxy, SIGNAL(gsUserInput(QString)), this, SLOT(inputLine(QString)));
+
+  connect(&server, SIGNAL(recvLine(QString)), coreProxy, SLOT(csCoreMessage(QString)));
+
+  QSettings s;
+  VarMap identities = s.value("Network/Identities").toMap();
+  //VarMap networks   = s.value("Network/
+  quassel->putData("Identities", identities);
+
+  server.start();
+}
+
 void Core::init() {
 
 
+}
+
+/*
+void Core::run() {
+
+  connect(&server, SIGNAL(recvLine(const QString &)), this, SIGNAL(outputLine(const QString &)));
+  //connect(
+  server.start();
+  exec();
+}
+*/
+
+void Core::connectToIrc(const QString &h, quint16 port) {
+  qDebug() << "Core: Connecting to " << h << ":" << port;
+  server.connectToIrc(h, port);
+}
+
+void Core::inputLine(QString s) {
+  server.putRawLine(s);
+
 }
 
 VarMap Core::loadIdentities() {
@@ -36,3 +75,5 @@ void Core::storeIdentities(VarMap identities) {
   QSettings s;
   s.setValue("Network/Identities", identities);
 }
+
+Core *core;