Commit c5011f58 authored by Julian Helfferich's avatar Julian Helfferich

Introduce Logging Categories

Use QLoggingCategory for debug output.

REVIEW: 127708
parent bd967fe1
......@@ -5,6 +5,7 @@ set(kbreakout_SRCS
mainwindow.cpp
canvaswidget.cpp
gameengine.cpp
kbreakout_debug.cpp
levelloader.cpp
#generalsettings.cpp
)
......
......@@ -17,6 +17,7 @@
#include "canvaswidget.h"
#include "globals.h"
#include "kbreakout_debug.h"
#include "settings.h"
#include <QGraphicsObject>
......@@ -34,6 +35,9 @@ CanvasWidget::CanvasWidget(QWidget *parent) :
m_provider->discoverThemes("appdata", QStringLiteral("themes"));
m_provider->setDeclarativeEngine(QStringLiteral("themeProvider"), engine());
QString path = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("qml/main.qml"));
qCDebug(KBREAKOUT_General) << "QtQuick QML file: " << path;
setSource(QUrl::fromLocalFile(path));
// forward signals from QML
......
......@@ -17,11 +17,11 @@
#include "gameengine.h"
#include "kbreakout_debug.h"
#include "levelloader.h"
#include <QTimer>
#include <QTime>
#include <QDebug>
GameEngine::GameEngine(QObject *parent)
: QObject(parent)
......@@ -64,7 +64,7 @@ void GameEngine::loadNextLevel()
inline void GameEngine::deleteAllObjects()
{
/*qDebug() << "all object deleted";
/*qCDebug(KBREAKOUT_General) << "all object deleted";
deleteMovingObjects();
qDeleteAll(m_bricks);
m_bricks.clear();
......
/*
Copyright 2016 Julian Helfferich <julian.helfferich@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kbreakout_debug.h"
Q_LOGGING_CATEGORY(KBREAKOUT_General, "KBreakout")
/*
Copyright 2016 Julian Helfferich <julian.helfferich@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KBREAKOUT_DEBUG_H
#define KBREAKOUT_DEBUG_H
// Define logging category
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KBREAKOUT_General)
#endif
......@@ -17,6 +17,7 @@
#include "levelloader.h"
#include "globals.h"
#include "kbreakout_debug.h"
#include <QDomDocument>
#include <QFile>
......@@ -26,8 +27,6 @@
#include <KConfig>
#include <KConfigGroup>
#include <QDebug>
LevelLoader::LevelLoader(QObject *parent)
: QObject(parent)
{
......@@ -284,7 +283,7 @@ void LevelLoader::loadOldStyleLevel()
return;
}
qDebug() << line << endl;
qCDebug(KBREAKOUT_General) << line << endl;
if (line.size() > WIDTH) {
qCritical() << "Invalid file: too many bricks\n";
......
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