Commit 7bc1862e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to qDebug categories

parent 8c065a42
......@@ -35,6 +35,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMAddAppIcon)
include(ECMSetupVersion)
include(ECMQtDeclareLoggingCategory)
if (${KF5Config_VERSION} STRGREATER "5.56.0")
add_definitions(-DQT_NO_FOREACH)
......@@ -63,7 +64,7 @@ set(katomic_SRCS
chooselevelsetdialog.cpp)
ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX KATOMIC VERSION_HEADER katomic_version.h)
ecm_qt_declare_logging_category(katomic_SRCS HEADER katomic_debug.h IDENTIFIER KATOMIC_LOG CATEGORY_NAME org.kde.kdegames.katomic)
kconfig_add_kcfg_files(katomic_SRCS prefs.kcfgc)
ki18n_wrap_ui(katomic_SRCS levelsetwidget.ui)
......@@ -98,4 +99,6 @@ if(NOT WIN32)
install(PROGRAMS katomic-levelset-upd.pl DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(FILES katomic-levelset.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
endif(NOT WIN32)
install( FILES katomic.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR} )
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -32,7 +32,7 @@
#include <KLocalizedString>
#include <kconfig.h>
#include <qfiledialog.h>
#include <QDebug>
#include "katomic_debug.h"
GameWidget::GameWidget ( const QString& levelSet, QWidget *parent )
: QWidget( parent ), m_allowAnyLevelSwitch( false ), m_moves(0), m_level(0)
......@@ -85,7 +85,7 @@ bool GameWidget::setLevelSet(const QString& levelSet)
{
if (m_levelSet.name() == levelSet)
{
//qDebug() << "level set named" << levelSet << "is already loaded";
//qCDebug(KATOMIC_LOG) << "level set named" << levelSet << "is already loaded";
return true;
}
......@@ -93,7 +93,7 @@ bool GameWidget::setLevelSet(const QString& levelSet)
if (!res)
{
KMessageBox::error(this, i18n("Failed to load level set \"%1\". Check if it is installed on your computer.", levelSet));
//qDebug() << "failed to load levelset" << levelSet;
//qCDebug(KATOMIC_LOG) << "failed to load levelset" << levelSet;
return false;
}
......@@ -189,7 +189,7 @@ void GameWidget::switchToLevel (int l)
saveLastPlayedLevel();
}
else {
//qDebug() << "failed to load level" << l;
//qCDebug(KATOMIC_LOG) << "failed to load level" << l;
}
}
......@@ -220,7 +220,7 @@ void GameWidget::loadGame()
QString levelSet = gr.readEntry("LevelSet");
if (levelSet.isEmpty())
{
//qDebug() << "note: savegame file doesn't contain info about levelset, assuming default one";
//qCDebug(KATOMIC_LOG) << "note: savegame file doesn't contain info about levelset, assuming default one";
levelSet = QStringLiteral(DEFAULT_LEVELSET_NAME);
}
......@@ -294,7 +294,7 @@ int GameWidget::lastPlayedLevel() const
KConfigGroup grp(cfg, m_levelSet.name());
int lastPlayed = grp.readEntry("LastPlayedLevel", 1);
lastPlayed = qMax(1, lastPlayed); // can't be less than 1
//qDebug() << "last played level:" << lastPlayed;
//qCDebug(KATOMIC_LOG) << "last played level:" << lastPlayed;
return lastPlayed;
}
......@@ -303,7 +303,7 @@ int GameWidget::maxAccessibleLevel() const
KSharedConfigPtr cfg = KSharedConfig::openConfig();
KConfigGroup grp(cfg, m_levelSet.name());
int maxAccessible = grp.readEntry("MaxAccessibleLevel", 1);
//qDebug() << "max accessible level:" << maxAccessible;
//qCDebug(KATOMIC_LOG) << "max accessible level:" << maxAccessible;
return maxAccessible;
}
......
org.kde.kdegames.katomic katomic (kdegames) IDENTIFIER [KATOMIC_LOG]
......@@ -24,7 +24,7 @@
#include <KConfigGroup>
#include <QDebug>
#include "katomic_debug.h"
#include <KLocalizedString>
#include <QFileInfo>
......@@ -103,13 +103,13 @@ bool LevelSet::load(const QString& levelSetName)
QString file = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("levels/%1.dat").arg(levelSetName));
if (file.isEmpty())
{
qDebug() << "level set \"" << levelSetName << "\" data file not found. Check your installation";
qCDebug(KATOMIC_LOG) << "level set \"" << levelSetName << "\" data file not found. Check your installation";
return false;
}
bool res = loadFromFile(file);
if (!res) {
qDebug() << "warning: failed to load level set" << levelSetName;
qCDebug(KATOMIC_LOG) << "warning: failed to load level set" << levelSetName;
}
return res;
......@@ -131,7 +131,7 @@ bool LevelSet::loadFromFile(const QString& fileName)
m_name = QFileInfo(fileName).baseName();
if (m_levelCount <= 0) {
//qDebug() << "warning: in level set" << m_name << "level count not specified or invalid";
//qCDebug(KATOMIC_LOG) << "warning: in level set" << m_name << "level count not specified or invalid";
}
return true;
......@@ -188,7 +188,7 @@ const LevelData* LevelSet::readLevel(int levelNum) const
{
if (line.isEmpty())
{
//qDebug() << "error while reading level" << levelNum << "data from" << m_name;
//qCDebug(KATOMIC_LOG) << "error while reading level" << levelNum << "data from" << m_name;
return nullptr;
}
......@@ -242,7 +242,7 @@ const Molecule* LevelSet::readLevelMolecule(int levelNum) const
strncpy(current.conn, value.toLatin1().constData(), sizeof(current.conn));
if (mol->m_atoms.indexOf(current) != -1)
qWarning()
qCWarning(KATOMIC_LOG)
<< "OOOPS, duplicate atom definition in" << key;
mol->m_atoms.append(current);
atom_index++;
......@@ -289,7 +289,7 @@ bool LevelSet::isDefaultLevelsAvailable()
QString file = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("levels/%1.dat").arg(QLatin1String(DEFAULT_LEVELSET_NAME)));
if (file.isEmpty())
{
//qDebug() << "default level set \"" << DEFAULT_LEVELSET_NAME << "\" data file not found. Check your installation";
//qCDebug(KATOMIC_LOG) << "default level set \"" << DEFAULT_LEVELSET_NAME << "\" data file not found. Check your installation";
return false;
}
......
......@@ -30,7 +30,7 @@
#include <KConfig>
#include <QDebug>
#include "katomic_debug.h"
#include <kconfiggroup.h>
#include <KGamePopupItem>
......@@ -85,7 +85,7 @@ void PlayField::setLevelData(const LevelData* level)
{
if (!level)
{
//qDebug() << "level data is null!";
//qCDebug(KATOMIC_LOG) << "level data is null!";
return;
}
......@@ -124,7 +124,7 @@ void PlayField::updateFieldItems()
{
if (!m_levelData || !m_levelData->molecule())
{
//qDebug() << "level or molecule data is null!";
//qCDebug(KATOMIC_LOG) << "level or molecule data is null!";
return;
}
......@@ -160,7 +160,7 @@ void PlayField::updateBackground()
void PlayField::resize( int width, int height)
{
//qDebug() << "resize:" << width << "," << height;
//qCDebug(KATOMIC_LOG) << "resize:" << width << "," << height;
setSceneRect( 0, 0, width, height );
// we take 1/4 of width for displaying preview
......@@ -177,7 +177,7 @@ void PlayField::resize( int width, int height)
// if atom animation is running we need to rescale timeline
if( isAnimating() )
{
//qDebug() << "restarting animation";
//qCDebug(KATOMIC_LOG) << "restarting animation";
int curTime = m_atomTimeLine->currentTime();
// calculate numCells to move using oldSize
int numCells = m_atomTimeLine->endFrame()/oldSize;
......@@ -576,7 +576,7 @@ bool PlayField::checkDone() const
{
if (!m_levelData || !m_levelData->molecule())
{
//qDebug() << "level or molecule data is null!";
//qCDebug(KATOMIC_LOG) << "level or molecule data is null!";
return false;
}
// let's assume that molecule is done
......@@ -611,7 +611,7 @@ bool PlayField::cellIsEmpty(int x, int y) const
{
if (!m_levelData)
{
//qDebug() << "level data is null!";
//qCDebug(KATOMIC_LOG) << "level data is null!";
return true;
}
......@@ -679,7 +679,7 @@ void PlayField::drawForeground( QPainter *p, const QRectF&)
{
if (!m_levelData)
{
//qDebug() << "level data is null!";
//qCDebug(KATOMIC_LOG) << "level data is null!";
return;
}
......@@ -770,7 +770,7 @@ QString PlayField::moleculeName() const
{
if (!m_levelData || !m_levelData->molecule())
{
//qDebug() << "level or molecule data is null!";
//qCDebug(KATOMIC_LOG) << "level or molecule data is null!";
return QString();
}
......
......@@ -28,7 +28,7 @@
#include <kstandardgameaction.h>
#include <kselectaction.h>
#include <kactioncollection.h>
#include <QDebug>
#include "katomic_debug.h"
#include <QIcon>
#include <qstatusbar.h>
#include <QLabel>
......@@ -209,7 +209,7 @@ void AtomTopLevel::updateStatusBar( int level, int score, int highscore )
void AtomTopLevel::enableHackMode()
{
//qDebug() << "Enabling hack mode";
//qCDebug(KATOMIC_LOG) << "Enabling hack mode";
m_prevLevelAct->setDisabled(false);
m_nextLevelAct->setDisabled(false);
m_gameWid->enableSwitchToAnyLevel();
......
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