summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Toscano <[email protected]>2017-04-08 00:10:07 +0200
committerLuigi Toscano <[email protected]>2017-04-08 00:10:07 +0200
commit74210ecf1d9044bfa41c43b47023d361e170d1ea (patch)
tree0191a8780fd000ecb0699a6e4d2d65f3dd1db833
parent9bc2a5141cf3b34d21fb1ab9868e697490616e84 (diff)
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().
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/lskat_debug.cpp21
-rw-r--r--src/lskat_debug.h26
-rw-r--r--src/main.cpp8
5 files changed, 11 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d082f7c..d8303ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
set (QT_MIN_VERSION "5.3.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})
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets Svg Test)
@@ -36,6 +36,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)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8b7c35c..74a5b74 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,5 @@
set(lskat_SRCS
- lskat_debug.cpp
thememanager.cpp
namedialogwidget.cpp
gameview.cpp
@@ -33,6 +32,11 @@ ki18n_wrap_ui(lskat_SRCS
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")
ecm_add_app_icon(lskat_SRCS ICONS ${ICONS_SRCS})
add_executable( lskat ${lskat_SRCS} )
diff --git a/src/lskat_debug.cpp b/src/lskat_debug.cpp
deleted file mode 100644
index 9f753f3..0000000
--- a/src/lskat_debug.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2014 Laurent Montel <[email protected]>
-
- 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")
diff --git a/src/lskat_debug.h b/src/lskat_debug.h
deleted file mode 100644
index a05bb8a..0000000
--- a/src/lskat_debug.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2014 Laurent Montel <[email protected]>
-
- 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
diff --git a/src/main.cpp b/src/main.cpp
index f400aad..011b6a4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -51,7 +51,7 @@
#include <KCrash>
#include <KLocalizedString>
#include <kglobal.h>
-#include <KDebug>
+#include "lskat_debug.h"
#include <QApplication>
#include <QCommandLineParser>
@@ -109,19 +109,19 @@ int main(int argc, char *argv[])
if (parser.isSet("debug"))
{
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
if (parser.isSet("skipintro"))
{
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
if (parser.isSet("demo"))
{
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())