X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=3305f5b3dc8e11f8c25a77f97b52a13f119743cf;hb=2b44b945cf50e3dbfeabe4e5aee10db4b13f5a64;hp=9ef23efb3e9ad8db907621b3f9ba36bbe73286fe;hpb=9d54503555534a2c554f09a33df6afa33d6308ec;p=quassel.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 9ef23efb..3305f5b3 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -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