summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-01-07 09:37:02 +0100
committerMontel Laurent <[email protected]>2015-01-07 09:37:02 +0100
commitd5fa914adfb48289ad89c71e16bc11486df403ba (patch)
treeab1d847bdbc9f0492e259fe5132ad9c01118b009
parentf47a884931c4b9109864e3ba27949028a13825b4 (diff)
Use QCDebug
-rw-r--r--CMakeLists.txt1
-rw-r--r--ksnakeduel_debug.cpp23
-rw-r--r--ksnakeduel_debug.h27
-rw-r--r--ktron.cpp2
-rw-r--r--player.cpp10
-rw-r--r--playfield.cpp6
-rw-r--r--renderer.cpp4
-rw-r--r--snakepart.cpp2
-rw-r--r--tron.cpp8
9 files changed, 67 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bba9b03..f7f5be6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ add_subdirectory(doc)
########### next target ###############
set(ktron_SRCS
+ ksnakeduel_debug.cpp
renderer.cpp
object.cpp
snakepart.cpp
diff --git a/ksnakeduel_debug.cpp b/ksnakeduel_debug.cpp
new file mode 100644
index 0000000..4c85b7b
--- /dev/null
+++ b/ksnakeduel_debug.cpp
@@ -0,0 +1,23 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Laurent Montel <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "ksnakeduel_debug.h"
+Q_LOGGING_CATEGORY(KSNAKEDUEL_LOG, "ksnakeduel_smtp")
+
+
diff --git a/ksnakeduel_debug.h b/ksnakeduel_debug.h
new file mode 100644
index 0000000..d67fbb6
--- /dev/null
+++ b/ksnakeduel_debug.h
@@ -0,0 +1,27 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Laurent Montel <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KSNAKEDUEL_DEBUG_H
+#define KSNAKEDUEL_DEBUG_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(KSNAKEDUEL_LOG)
+
+#endif
+
diff --git a/ktron.cpp b/ktron.cpp
index 3fe7e8d..5387df3 100644
--- a/ktron.cpp
+++ b/ktron.cpp
@@ -216,7 +216,7 @@ void KTron::updateStatusbar() {
void KTron::blockPause(bool block)
{
- //kDebug() << "Setting pause button state to: " << !block;
+ //qCDebug(KSNAKEDUEL_LOG) << "Setting pause button state to: " << !block;
m_pauseButton->setEnabled(!block);
}
diff --git a/player.cpp b/player.cpp
index 1ab092b..1eb42e5 100644
--- a/player.cpp
+++ b/player.cpp
@@ -27,7 +27,7 @@
#include "snakepart.h"
#include "settings.h"
-#include <KDebug>
+#include "ksnakeduel_debug.h"
#include <KLocalizedString>
#include <KUser>
@@ -61,7 +61,7 @@ int Player::getX()
{
if (m_snakeParts.isEmpty())
{
- kDebug() << "Requested coordinate of nonexistent snake";
+ qCDebug(KSNAKEDUEL_LOG) << "Requested coordinate of nonexistent snake";
return 0;
}
@@ -72,7 +72,7 @@ int Player::getY()
{
if (m_snakeParts.isEmpty())
{
- kDebug() << "Requested coordinate of nonexistent snake";
+ qCDebug(KSNAKEDUEL_LOG) << "Requested coordinate of nonexistent snake";
return 0;
}
@@ -318,7 +318,7 @@ void Player::movePlayer()
if (crashed(newX, newY))
{
- //kDebug() << "Crashed at: (" << newX << ", " << newY << ")";
+ //qCDebug(KSNAKEDUEL_LOG) << "Crashed at: (" << newX << ", " << newY << ")";
m_alive = false;
}
@@ -348,7 +348,7 @@ void Player::movePlayer()
if (m_playField->getObjectAt(newX, newY)->getObjectType() == ObjectType::Item)
{
- //kDebug() << "Boom!";
+ //qCDebug(KSNAKEDUEL_LOG) << "Boom!";
emit fetchedItem(m_playerNumber, newX, newY);
}
diff --git a/playfield.cpp b/playfield.cpp
index ecbdee9..0619b20 100644
--- a/playfield.cpp
+++ b/playfield.cpp
@@ -23,7 +23,7 @@
#include "playfield.h"
-#include <KDebug>
+#include "ksnakeduel_debug.h"
PlayField::PlayField()
{
@@ -52,7 +52,7 @@ void PlayField::initialize()
Object *PlayField::getObjectAt(int x, int y)
{
if (x < 0 || x >= m_width || y < 0 || y >= m_height) {
- kDebug() << "Inexistent place accessed: (" << x << ", " << y << ")";
+ qCDebug(KSNAKEDUEL_LOG) << "Inexistent place accessed: (" << x << ", " << y << ")";
return 0;
}
@@ -76,7 +76,7 @@ int PlayField::getHeight()
void PlayField::setObjectAt(int x, int y, Object &o)
{
if (x < 0 || x >= m_width || y < 0 || y >= m_height) {
- kDebug() << "Inexistent place accessed: (" << x << ", " << y << ")";
+ qCDebug(KSNAKEDUEL_LOG) << "Inexistent place accessed: (" << x << ", " << y << ")";
return;
}
diff --git a/renderer.cpp b/renderer.cpp
index 59f8a8a..6233f0e 100644
--- a/renderer.cpp
+++ b/renderer.cpp
@@ -31,7 +31,7 @@
#include <KPixmapCache>
#include <QSvgRenderer>
-#include <KDebug>
+#include "ksnakeduel_debug.h"
#include <kfontutils.h>
#define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API
@@ -262,7 +262,7 @@ int Renderer::calculateOffsetY(int y)
void Renderer::drawPart(QPainter & painter, int x, int y, QString svgName)
{
- //kDebug() << "Drawing part: " << svgName;
+ //qCDebug(KSNAKEDUEL_LOG) << "Drawing part: " << svgName;
int xOffset = calculateOffsetX(x + 1);
int yOffset = calculateOffsetY(y + 1);
diff --git a/snakepart.cpp b/snakepart.cpp
index 9be6ce9..ed6e1cc 100644
--- a/snakepart.cpp
+++ b/snakepart.cpp
@@ -23,7 +23,7 @@
#include "snakepart.h"
-#include <KDebug>
+#include "ksnakeduel_debug.h"
SnakePart::SnakePart(int playerNumber) : Object(ObjectType::SnakePart)
{
diff --git a/tron.cpp b/tron.cpp
index 185dc13..ce94109 100644
--- a/tron.cpp
+++ b/tron.cpp
@@ -35,7 +35,7 @@
#include <QFocusEvent>
#include <QPixmap>
-#include <KDebug>
+#include "ksnakeduel_debug.h"
#include <KLocalizedString>
#include <KgDifficulty>
@@ -181,7 +181,7 @@ Player *Tron::getPlayer(int playerNr)
{
if (playerNr != 0 && playerNr != 1)
{
- kDebug() << "Inexistent player requested: " << playerNr;
+ qCDebug(KSNAKEDUEL_LOG) << "Inexistent player requested: " << playerNr;
return 0;
}
@@ -208,7 +208,7 @@ void Tron::startGame()
void Tron::itemHit(int playerNumber, int, int)
{
- //kDebug() << "Got Item Hit for " << playerNumber;
+ //qCDebug(KSNAKEDUEL_LOG) << "Got Item Hit for " << playerNumber;
newApple();
players[playerNumber]->setEnlargement(3);
@@ -234,7 +234,7 @@ void Tron::newApple()
y = rand() % pf.getHeight();
}
- //kDebug() << "Drawn apple at (" << x << ", " << y << ")";
+ //qCDebug(KSNAKEDUEL_LOG) << "Drawn apple at (" << x << ", " << y << ")";
apple.setType((int)(rand() % 3));