X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=ca008e907d77f715111f1543e0061b06e730613d;hp=19f0c5e039777edf55e1b136394bbd62d74df527;hb=167ef57a636052f8e18a206e84c3447552e84d2b;hpb=8f0946673bc3edc84b6f13e16cbe8ece912b4a3b diff --git a/src/client/client.cpp b/src/client/client.cpp index 19f0c5e0..ca008e90 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -35,6 +35,7 @@ #include "messagemodel.h" #include "network.h" #include "networkmodel.h" +#include "quassel.h" #include "quasselui.h" #include "signalproxy.h" #include "util.h" @@ -76,7 +77,8 @@ Client::Client(QObject *parent) _messageModel(0), _messageProcessor(0), _connectedToCore(false), - _syncedToCore(false) + _syncedToCore(false), + _debugLog(&_debugLogBuffer) { _signalProxy->synchronize(_ircListHelper); } @@ -122,6 +124,9 @@ void Client::init() { connect(this, SIGNAL(connected()), mainUi, SLOT(connectedToCore())); connect(this, SIGNAL(disconnected()), mainUi, SLOT(disconnectedFromCore())); + // attach backlog manager + p->synchronize(backlogManager()); + connect(backlogManager(), SIGNAL(messagesReceived(BufferId, int)), _messageModel, SLOT(messagesReceived(BufferId, int))); } /*** public static methods ***/ @@ -274,9 +279,6 @@ void Client::setSyncedToCore() { connect(bufferSyncer(), SIGNAL(bufferRenamed(BufferId, QString)), this, SLOT(bufferRenamed(BufferId, QString))); signalProxy()->synchronize(bufferSyncer()); - // attach backlog manager - signalProxy()->synchronize(backlogManager()); - // create a new BufferViewManager _bufferViewManager = new BufferViewManager(signalProxy(), this); @@ -302,6 +304,7 @@ void Client::disconnectedFromCore() { emit disconnected(); emit coreConnectionStateChanged(false); + backlogManager()->reset(); messageProcessor()->reset(); // Clear internal data. Hopefully nothing relies on it at this point. @@ -361,9 +364,9 @@ void Client::recvStatusMsg(QString /*net*/, QString /*msg*/) { //recvMessage(net, Message::server("", QString("[STATUS] %1").arg(msg))); } -void Client::recvMessage(const Message &msg_) { - Message msg = msg_; - messageProcessor()->process(msg); +void Client::recvMessage(const Message &msg) { + Message msg_ = msg; + messageProcessor()->process(msg_); } void Client::setBufferLastSeenMsg(BufferId id, const MsgId &msgId) { @@ -401,3 +404,25 @@ void Client::bufferRenamed(BufferId bufferId, const QString &newName) { networkModel()->setData(bufferIndex, newName, Qt::DisplayRole); } } + +void Client::logMessage(QtMsgType type, const char *msg) { + QString prefix; + switch (type) { + case QtDebugMsg: + prefix = "Debug"; + break; + case QtWarningMsg: + prefix = "Warning"; + break; + case QtCriticalMsg: + prefix = "Critical"; + break; + case QtFatalMsg: + Quassel::logFatalMessage(msg); + return; + } + QString msgString = QString("%1: %3\n").arg(prefix, msg); + instance()->_debugLog << msgString; + emit instance()->logUpdated(msgString); +} +