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

Port to QCDebug

parent 07331a53
########### next target ############### ########### next target ###############
set(kgoldrunner_SRCS set(kgoldrunner_SRCS
kgoldrunner_debug.cpp
kgrview.cpp kgrview.cpp
kgrscene.cpp kgrscene.cpp
kgrsprite.cpp kgrsprite.cpp
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
#include <kconfig.h> #include <kconfig.h>
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <QDebug> #include "kgoldrunner_debug.h"
#include <QDebug> #include "kgoldrunner_debug.h"
#include <ktoolbar.h> #include <ktoolbar.h>
#include <kmenubar.h> #include <kmenubar.h>
...@@ -166,20 +166,20 @@ KGoldrunner::KGoldrunner() ...@@ -166,20 +166,20 @@ KGoldrunner::KGoldrunner()
// Do NOT paint main widget yet (title bar, menu, blank playfield). // Do NOT paint main widget yet (title bar, menu, blank playfield).
// Instead, queue a call to the "KGoldrunner_2" constructor extension. // Instead, queue a call to the "KGoldrunner_2" constructor extension.
QMetaObject::invokeMethod (this, "KGoldrunner_2", Qt::QueuedConnection); QMetaObject::invokeMethod (this, "KGoldrunner_2", Qt::QueuedConnection);
//qDebug() << "QMetaObject::invokeMethod (this, \"KGoldrunner_2\") done ... "; //qCDebug(KGOLDRUNNER_LOG) << "QMetaObject::invokeMethod (this, \"KGoldrunner_2\") done ... ";
//qDebug() << "1st scan of event-queue ..."; //qCDebug(KGOLDRUNNER_LOG) << "1st scan of event-queue ...";
} }
void KGoldrunner::KGoldrunner_2() void KGoldrunner::KGoldrunner_2()
{ {
//qDebug() << "Entered constructor extension ..."; //qCDebug(KGOLDRUNNER_LOG) << "Entered constructor extension ...";
// Queue a call to the "initGame" method. This renders and paints the // Queue a call to the "initGame" method. This renders and paints the
// initial graphics, but only AFTER the initial main-window resize events // initial graphics, but only AFTER the initial main-window resize events
// have been seen and the final SVG scale is known. // have been seen and the final SVG scale is known.
QMetaObject::invokeMethod (game, "initGame", Qt::QueuedConnection); QMetaObject::invokeMethod (game, "initGame", Qt::QueuedConnection);
//qDebug() << "QMetaObject::invokeMethod (game, \"initGame\") done ... "; //qCDebug(KGOLDRUNNER_LOG) << "QMetaObject::invokeMethod (game, \"initGame\") done ... ";
//qDebug() << "2nd scan of event-queue ..."; //qCDebug(KGOLDRUNNER_LOG) << "2nd scan of event-queue ...";
} }
KGoldrunner::~KGoldrunner() KGoldrunner::~KGoldrunner()
...@@ -778,7 +778,7 @@ void KGoldrunner::setEditMenu (bool on_off) ...@@ -778,7 +778,7 @@ void KGoldrunner::setEditMenu (bool on_off)
if (on_off){ if (on_off){
// Set the editToolbar icons to the current tile-size. // Set the editToolbar icons to the current tile-size.
//qDebug() << "ToolBar icon size:" << scene->tileSize (); //qCDebug(KGOLDRUNNER_LOG) << "ToolBar icon size:" << scene->tileSize ();
toolBar ("editToolbar")->setIconSize (scene->tileSize ()); toolBar ("editToolbar")->setIconSize (scene->tileSize ());
// Set the editToolbar icons up with pixmaps of the current theme. // Set the editToolbar icons up with pixmaps of the current theme.
...@@ -830,7 +830,7 @@ void KGoldrunner::saveProperties (KConfigGroup & /* config - unused */) ...@@ -830,7 +830,7 @@ void KGoldrunner::saveProperties (KConfigGroup & /* config - unused */)
// config file. Anything you write here will be available // config file. Anything you write here will be available
// later when this app is restored. // later when this app is restored.
//qDebug() << "I am in KGoldrunner::saveProperties."; //qCDebug(KGOLDRUNNER_LOG) << "I am in KGoldrunner::saveProperties.";
} }
void KGoldrunner::readProperties (const KConfigGroup & /* config - unused */) void KGoldrunner::readProperties (const KConfigGroup & /* config - unused */)
...@@ -840,7 +840,7 @@ void KGoldrunner::readProperties (const KConfigGroup & /* config - unused */) ...@@ -840,7 +840,7 @@ void KGoldrunner::readProperties (const KConfigGroup & /* config - unused */)
// the app is being restored. Read in here whatever you wrote // the app is being restored. Read in here whatever you wrote
// in 'saveProperties' // in 'saveProperties'
//qDebug() << "I am in KGoldrunner::readProperties."; //qCDebug(KGOLDRUNNER_LOG) << "I am in KGoldrunner::readProperties.";
} }
void KGoldrunner::optionsConfigureKeys() void KGoldrunner::optionsConfigureKeys()
......
/* 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 "kgoldrunner_debug.h"
Q_LOGGING_CATEGORY(KGOLDRUNNER_LOG, "log_kgoldrunner")
/* 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 KGOLDRUNNER_DEBUG_H
#define KGOLDRUNNER_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KGOLDRUNNER_LOG)
#endif
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#define KGRDEBUG_H #define KGRDEBUG_H
static int dbgLevel = 0; // Local to file where kgrdebug.h is included. static int dbgLevel = 0; // Local to file where kgrdebug.h is included.
#include <KDebug> #include "kgoldrunner_debug.h"
#define dbk kDebug() #define dbk qCDebug(KGOLDRUNNER_LOG)
#define dbk1 if(dbgLevel>=1)kDebug() #define dbk1 if(dbgLevel>=1)qCDebug(KGOLDRUNNER_LOG)
#define dbk2 if(dbgLevel>=2)kDebug() #define dbk2 if(dbgLevel>=2)qCDebug(KGOLDRUNNER_LOG)
#define dbk3 if(dbgLevel>=3)kDebug() #define dbk3 if(dbgLevel>=3)qCDebug(KGOLDRUNNER_LOG)
#define dbo printf( #define dbo printf(
#define dbo1 if(dbgLevel>=1)printf( #define dbo1 if(dbgLevel>=1)printf(
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <ctype.h> #include <ctype.h>
#include <QTimer> #include <QTimer>
#include <KDebug> #include "kgoldrunner_debug.h"
KGrEditor::KGrEditor (KGrView * theView, KGrEditor::KGrEditor (KGrView * theView,
const QString & theSystemDir, const QString & theSystemDir,
...@@ -138,7 +138,7 @@ bool KGrEditor::updateLevel (int pGameIndex, int level) ...@@ -138,7 +138,7 @@ bool KGrEditor::updateLevel (int pGameIndex, int level)
if (level < 0) if (level < 0)
level = 0; level = 0;
int selectedLevel = selectLevel (SL_UPDATE, level, gameIndex); int selectedLevel = selectLevel (SL_UPDATE, level, gameIndex);
kDebug() << "Selected" << gameList.at(gameIndex)->name qCDebug(KGOLDRUNNER_LOG) << "Selected" << gameList.at(gameIndex)->name
<< "level" << selectedLevel; << "level" << selectedLevel;
if (selectedLevel == 0) { if (selectedLevel == 0) {
mouseDisabled = false; mouseDisabled = false;
...@@ -162,7 +162,7 @@ void KGrEditor::loadEditLevel (int lev) ...@@ -162,7 +162,7 @@ void KGrEditor::loadEditLevel (int lev)
{ {
KGrLevelData d; KGrLevelData d;
kDebug() << "gameIndex" << gameIndex; qCDebug(KGOLDRUNNER_LOG) << "gameIndex" << gameIndex;
// If system game or ENDE screen, choose system dir, else choose user dir. // If system game or ENDE screen, choose system dir, else choose user dir.
const QString dir = ((gameList.at(gameIndex)->owner == SYSTEM) || const QString dir = ((gameList.at(gameIndex)->owner == SYSTEM) ||
(lev == 0)) ? systemDataDir : userDataDir; (lev == 0)) ? systemDataDir : userDataDir;
...@@ -888,7 +888,7 @@ void KGrEditor::doEdit (int button) ...@@ -888,7 +888,7 @@ void KGrEditor::doEdit (int button)
// Mouse button down: start making changes. // Mouse button down: start making changes.
int i, j; int i, j;
emit getMousePos (i, j); emit getMousePos (i, j);
kDebug() << "Button" << button << "at" << i << j; qCDebug(KGOLDRUNNER_LOG) << "Button" << button << "at" << i << j;
switch (button) { switch (button) {
case Qt::LeftButton: case Qt::LeftButton:
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <QDir> #include <QDir>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDebug> #include "kgoldrunner_debug.h"
KGrGameIO::KGrGameIO (QWidget * pView) KGrGameIO::KGrGameIO (QWidget * pView)
: :
...@@ -55,7 +55,7 @@ IOStatus KGrGameIO::fetchGameListData ...@@ -55,7 +55,7 @@ IOStatus KGrGameIO::fetchGameListData
filePath = dir + filename; filePath = dir + filename;
KGrGameData * g = initGameData (o); KGrGameData * g = initGameData (o);
gameList.append (g); gameList.append (g);
// //qDebug()<< "GAME PATH:" << filePath; // //qCDebug(KGOLDRUNNER_LOG)<< "GAME PATH:" << filePath;
openFile.setFileName (filePath); openFile.setFileName (filePath);
...@@ -95,7 +95,7 @@ IOStatus KGrGameIO::fetchGameListData ...@@ -95,7 +95,7 @@ IOStatus KGrGameIO::fetchGameListData
g->nLevels = fields.at (0).toInt(); g->nLevels = fields.at (0).toInt();
g->rules = fields.at (1).at (0); g->rules = fields.at (1).at (0);
g->prefix = fields.at (2); g->prefix = fields.at (2);
// //qDebug() << "Levels:" << g->nLevels << "Rules:" << g->rules << // //qCDebug(KGOLDRUNNER_LOG) << "Levels:" << g->nLevels << "Rules:" << g->rules <<
// "Prefix:" << g->prefix; // "Prefix:" << g->prefix;
if (kgr3Format) { if (kgr3Format) {
...@@ -117,7 +117,7 @@ IOStatus KGrGameIO::fetchGameListData ...@@ -117,7 +117,7 @@ IOStatus KGrGameIO::fetchGameListData
gameName = removeNewline (textLine.right (textLine.size() - n)); gameName = removeNewline (textLine.right (textLine.size() - n));
g->name = i18n (gameName.constData()); g->name = i18n (gameName.constData());
} }
// //qDebug() << "Skill:" << g->skill << "Name:" << g->name; // //qCDebug(KGOLDRUNNER_LOG) << "Skill:" << g->skill << "Name:" << g->name;
// Loop to accumulate lines of about-data. If kgr3Format, exit on // Loop to accumulate lines of about-data. If kgr3Format, exit on
// EOF or 'L' line. If not kgr3Format, exit on EOF or numeric line. // EOF or 'L' line. If not kgr3Format, exit on EOF or numeric line.
...@@ -132,7 +132,7 @@ IOStatus KGrGameIO::fetchGameListData ...@@ -132,7 +132,7 @@ IOStatus KGrGameIO::fetchGameListData
g->about.append (textLine); g->about.append (textLine);
} }
g->about = removeNewline (g->about); // Remove final '\n'. g->about = removeNewline (g->about); // Remove final '\n'.
// //qDebug() << "Info about: [" + g->about + "]"; // //qCDebug(KGOLDRUNNER_LOG) << "Info about: [" + g->about + "]";
if ((! kgr3Format) && (c != '\0')) { if ((! kgr3Format) && (c != '\0')) {
filePath = dir + filename; filePath = dir + filename;
...@@ -152,7 +152,7 @@ bool KGrGameIO::readLevelData (const QString & dir, ...@@ -152,7 +152,7 @@ bool KGrGameIO::readLevelData (const QString & dir,
const QString & prefix, const QString & prefix,
const int levelNo, KGrLevelData & d) const int levelNo, KGrLevelData & d)
{ {
//qDebug() << "dir" << dir << "Level" << prefix << levelNo; //qCDebug(KGOLDRUNNER_LOG) << "dir" << dir << "Level" << prefix << levelNo;
QString filePath; QString filePath;
IOStatus stat = fetchLevelData IOStatus stat = fetchLevelData
(dir, prefix, levelNo, d, filePath); (dir, prefix, levelNo, d, filePath);
...@@ -190,7 +190,7 @@ IOStatus KGrGameIO::fetchLevelData ...@@ -190,7 +190,7 @@ IOStatus KGrGameIO::fetchLevelData
d.name = ""; // Level name (optional). d.name = ""; // Level name (optional).
d.hint = ""; // Level hint (optional). d.hint = ""; // Level hint (optional).
// //qDebug()<< "LEVEL PATH:" << filePath; // //qCDebug(KGOLDRUNNER_LOG)<< "LEVEL PATH:" << filePath;
openFile.setFileName (filePath); openFile.setFileName (filePath);
// Check that the level-file exists. // Check that the level-file exists.
...@@ -240,9 +240,9 @@ IOStatus KGrGameIO::fetchLevelData ...@@ -240,9 +240,9 @@ IOStatus KGrGameIO::fetchLevelData
} }
} }
// //qDebug() << "Level:" << level << "Layout length:" << d.layout.size(); // //qCDebug(KGOLDRUNNER_LOG) << "Level:" << level << "Layout length:" << d.layout.size();
// //qDebug() << "Name:" << "[" + d.name + "]"; // //qCDebug(KGOLDRUNNER_LOG) << "Name:" << "[" + d.name + "]";
// //qDebug() << "Hint:" << "[" + d.hint + "]"; // //qCDebug(KGOLDRUNNER_LOG) << "Hint:" << "[" + d.hint + "]";
openFile.close(); openFile.close();
return (result); return (result);
...@@ -284,7 +284,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line) ...@@ -284,7 +284,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line)
} }
} }
// //qDebug() << "Raw line:" << line; // //qCDebug(KGOLDRUNNER_LOG) << "Raw line:" << line;
if (line.size() <= 0) { if (line.size() <= 0) {
// Return a '\0' byte if end-of-file. // Return a '\0' byte if end-of-file.
return ('\0'); return ('\0');
...@@ -293,7 +293,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line) ...@@ -293,7 +293,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line)
// In KGr 3 format, strip off leading and trailing syntax. // In KGr 3 format, strip off leading and trailing syntax.
if (line.startsWith ("// ")) { if (line.startsWith ("// ")) {
line = line.right (line.size() - 3); line = line.right (line.size() - 3);
// //qDebug() << "Stripped comment is:" << line; // //qCDebug(KGOLDRUNNER_LOG) << "Stripped comment is:" << line;
} }
else { else {
if (line.startsWith (" i18n(\"")) { if (line.startsWith (" i18n(\"")) {
...@@ -314,7 +314,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line) ...@@ -314,7 +314,7 @@ char KGrGameIO::getALine (const bool kgr3, QByteArray & line)
else if (line.endsWith ("\"\n")) { else if (line.endsWith ("\"\n")) {
line = line.left (line.size() - 2); line = line.left (line.size() - 2);
} }
// //qDebug() << "Stripped syntax is:" << line; // //qCDebug(KGOLDRUNNER_LOG) << "Stripped syntax is:" << line;
} }
// In Kgr 3 format, return the first byte if not end-of-file. // In Kgr 3 format, return the first byte if not end-of-file.
c = line.at (0); c = line.at (0);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "kgrlevelgrid.h" #include "kgrlevelgrid.h"
#include "kgrrunner.h" #include "kgrrunner.h"
#include <QDebug> #include "kgoldrunner_debug.h"
#include <KMessageBox> // TODO - Remove. #include <KMessageBox> // TODO - Remove.
#include <KRandomSequence> #include <KRandomSequence>
...@@ -71,7 +71,7 @@ KGrLevelPlayer::~KGrLevelPlayer() ...@@ -71,7 +71,7 @@ KGrLevelPlayer::~KGrLevelPlayer()
{ {
qDeleteAll(dugBricks); qDeleteAll(dugBricks);
dugBricks.clear(); //TODO: necessary? dugBricks.clear(); //TODO: necessary?
//qDebug() << "LEVEL PLAYER BEING DELETED."; //qCDebug(KGOLDRUNNER_LOG) << "LEVEL PLAYER BEING DELETED.";
playerCount--; playerCount--;
// TODO - Remove this debugging code. // TODO - Remove this debugging code.
...@@ -806,7 +806,7 @@ void KGrLevelPlayer::tick (bool missed, int scaledTime) ...@@ -806,7 +806,7 @@ void KGrLevelPlayer::tick (bool missed, int scaledTime)
// Queued connection ensures KGrGame slot runs AFTER return from here. // Queued connection ensures KGrGame slot runs AFTER return from here.
emit endLevel (status); emit endLevel (status);
//qDebug() << "END OF LEVEL"; //qCDebug(KGOLDRUNNER_LOG) << "END OF LEVEL";
return; return;
} }
...@@ -1158,7 +1158,7 @@ void KGrLevelPlayer::killHero() ...@@ -1158,7 +1158,7 @@ void KGrLevelPlayer::killHero()
record (1, ACTION_CODE + KILL_HERO); record (1, ACTION_CODE + KILL_HERO);
emit endLevel (DEAD); emit endLevel (DEAD);
//qDebug() << "END OF LEVEL"; //qCDebug(KGOLDRUNNER_LOG) << "END OF LEVEL";
} }
} }
......
...@@ -300,7 +300,7 @@ public: ...@@ -300,7 +300,7 @@ public:
* is paused and the KConfig file contains group Debugging with setting * is paused and the KConfig file contains group Debugging with setting
* DebuggingShortcuts=true. The main actions are to do timer steps one at * DebuggingShortcuts=true. The main actions are to do timer steps one at
* a time, activate/deactivate a bug-fix or new-feature patch dynamically, * a time, activate/deactivate a bug-fix or new-feature patch dynamically,
* activate/deactivate logging output from fprintf or kDebug() dynamically, * activate/deactivate logging output from fprintf or qCDebug(KGOLDRUNNER_LOG) dynamically,
* print the status of a cell pointed to by the mouse and print the status * print the status of a cell pointed to by the mouse and print the status
* of the hero or an enemy. See the code in file kgoldrunner.cpp, at the * of the hero or an enemy. See the code in file kgoldrunner.cpp, at the
* end of KGoldrunner::setupActions() for details of codes and keystrokes. * end of KGoldrunner::setupActions() for details of codes and keystrokes.
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <KgThemeSelector> #include <KgThemeSelector>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDebug> #include "kgoldrunner_debug.h"
#include <QString> #include <QString>
#include "kgrglobals.h" #include "kgrglobals.h"
...@@ -98,7 +98,7 @@ void KGrRenderer::matchThemes (const KgTheme * currentSetTheme) ...@@ -98,7 +98,7 @@ void KGrRenderer::matchThemes (const KgTheme * currentSetTheme)
void KGrRenderer::currentThemeChanged (const KgTheme* currentSetTheme) void KGrRenderer::currentThemeChanged (const KgTheme* currentSetTheme)
{ {
qDebug() << "KGrRenderer::currentThemeChanged()" << currentSetTheme->name(); qCDebug(KGOLDRUNNER_LOG) << "KGrRenderer::currentThemeChanged()" << currentSetTheme->name();
matchThemes (currentSetTheme); matchThemes (currentSetTheme);
m_scene->changeTheme(); m_scene->changeTheme();
...@@ -274,7 +274,7 @@ QString KGrRenderer::getBackgroundKey (const int level) ...@@ -274,7 +274,7 @@ QString KGrRenderer::getBackgroundKey (const int level)
} }
} }
qDebug() << "BACKGROUND pixmap key" << pixmapKey; qCDebug(KGOLDRUNNER_LOG) << "BACKGROUND pixmap key" << pixmapKey;
return pixmapKey; return pixmapKey;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <QObject> #include <QObject>
#include <QList> #include <QList>
#include <KDebug> #include "kgoldrunner_debug.h"
class KGrLevelGrid; class KGrLevelGrid;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "kgrrulebook.h" #include "kgrrulebook.h"
#include "kgrlevelplayer.h" #include "kgrlevelplayer.h"
#include <KDebug> #include "kgoldrunner_debug.h"
KGrRunner::KGrRunner (KGrLevelPlayer * pLevelPlayer, KGrLevelGrid * pGrid, KGrRunner::KGrRunner (KGrLevelPlayer * pLevelPlayer, KGrLevelGrid * pGrid,
int i, int j, const int pSpriteId, int i, int j, const int pSpriteId,
...@@ -74,7 +74,7 @@ void KGrRunner::getRules() ...@@ -74,7 +74,7 @@ void KGrRunner::getRules()
pointsPerCell = rules->pointsPerCell(); pointsPerCell = rules->pointsPerCell();
turnAnywhere = rules->turnAnywhere(); turnAnywhere = rules->turnAnywhere();
if (spriteId < 1) { if (spriteId < 1) {
kDebug() << "pointsPerCell" << pointsPerCell qCDebug(KGOLDRUNNER_LOG) << "pointsPerCell" << pointsPerCell
<< "turnAnywhere" << turnAnywhere; << "turnAnywhere" << turnAnywhere;
} }
} }
...@@ -201,9 +201,9 @@ KGrHero::KGrHero (KGrLevelPlayer * pLevelPlayer, KGrLevelGrid * pGrid, ...@@ -201,9 +201,9 @@ KGrHero::KGrHero (KGrLevelPlayer * pLevelPlayer, KGrLevelGrid * pGrid,
KGrRunner (pLevelPlayer, pGrid, i, j, pSpriteId, pRules, 0), KGrRunner (pLevelPlayer, pGrid, i, j, pSpriteId, pRules, 0),
nuggets (0) // KGrLevelPlayer object will call hero->setNuggets(). nuggets (0) // KGrLevelPlayer object will call hero->setNuggets().
{ {
kDebug() << "THE HERO IS BORN at" << i << j << "sprite ID" << pSpriteId; qCDebug(KGOLDRUNNER_LOG) << "THE HERO IS BORN at" << i << j << "sprite ID" << pSpriteId;
rules->getHeroTimes (runTime, fallTime, enemyFallTime, trapTime); rules->getHeroTimes (runTime, fallTime, enemyFallTime, trapTime);
kDebug() << "Hero run time" << runTime << "fall time" << fallTime; qCDebug(KGOLDRUNNER_LOG) << "Hero run time" << runTime << "fall time" << fallTime;
interval = runTime; interval = runTime;
} }
...@@ -305,7 +305,7 @@ HeroStatus KGrHero::run (const int scaledTime) ...@@ -305,7 +305,7 @@ HeroStatus KGrHero::run (const int scaledTime)
bool KGrHero::dig (const Direction diggingDirection, int & i, int & j) bool KGrHero::dig (const Direction diggingDirection, int & i, int & j)
{ {
QString text = (diggingDirection == DIG_LEFT) ? "LEFT" : "RIGHT"; QString text = (diggingDirection == DIG_LEFT) ? "LEFT" : "RIGHT";
// kDebug() << "Start digging" << text; // qCDebug(KGOLDRUNNER_LOG) << "Start digging" << text;
Flags moves = grid->heroMoves (gridI, gridJ); Flags moves = grid->heroMoves (gridI, gridJ);
bool result = false; bool result = false;
...@@ -324,7 +324,7 @@ bool KGrHero::dig (const Direction diggingDirection, int & i, int & j) ...@@ -324,7 +324,7 @@ bool KGrHero::dig (const Direction diggingDirection, int & i, int & j)
// The place to dig must be clear and there must be a brick under it. // The place to dig must be clear and there must be a brick under it.
char aboveBrick = grid->cellType (gridI + relativeI, gridJ); char aboveBrick = grid->cellType (gridI + relativeI, gridJ);
// kDebug() << "aboveBrick =" << aboveBrick; // qCDebug(KGOLDRUNNER_LOG) << "aboveBrick =" << aboveBrick;
if ((grid->cellType (gridI + relativeI, gridJ + 1) == BRICK) && if ((grid->cellType (gridI + relativeI, gridJ + 1) == BRICK) &&
((aboveBrick == FREE) || (aboveBrick == HOLE))) { ((aboveBrick == FREE) || (aboveBrick == HOLE))) {
...@@ -363,10 +363,10 @@ KGrEnemy::KGrEnemy (KGrLevelPlayer * pLevelPlayer, KGrLevelGrid * pGrid, ...@@ -363,10 +363,10 @@ KGrEnemy::KGrEnemy (KGrLevelPlayer * pLevelPlayer, KGrLevelGrid * pGrid,
rulesType = rules->getEnemyTimes (runTime, fallTime, trapTime); rulesType = rules->getEnemyTimes (runTime, fallTime, trapTime);
enemyFallTime = fallTime; enemyFallTime = fallTime;
interval = runTime; interval = runTime;
kDebug() << "ENEMY" << pSpriteId << "IS BORN at" << i << j; qCDebug(KGOLDRUNNER_LOG) << "ENEMY" << pSpriteId << "IS BORN at" << i << j;
if (pSpriteId < 2) { if (pSpriteId < 2) {
kDebug() << "Enemy run time " << runTime << "fall time" << fallTime; qCDebug(KGOLDRUNNER_LOG) << "Enemy run time " << runTime << "fall time" << fallTime;
kDebug() << "Enemy trap time" << trapTime << "Rules type" << rulesType; qCDebug(KGOLDRUNNER_LOG) << "Enemy trap time" << trapTime << "Rules type" << rulesType;
} }
t.start(); // IDW t.start(); // IDW
} }
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * along with this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************/ ****************************************************************************/
#include <QDebug> #include "kgoldrunner_debug.h"
#include <QDebug> #include "kgoldrunner_debug.h"
#include <KLocalizedString> #include <KLocalizedString>
...@@ -106,7 +106,7 @@ KGrScene::~KGrScene() ...@@ -106,7 +106,7 @@ KGrScene::~KGrScene()
void KGrScene::redrawScene () void KGrScene::redrawScene ()
{ {
qDebug() << "REDRAW: m_sizeChanged" << m_sizeChanged << "m_themeChanged" << m_themeChanged; qCDebug(KGOLDRUNNER_LOG) << "REDRAW: m_sizeChanged" << m_sizeChanged << "m_themeChanged" << m_themeChanged;
bool redrawToolbar = false; bool redrawToolbar = false;
if (m_sizeChanged) { if (m_sizeChanged) {
// Calculate what size of tile will fit in the view. // Calculate what size of tile will fit in the view.
...@@ -116,7 +116,7 @@ void KGrScene::redrawScene () ...@@ -116,7 +116,7 @@ void KGrScene::redrawScene ()
m_topLeftX = (size.width() - m_tilesWide * tileSize)/2.0; m_topLeftX = (size.width() - m_tilesWide * tileSize)/2.0;
m_topLeftY = (size.height() - m_tilesHigh * tileSize)/2.0; m_topLeftY = (size.height() - m_tilesHigh * tileSize)/2.0;
setSceneRect (0, 0, size.width(), size.height()); setSceneRect (0, 0, size.width(), size.height());
qDebug() << "SIZE" << size << "TL" << m_topLeftX << m_topLeftY << "TILE" << tileSize << "was" << m_tileSize << m_toolbarTileSize; qCDebug(KGOLDRUNNER_LOG) << "SIZE" << size << "TL" << m_topLeftX << m_topLeftY << "TILE" << tileSize << "was" << m_tileSize << m_toolbarTileSize;
// Make the fade-out/fade-in rectangle cover the playing area. // Make the fade-out/fade-in rectangle cover the playing area.
m_spotlight->setRect (m_topLeftX + 2 * tileSize - 1, m_spotlight->setRect (m_topLeftX + 2 * tileSize - 1,
...@@ -418,7 +418,7 @@ void KGrScene::drawFrame() ...@@ -418,7 +418,7 @@ void KGrScene::drawFrame()
m_topLeftY + (2 * m_tileSize) - (3 * w), m_topLeftY + (2 * m_tileSize) - (3 * w),
FIELDWIDTH * m_tileSize + 6 * w, FIELDWIDTH * m_tileSize + 6 * w,
FIELDHEIGHT * m_tileSize + 6 * w); FIELDHEIGHT * m_tileSize + 6 * w);
//qDebug() << "FRAME WIDTH" << w << "tile size" << m_tileSize << "rectangle" << m_frame->rect(); //qCDebug(KGOLDRUNNER_LOG) << "FRAME WIDTH" << w << "tile size" << m_tileSize << "rectangle" << m_frame->rect();
QPen pen = QPen (m_renderer->textColor()); QPen pen = QPen (m_renderer->textColor());