X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=core%2Fcore.cpp;h=0d4eaccbc912d926465eeffcc0f64f1306c875c5;hp=7c341d573b342831a42a893a9c2237ab5d75b4a8;hb=473d2f15c4bbf639bf01899206d001b5ec025926;hpb=31d998779868a1b572972168b2e813893d70ab90 diff --git a/core/core.cpp b/core/core.cpp index 7c341d57..0d4eaccb 100644 --- a/core/core.cpp +++ b/core/core.cpp @@ -20,7 +20,7 @@ #include "core.h" #include "server.h" -#include "quassel.h" +#include "global.h" #include "coreproxy.h" #include @@ -33,30 +33,24 @@ Core::Core() { connect(&server, SIGNAL(recvLine(QString)), coreProxy, SLOT(csCoreMessage(QString))); + // Read global settings from config file QSettings s; - VarMap identities = s.value("Network/Identities").toMap(); - //VarMap networks = s.value("Network/ - quassel->putData("Identities", identities); + s.beginGroup("Global"); + QString key; + foreach(key, s.childKeys()) { + global->updateData(key, s.value(key)); + } + global->updateData("CoreReady", true); + // Now that we are in sync, we can connect signals to automatically store further updates. + // I don't think we care if global data changed locally or if it was updated by a client. + connect(global, SIGNAL(dataUpdatedRemotely(QString)), SLOT(globalDataUpdated(QString))); + connect(global, SIGNAL(dataPutLocally(QString)), SLOT(globalDataUpdated(QString))); 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) { + if(server.isConnected()) return; qDebug() << "Core: Connecting to " << h << ":" << port; server.connectToIrc(h, port); } @@ -66,14 +60,10 @@ void Core::inputLine(QString s) { } -VarMap Core::loadIdentities() { - QSettings s; - return s.value("Network/Identities").toMap(); -} - -void Core::storeIdentities(VarMap identities) { +void Core::globalDataUpdated(QString key) { + QVariant data = global->getData(key); QSettings s; - s.setValue("Network/Identities", identities); + s.setValue(QString("Global/")+key, data); } -Core *core; +Core *core = 0;