Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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

Add debug categories

parent 23da11e4
......@@ -29,6 +29,7 @@ include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMQtDeclareLoggingCategory)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
......@@ -50,6 +51,8 @@ set(kjumpingcube_SRCS
ai_box.cpp
)
ecm_qt_declare_logging_category(kjumpingcube_SRCS HEADER kjumpingcube_debug.h IDENTIFIER KJUMPINGCUBE_LOG CATEGORY_NAME org.kde.kjumpingcube)
qt5_add_resources(kjumpingcube_SRCS kjumpingcube.qrc)
ki18n_wrap_ui(kjumpingcube_SRCS settings.ui)
......@@ -87,4 +90,6 @@ ecm_install_icons(ICONS
DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor
)
install( FILES kjumpingcube.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -18,7 +18,7 @@
#include "ai_box.h"
//
#include <QDebug>
#include "kjumpingcube_debug.h"
#include <cstdio>
AI_Box::AI_Box (QObject * parent, int side)
......@@ -80,7 +80,7 @@ bool AI_Box::doMove (Player player, int index, MoveUndodata * undodata, QList<in
// Check for move legality.
Player oldOwner = m_owners[index];
if ((oldOwner != player) && (oldOwner != Nobody)) {
qDebug() << "ILLEGAL MOVE: player" << player << "old" << oldOwner
qCDebug(KJUMPINGCUBE_LOG) << "ILLEGAL MOVE: player" << player << "old" << oldOwner
<< "at" << index/m_side << index%m_side;
return false; // The move is not valid.
......@@ -225,17 +225,17 @@ void AI_Box::undoMove (MoveUndodata * undodata)
void AI_Box::copyPosition (Player player, bool isAI, int index)
{
#if AILog > 4
qDebug() << "AI_Box::copyPosition (" << player << "," << isAI << ")";
qCDebug(KJUMPINGCUBE_LOG) << "AI_Box::copyPosition (" << player << "," << isAI << ")";
printBox();
#endif
if (m_undoIndex >= m_undoList.count()) {
#if AILog > 4
qDebug() << "Call emptyPosition (" << m_nCubes << ")";
qCDebug(KJUMPINGCUBE_LOG) << "Call emptyPosition (" << m_nCubes << ")";
#endif
m_undoList.append (emptyPosition (m_nCubes));
}
#if AILog > 4
qDebug() << "m_undoIndex" << m_undoIndex << "m_undoList.count()" << m_undoList.count();
qCDebug(KJUMPINGCUBE_LOG) << "m_undoIndex" << m_undoIndex << "m_undoList.count()" << m_undoList.count();
#endif
Position * pos = m_undoList.at (m_undoIndex);
save (pos, player, isAI);
......@@ -269,7 +269,7 @@ bool AI_Box::undoPosition (Player & player)
player = pos->player;
}
#if AILog > 4
qDebug() << "AI_Box::undoPosition (player =" << player << "), m_undoIndex" << m_undoIndex << "UNDONE POSITION";
qCDebug(KJUMPINGCUBE_LOG) << "AI_Box::undoPosition (player =" << player << "), m_undoIndex" << m_undoIndex << "UNDONE POSITION";
printBox();
#endif
return (m_undoIndex > 1);
......@@ -286,7 +286,7 @@ bool AI_Box::redoPosition (Player & player, bool & isAI, int & index)
m_undoIndex++;
}
#if AILog > 4
qDebug() << "AI_Box::redoPosition (player =" << player << "), m_undoIndex" << m_undoIndex << "REDONE POSITION";
qCDebug(KJUMPINGCUBE_LOG) << "AI_Box::redoPosition (player =" << player << "), m_undoIndex" << m_undoIndex << "REDONE POSITION";
printBox();
#endif
return (m_undoIndex < m_redoLimit);
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,7 +38,7 @@ KCubeBoxWidget::KCubeBoxWidget (const int d, QWidget *parent)
m_side (d),
m_popup (new QLabel (this))
{
qDebug() << "CONSTRUCT KCubeBoxWidget: side" << m_side;
qCDebug(KJUMPINGCUBE_LOG) << "CONSTRUCT KCubeBoxWidget: side" << m_side;
cubes.clear();
init();
}
......@@ -49,7 +49,7 @@ KCubeBoxWidget::~KCubeBoxWidget()
bool KCubeBoxWidget::loadSettings()
{
qDebug() << "LOAD VIEW SETTINGS";
qCDebug(KJUMPINGCUBE_LOG) << "LOAD VIEW SETTINGS";
bool reColorCubes = ((color1 != Prefs::color1()) ||
(color2 != Prefs::color2()) ||
(color0 != Prefs::color0()));
......@@ -165,7 +165,7 @@ bool KCubeBoxWidget::checkClick (int x, int y)
// IDW TODO - Write a new mouse-click event for KCubeBoxWidget? Remove the
// one that KCubeWidget has?
*/
qDebug() << "Emit mouseClick (" << x << y << ")";
qCDebug(KJUMPINGCUBE_LOG) << "Emit mouseClick (" << x << y << ")";
emit mouseClick (x, y);
return false;
}
......@@ -347,14 +347,14 @@ void KCubeBoxWidget::reCalculateGraphics (const int w, const int h)
{
int boxSize = qMin(w, h);
int frameWidth = boxSize / 30;
// qDebug() << "boxSize" << boxSize << "frameWidth" << frameWidth;
// qCDebug(KJUMPINGCUBE_LOG) << "boxSize" << boxSize << "frameWidth" << frameWidth;
boxSize = boxSize - (2 * frameWidth);
cubeSize = (boxSize / m_side);
boxSize = (cubeSize * m_side);
topLeft.setX ((w - boxSize)/2);
topLeft.setY ((h - boxSize)/2);
// qDebug() << "Dimension:" << m_side << "cubeSize:" << cubeSize << "topLeft:" << topLeft;
// qCDebug(KJUMPINGCUBE_LOG) << "Dimension:" << m_side << "cubeSize:" << cubeSize << "topLeft:" << topLeft;
makeSVGBackground (w, h);
makeSVGCubes (cubeSize);
for (int x = 0; x < m_side; x++) {
......
org.kde.kjumpingcube kjumpingcube IDENTIFIER [KJUMPINGCUBE_LOG]
......@@ -41,7 +41,7 @@
KJumpingCube::KJumpingCube()
{
// Make a KCubeBoxWidget with the user's currently preferred number of cubes.
qDebug() << "KJumpingCube::KJumpingCube() CONSTRUCTOR";
qCDebug(KJUMPINGCUBE_LOG) << "KJumpingCube::KJumpingCube() CONSTRUCTOR";
m_view = new KCubeBoxWidget (Prefs::cubeDim(), this);
m_game = new Game (Prefs::cubeDim(), m_view, this);
m_view->makeStatusPixmaps (30);
......@@ -139,7 +139,7 @@ void KJumpingCube::initKAction() {
action = KStandardAction::preferences (m_game, SLOT(showSettingsDialog()),
actionCollection());
qDebug() << "PREFERENCES ACTION is" << action->objectName();
qCDebug(KJUMPINGCUBE_LOG) << "PREFERENCES ACTION is" << action->objectName();
action->setIconText (i18n("Settings"));
action = KStandardGameAction::quit (this, SLOT (close()), this);
......@@ -151,7 +151,7 @@ void KJumpingCube::initKAction() {
void KJumpingCube::changeButton (bool enabled, bool stop,
const QString & caption)
{
qDebug() << "KJumpingCube::changeButton (" << enabled << stop << caption;
qCDebug(KJUMPINGCUBE_LOG) << "KJumpingCube::changeButton (" << enabled << stop << caption;
if (enabled && stop) { // Red look (stop something).
actionButton->setStyleSheet (buttonLook.arg("rgb(210, 0, 0)")
.arg("rgb(180, 0, 0)"));
......
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