[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:05:04 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=3628f4d
The following commit has been merged in the master branch:
commit 3628f4d75679a7af7a2f05845aab33cc55f07ba6
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date: Tue Mar 13 14:56:41 2012 +0100
Move Tp-Qt debug callback outside TelepathyHandlerApplication
This allows to use it from any application that is not a
TelepathyHandlerApplication
---
KTp/CMakeLists.txt | 2 ++
KTp/debug.cpp | 53 +++++++++++++++++++++++++++++++++++
KTp/debug.h | 37 ++++++++++++++++++++++++
KTp/telepathy-handler-application.cpp | 25 ++---------------
4 files changed, 95 insertions(+), 22 deletions(-)
diff --git a/KTp/CMakeLists.txt b/KTp/CMakeLists.txt
index 865769e..61da66d 100644
--- a/KTp/CMakeLists.txt
+++ b/KTp/CMakeLists.txt
@@ -3,6 +3,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}
set (ktp_common_internals_private_SRCS
circular-countdown.cpp
+ debug.cpp
error-dictionary.cpp
global-presence.cpp
presence.cpp
@@ -14,6 +15,7 @@ set (ktp_common_internals_private_SRCS
set (ktp_common_internals_private_HDRS
circular-countdown.h
+ debug.h
error-dictionary.h
global-presence.h
presence.h
diff --git a/KTp/debug.cpp b/KTp/debug.cpp
new file mode 100644
index 0000000..e7d26bc
--- /dev/null
+++ b/KTp/debug.cpp
@@ -0,0 +1,53 @@
+/*
+* Copyright (C) 2011, 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "debug.h"
+
+#include <KDE/KDebug>
+#include <TelepathyQt/Debug>
+
+
+namespace KTp
+{
+
+namespace {
+int s_tpqtDebugArea;
+
+static void tpDebugCallback(const QString &libraryName,
+ const QString &libraryVersion,
+ QtMsgType type,
+ const QString &msg)
+{
+ Q_UNUSED(libraryName)
+ Q_UNUSED(libraryVersion)
+ kDebugStream(type, s_tpqtDebugArea, __FILE__, __LINE__, 0) << qPrintable(msg);
+}
+} // namespace
+} // namespace KTp
+
+void KTp::Debug::installCallback(bool debug, bool warning)
+{
+ s_tpqtDebugArea = KDebug::registerArea("Telepathy-Qt");
+
+ // Redirect Tp debug and warnings to KDebug output
+ Tp::setDebugCallback(&tpDebugCallback);
+
+ // Enable telepathy-Qt4 debug
+ Tp::enableDebug(debug);
+ Tp::enableWarnings(warning);
+}
diff --git a/KTp/debug.h b/KTp/debug.h
new file mode 100644
index 0000000..8ed339e
--- /dev/null
+++ b/KTp/debug.h
@@ -0,0 +1,37 @@
+/*
+* Copyright (C) 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef KTP_DEBUG_H
+#define KTP_DEBUG_H
+
+namespace KTp {
+namespace Debug {
+
+ /**
+ * Installs Telepathy-Qt debug callback and enable/disable Telepathy-Qt
+ * debug and warning output
+ *
+ * @param debug If true enable Telepathy-Qt debug
+ * @param warning If true enable Telepathy-Qt warnings
+ */
+ void installCallback(bool debug, bool warning = true);
+
+} // namespace Debug
+} // namespace KTp
+
+#endif // KTP_DEBUG_H
diff --git a/KTp/telepathy-handler-application.cpp b/KTp/telepathy-handler-application.cpp
index 2e45c0f..dfd5d54 100644
--- a/KTp/telepathy-handler-application.cpp
+++ b/KTp/telepathy-handler-application.cpp
@@ -18,6 +18,7 @@
*/
#include "telepathy-handler-application.h"
+#include "debug.h"
#include <QTimer>
#include <KCmdLineArgs>
@@ -32,20 +33,6 @@ extern bool kde_kdebug_enable_dbus_interface;
namespace KTp
{
-namespace {
-int s_tpqt4DebugArea;
-
-static void tpDebugCallback(const QString &libraryName,
- const QString &libraryVersion,
- QtMsgType type,
- const QString &msg)
-{
- Q_UNUSED(libraryName)
- Q_UNUSED(libraryVersion)
- kDebugStream(type, s_tpqt4DebugArea, __FILE__, __LINE__, 0) << qPrintable(msg);
-}
-}
-
class TelepathyHandlerApplication::Private
{
public:
@@ -111,8 +98,6 @@ KComponentData TelepathyHandlerApplication::Private::initHack()
Private::s_persist = args->isSet("persist");
Private::s_debug = args->isSet("debug");
- s_tpqt4DebugArea = KDebug::registerArea("Telepathy-Qt4");
-
return cData;
}
@@ -130,12 +115,8 @@ void TelepathyHandlerApplication::Private::init(int initialTimeout, int timeout)
// Register TpQt4 types
Tp::registerTypes();
- // Redirect Tp debug and warnings to KDebug output
- Tp::setDebugCallback(&tpDebugCallback);
-
- // Enable telepathy-Qt4 debug
- Tp::enableDebug(s_debug);
- Tp::enableWarnings(true);
+ // Install TpQt4 debug callback
+ KTp::Debug::installCallback(s_debug);
// Enable KDebug DBus interface
// FIXME This must be enabled here because there is a bug in plasma
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list