[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdevplatform] plugins/testview: TestView: use (dynamic) debug area for debug output
From:       Niko Sams <niko.sams () gmail ! com>
Date:       2013-01-05 10:58:38
Message-ID: 20130105105838.3BC74A6091 () git ! kde ! org
[Download RAW message or body]

Git commit 4306666864153f07ec2653840b7ecd0c5b8fd3b6 by Niko Sams.
Committed on 05/01/2013 at 12:57.
Pushed by nsams into branch 'master'.

TestView: use (dynamic) debug area for debug output

M  +1    -0    plugins/testview/CMakeLists.txt
M  +5    -5    plugins/testview/testview.cpp
A  +29   -0    plugins/testview/testviewdebug.cpp     [License: LGPL (v2.1+)]
A  +30   -0    plugins/testview/testviewdebug.h     [License: LGPL (v2.1+)]

http://commits.kde.org/kdevplatform/4306666864153f07ec2653840b7ecd0c5b8fd3b6

diff --git a/plugins/testview/CMakeLists.txt b/plugins/testview/CMakeLists.txt
index ea18183..5307d7f 100644
--- a/plugins/testview/CMakeLists.txt
+++ b/plugins/testview/CMakeLists.txt
@@ -6,6 +6,7 @@
 set(kdevtestview_PLUGIN_SRCS
     testview.cpp
     testviewplugin.cpp
+    testviewdebug.cpp
 )
 
 kde4_add_plugin(kdevtestview ${kdevtestview_PLUGIN_SRCS})
diff --git a/plugins/testview/testview.cpp b/plugins/testview/testview.cpp
index 626aad4..d6be5f4 100644
--- a/plugins/testview/testview.cpp
+++ b/plugins/testview/testview.cpp
@@ -19,6 +19,7 @@
 
 #include "testview.h"
 #include "testviewplugin.h"
+#include "testviewdebug.h"
 
 #include <interfaces/icore.h>
 #include <interfaces/iproject.h>
@@ -41,7 +42,6 @@
 #include <KAction>
 #include <KLocalizedString>
 #include <KJob>
-#include <KDebug>
 #include <krecursivefilterproxymodel.h>
 #include <KLineEdit>
 #include <KConfigGroup>
@@ -168,13 +168,13 @@ void TestView::updateTestSuite(ITestSuite* suite, const TestResult& result)
         return;
     }
 
-    kDebug() << "Updating test suite" << suite->name();
+    debug() << "Updating test suite" << suite->name();
 
     item->setIcon(iconForTestResult(result.suiteResult));
 
     for (int i = 0; i < item->rowCount(); ++i)
     {
-        kDebug() << "Found a test case" << item->child(i)->text();
+        debug() << "Found a test case" << item->child(i)->text();
         QStandardItem* caseItem = item->child(i);
         if (result.testCaseResults.contains(caseItem->text()))
         {
@@ -186,7 +186,7 @@ void TestView::updateTestSuite(ITestSuite* suite, const TestResult& result)
 
 KIcon TestView::iconForTestResult(TestResult::TestCaseResult result)
 {
-    kDebug() << result;
+    debug() << result;
     switch (result)
     {
         case TestResult::NotRun:
@@ -344,7 +344,7 @@ void TestView::showSource()
     locker.unlock();
 
     IDocumentController* dc = ICore::self()->documentController();
-    kDebug() << "Activating declaration in" << url;
+    debug() << "Activating declaration in" << url;
     dc->openDocument(url, cursor);
 }
 
diff --git a/plugins/testview/testviewdebug.cpp b/plugins/testview/testviewdebug.cpp
new file mode 100644
index 0000000..bb0a279
--- /dev/null
+++ b/plugins/testview/testviewdebug.cpp
@@ -0,0 +1,29 @@
+/*
+    This plugin is part of KDevelop.
+
+    Copyright (C) 2011 Milian Wolff <mail@milianw.de>
+
+    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 Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+*/
+
+#include "testviewdebug.h"
+
+
+int debugArea()
+{
+  static int area = KDebug::registerArea("KDevplatform (Test View)", false);
+  return area;
+}
diff --git a/plugins/testview/testviewdebug.h b/plugins/testview/testviewdebug.h
new file mode 100644
index 0000000..abad064
--- /dev/null
+++ b/plugins/testview/testviewdebug.h
@@ -0,0 +1,30 @@
+/*
+    This plugin is part of KDevelop.
+
+    Copyright (C) 2011 Milian Wolff <mail@milianw.de>
+
+    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 Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+*/
+
+#ifndef TESTVIEWDEBUG_H
+#define TESTVIEWDEBUG_H
+
+#include <KDebug>
+
+int debugArea();
+#define debug() kDebug(debugArea())
+
+#endif // TESTVIEWDEBUG_H
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic