From 496871af0428c6dd8666d5e1d5ee1868110b7d6e Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Thu, 15 Mar 2012 00:25:55 +0100 Subject: [PATCH] Use the new Jreen::Logger and bump version requirement to 1.0.3 --- CMakeLists.txt | 2 +- README | 2 +- src/accounts/xmpp/sip/xmppsip.cpp | 26 +++++++++++++++++++++++++- src/libtomahawk/utils/logger.h | 6 +++--- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b91c8371..b00c918de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for automatic fe macro_optional_find_package(QuaZip) macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically." "http://quazip.sourceforge.net/" TRUE "" "") -macro_optional_find_package(Jreen) +macro_optional_find_package(Jreen 1.0.3) macro_log_feature(LIBJREEN_FOUND "Jreen" "Qt XMPP Library" "https://github.com/euroelessar/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin.\n") macro_optional_find_package(QTweetLib) diff --git a/README b/README index 27b59b7c9..348c08d84 100644 --- a/README +++ b/README @@ -40,7 +40,7 @@ Dependencies Attica 0.3.0 - ftp://ftp.kde.org/pub/kde/stable/attica/ QuaZip 0.4.3 - http://quazip.sourceforge.net/ - Jreen 1.0.2 - https://github.com/euroelessar/jreen + Jreen 1.0.3 - https://github.com/euroelessar/jreen QTweetLib 0.5.0 - https://github.com/minimoog/QTweetLib Third party libraries that we ship with our source: diff --git a/src/accounts/xmpp/sip/xmppsip.cpp b/src/accounts/xmpp/sip/xmppsip.cpp index 9a1f4f58e..4990f24f0 100644 --- a/src/accounts/xmpp/sip/xmppsip.cpp +++ b/src/accounts/xmpp/sip/xmppsip.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -58,6 +59,29 @@ using namespace Tomahawk; using namespace Accounts; +// instead of simply copying this function for another thirdparty lib +// please make it a meta-function or a macro and put it in logger.h. kthxbbq +#define JREEN_LOG_INFIX "Jreen" +void +JreenMessageHandler(QtMsgType type, const char *msg) +{ + switch (type) + { + case QtDebugMsg: + tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Debug: " << msg; + break; + case QtWarningMsg: + tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Warning: " << msg; + break; + case QtCriticalMsg: + tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Critical: " << msg; + break; + case QtFatalMsg: + tDebug(LOGTHIRDPARTY).nospace() << JREEN_LOG_INFIX << ": " << "Fatal: " << msg; + abort(); + } +} + XmppSipPlugin::XmppSipPlugin( Account *account ) : SipPlugin( account ) , m_state( Account::Disconnected ) @@ -66,7 +90,7 @@ XmppSipPlugin::XmppSipPlugin( Account *account ) , m_xmlConsole( 0 ) #endif { - qDebug() << Q_FUNC_INFO; + Jreen::Logger::addHandler( JreenMessageHandler ); m_currentUsername = readUsername(); diff --git a/src/libtomahawk/utils/logger.h b/src/libtomahawk/utils/logger.h index 76b95f9da..ba4612377 100644 --- a/src/libtomahawk/utils/logger.h +++ b/src/libtomahawk/utils/logger.h @@ -16,8 +16,8 @@ * along with Tomahawk. If not, see . */ -#ifndef LOGGER_H -#define LOGGER_H +#ifndef TOMAHAWK_LOGGER_H +#define TOMAHAWK_LOGGER_H #include #include @@ -58,4 +58,4 @@ namespace Logger #define LOGVERBOSE 8 #define LOGTHIRDPARTY 9 -#endif \ No newline at end of file +#endif // TOMAHAWK_LOGGER_H