Commit d5fa914a authored by Laurent Montel's avatar Laurent Montel 😁

Use QCDebug

parent f47a8849
......@@ -47,6 +47,7 @@ add_subdirectory(doc)
########### next target ###############
set(ktron_SRCS
ksnakeduel_debug.cpp
renderer.cpp
object.cpp
snakepart.cpp
......
/* This file is part of the KDE project
Copyright (C) 2014 Laurent Montel <montel@kde.org>
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")
/* This file is part of the KDE project
Copyright (C) 2014 Laurent Montel <montel@kde.org>
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
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -23,7 +23,7 @@
#include "snakepart.h"
#include <KDebug>
#include "ksnakeduel_debug.h"
SnakePart::SnakePart(int playerNumber) : Object(ObjectType::SnakePart)
{
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment