X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=3305f5b3dc8e11f8c25a77f97b52a13f119743cf;hp=b6b8791744d3ffb22a3442cce8d953194ba6ae16;hb=bc715c756677bee7cdb7109cc656e3e5f526c988;hpb=19110173761122c3e6339f6cff608668c37052ee diff --git a/src/client/client.cpp b/src/client/client.cpp index b6b87917..3305f5b3 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2014 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -646,6 +646,7 @@ void Client::markBufferAsRead(BufferId id) } +#if QT_VERSION < 0x050000 void Client::logMessage(QtMsgType type, const char *msg) { fprintf(stderr, "%s\n", msg); @@ -665,3 +666,26 @@ void Client::logMessage(QtMsgType type, const char *msg) emit instance()->logUpdated(msgString); } } +#else +void Client::logMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + Q_UNUSED(context); + + fprintf(stderr, "%s\n", msg.toLocal8Bit().constData()); + fflush(stderr); + if (type == QtFatalMsg) { + Quassel::logFatalMessage(msg.toLocal8Bit().constData()); + } + else { + QString msgString = QString("%1\n").arg(msg); + + //Check to see if there is an instance around, else we risk recursions + //when calling instance() and creating new ones. + if (!instanceExists()) + return; + + instance()->_debugLog << msgString; + emit instance()->logUpdated(msgString); + } +} +#endif