Commit 74210ecf authored by Luigi Toscano's avatar Luigi Toscano

Complete the port to categorized logging

- use ecm_qt_declare_logging_category and then bump the ECM version
  (which was already linked to the version of the other Frameworks
  components, so it's more a formal change than a real version bump).
  Change the category to be more in line with the last (unwritten,
  from the ground) conventions; as lskat was never released it's not
  really a problem.
- port the remaining kDebug() calls to qCDebug().
parent 9bc2a514
...@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) ...@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (QT_MIN_VERSION "5.3.0") set (QT_MIN_VERSION "5.3.0")
set (KF5_MIN_VERSION "5.15.0") set (KF5_MIN_VERSION "5.15.0")
find_package(ECM 1.7.0 REQUIRED CONFIG) find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets Svg Test) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets Svg Test)
...@@ -36,6 +36,7 @@ include(ECMInstallIcons) ...@@ -36,6 +36,7 @@ include(ECMInstallIcons)
include(KDEInstallDirs) include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings) include(KDECMakeSettings)
include(ECMQtDeclareLoggingCategory)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
......
set(lskat_SRCS set(lskat_SRCS
lskat_debug.cpp
thememanager.cpp thememanager.cpp
namedialogwidget.cpp namedialogwidget.cpp
gameview.cpp gameview.cpp
...@@ -33,6 +32,11 @@ ki18n_wrap_ui(lskat_SRCS ...@@ -33,6 +32,11 @@ ki18n_wrap_ui(lskat_SRCS
configure_file(config-src.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-src.h) configure_file(config-src.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-src.h)
# Debug as default severity, at least until global_debug is removed
ecm_qt_declare_logging_category(lskat_SRCS HEADER lskat_debug.h
IDENTIFIER LSKAT_LOG CATEGORY_NAME org.kde.lskat
DEFAULT_SEVERITY Debug)
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../*-apps-lskat.png") file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../*-apps-lskat.png")
ecm_add_app_icon(lskat_SRCS ICONS ${ICONS_SRCS}) ecm_add_app_icon(lskat_SRCS ICONS ${ICONS_SRCS})
add_executable( lskat ${lskat_SRCS} ) add_executable( lskat ${lskat_SRCS} )
......
/* 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 "lskat_debug.h"
Q_LOGGING_CATEGORY(LSKAT_LOG, "log_lskat")
/* 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 LSKAT_DEBUG_H
#define LSKAT_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(LSKAT_LOG)
#endif
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <KCrash> #include <KCrash>
#include <KLocalizedString> #include <KLocalizedString>
#include <kglobal.h> #include <kglobal.h>
#include <KDebug> #include "lskat_debug.h"
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
...@@ -109,19 +109,19 @@ int main(int argc, char *argv[]) ...@@ -109,19 +109,19 @@ int main(int argc, char *argv[])
if (parser.isSet("debug")) if (parser.isSet("debug"))
{ {
global_debug = QString(parser.value("debug")).toInt(); global_debug = QString(parser.value("debug")).toInt();
kDebug(12010) << "Debug level set to" << global_debug; qCDebug(LSKAT_LOG) << "Debug level set to" << global_debug;
} }
// Check for debug command line option // Check for debug command line option
if (parser.isSet("skipintro")) if (parser.isSet("skipintro"))
{ {
global_skip_intro = true; global_skip_intro = true;
kDebug(12010) << "Skip intro cmd line chosen" << global_skip_intro; qCDebug(LSKAT_LOG) << "Skip intro cmd line chosen" << global_skip_intro;
} }
// Check for debug command line option // Check for debug command line option
if (parser.isSet("demo")) if (parser.isSet("demo"))
{ {
global_demo_mode = true; global_demo_mode = true;
kDebug(12010) << "Running in demo mode" << global_demo_mode; qCDebug(LSKAT_LOG) << "Running in demo mode" << global_demo_mode;
} }
if (application.isSessionRestored()) if (application.isSessionRestored())
......
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