• Skip to content
  • Skip to link menu
  • KDE API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • KTp
debug.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2011, 2012 Daniele E. Domenichelli <daniele.domenichelli@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include "debug.h"
20 
21 #include <KDE/KDebug>
22 #include <TelepathyQt/Debug>
23 
24 
25 namespace KTp
26 {
27 
28 namespace {
29 int s_tpqtDebugArea;
30 QString libraryString;
31 
32 static void tpDebugCallback(const QString &libraryName,
33  const QString &libraryVersion,
34  QtMsgType type,
35  const QString &msg)
36 {
37  if (Q_UNLIKELY(libraryString.isEmpty())) {
38  libraryString = QString::fromLatin1("%1 %2").arg(libraryName, libraryVersion);
39  }
40  kDebugStream(type, s_tpqtDebugArea, __FILE__, __LINE__, libraryString.toLatin1()) << qPrintable(msg);
41 }
42 } // namespace
43 } // namespace KTp
44 
45 void KTp::Debug::installCallback(bool debug, bool warning)
46 {
47  s_tpqtDebugArea = KDebug::registerArea("Telepathy-Qt");
48 
49  // Redirect Tp debug and warnings to KDebug output
50  Tp::setDebugCallback(&tpDebugCallback);
51 
52  // Enable telepathy-Qt4 debug
53  Tp::enableDebug(debug);
54  Tp::enableWarnings(warning);
55 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Mar 22 2013 10:58:52 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktp-common-internals API Reference

Skip menu "ktp-common-internals API Reference"
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal