From 910c49959a324ed61eb7d5fe41ec1c310cf48f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 31 Jul 2015 13:03:35 +0200 Subject: [PATCH] [tabbox] Add dedicated logging category for TabBox --- CMakeLists.txt | 1 + data/org_kde_kwin.categories | 1 + tabbox/autotests/CMakeLists.txt | 4 ++++ tabbox/tabbox.cpp | 12 ++++++------ tabbox/tabbox_logging.cpp | 21 +++++++++++++++++++++ tabbox/tabbox_logging.h | 26 ++++++++++++++++++++++++++ tabbox/tabboxhandler.cpp | 10 +++++----- 7 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 tabbox/tabbox_logging.cpp create mode 100644 tabbox/tabbox_logging.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b1e27f5ade..bf6bf0e8b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,6 +417,7 @@ if(KWIN_BUILD_TABBOX) tabbox/switcheritem.cpp tabbox/tabboxconfig.cpp tabbox/tabboxhandler.cpp + tabbox/tabbox_logging.cpp ) endif() diff --git a/data/org_kde_kwin.categories b/data/org_kde_kwin.categories index ec476c4990..3d81c92ee4 100644 --- a/data/org_kde_kwin.categories +++ b/data/org_kde_kwin.categories @@ -9,4 +9,5 @@ kwin_wayland_hwcomposer KWin Wayland (hwcomposer backend) kwin_wayland_backend KWin Wayland (Wayland backend) kwin_wayland_x11windowed KWin Wayland (X11 backend) kwin_libinput KWin Libinput Integration +kwin_tabbox KWin Window Switcher aurorae KWin Aurorae Window Decoration Engine diff --git a/tabbox/autotests/CMakeLists.txt b/tabbox/autotests/CMakeLists.txt index 071ba04f53..523d15a57d 100644 --- a/tabbox/autotests/CMakeLists.txt +++ b/tabbox/autotests/CMakeLists.txt @@ -8,6 +8,7 @@ set( testTabBoxClientModel_SRCS ../desktopmodel.cpp ../tabboxconfig.cpp ../tabboxhandler.cpp + ../tabbox_logging.cpp test_tabbox_clientmodel.cpp mock_tabboxhandler.cpp mock_tabboxclient.cpp @@ -36,6 +37,7 @@ set( testTabBoxHandler_SRCS ../desktopmodel.cpp ../tabboxconfig.cpp ../tabboxhandler.cpp + ../tabbox_logging.cpp test_tabbox_handler.cpp mock_tabboxhandler.cpp mock_tabboxclient.cpp @@ -61,6 +63,7 @@ ecm_mark_as_test(testTabBoxHandler) ######################################################## set( testTabBoxConfig_SRCS ../tabboxconfig.cpp + ../tabbox_logging.cpp test_tabbox_config.cpp ) @@ -75,6 +78,7 @@ ecm_mark_as_test(testTabBoxConfig) ######################################################## set( testDesktopChain_SRCS ../desktopchain.cpp + ../tabbox_logging.cpp test_desktopchain.cpp ) diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index d9edb8ba75..f786a30beb 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -28,6 +28,7 @@ along with this program. If not, see . #include "tabbox/desktopmodel.h" #include "tabbox/tabboxconfig.h" #include "tabbox/desktopchain.h" +#include "tabbox/tabbox_logging.h" // kwin #ifdef KWIN_BUILD_ACTIVITIES #include "activities.h" @@ -44,7 +45,6 @@ along with this program. If not, see . #include "xcbutils.h" // Qt #include -#include #include // KDE #include @@ -754,7 +754,7 @@ void TabBox::hide(bool abort) } emit tabBoxClosed(); if (isDisplayed()) - qDebug() << "Tab box was not properly closed by an effect"; + qCDebug(KWIN_TABBOX) << "Tab box was not properly closed by an effect"; m_tabBox->hide(abort); Xcb::sync(); } @@ -930,7 +930,7 @@ struct KeySymbolsDeleter */ static bool areKeySymXsDepressed(bool bAll, const uint keySyms[], int nKeySyms) { - qDebug() << "areKeySymXsDepressed: " << (bAll ? "all of " : "any of ") << nKeySyms; + qCDebug(KWIN_TABBOX) << "areKeySymXsDepressed: " << (bAll ? "all of " : "any of ") << nKeySyms; Xcb::QueryKeymap keys; @@ -958,7 +958,7 @@ static bool areKeySymXsDepressed(bool bAll, const uint keySyms[], int nKeySyms) if (i < 0 || i >= 32) return false; - qDebug() << iKeySym << ": keySymX=0x" << QString::number(keySymX, 16) + qCDebug(KWIN_TABBOX) << iKeySym << ": keySymX=0x" << QString::number(keySymX, 16) << " i=" << i << " mask=0x" << QString::number(mask, 16) << " keymap[i]=0x" << QString::number(keymap[i], 16); @@ -1342,7 +1342,7 @@ void TabBox::keyPress(int keyQt) backwardShortcut = m_cutWalkThroughCurrentAppWindowsAlternativeReverse; break; default: - qDebug() << "Invalid TabBoxMode"; + qCDebug(KWIN_TABBOX) << "Invalid TabBoxMode"; return; } forward = contains(forwardShortcut, keyQt); @@ -1373,7 +1373,7 @@ void TabBox::keyPress(int keyQt) } } if (forward || backward) { - qDebug() << "== " << forwardShortcut.toString() + qCDebug(KWIN_TABBOX) << "== " << forwardShortcut.toString() << " or " << backwardShortcut.toString(); KDEWalkThroughWindows(forward); } diff --git a/tabbox/tabbox_logging.cpp b/tabbox/tabbox_logging.cpp new file mode 100644 index 0000000000..e6c90e1844 --- /dev/null +++ b/tabbox/tabbox_logging.cpp @@ -0,0 +1,21 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2015 Martin Gräßlin + +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 . +*********************************************************************/ +#include "tabbox_logging.h" +Q_LOGGING_CATEGORY(KWIN_TABBOX, "kwin_tabbox", QtCriticalMsg); diff --git a/tabbox/tabbox_logging.h b/tabbox/tabbox_logging.h new file mode 100644 index 0000000000..ae570be4e3 --- /dev/null +++ b/tabbox/tabbox_logging.h @@ -0,0 +1,26 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2015 Martin Gräßlin + +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 . +*********************************************************************/ +#ifndef KWIN_TABBOX_LOGGING_H +#define KWIN_TABBOX_LOGGING_H +#include +#include +Q_DECLARE_LOGGING_CATEGORY(KWIN_TABBOX) + +#endif diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index 6c3aa189fb..b4f1713c3a 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -30,8 +30,8 @@ along with this program. If not, see . #include "thumbnailitem.h" #include "scripting/scripting.h" #include "switcheritem.h" +#include "tabbox_logging.h" // Qt -#include #include #include #include @@ -260,7 +260,7 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode) } ); if (offers.isEmpty()) { - qDebug() << "could not find default window switcher layout"; + qCDebug(KWIN_TABBOX) << "could not find default window switcher layout"; return KPluginMetaData(); } } @@ -271,7 +271,7 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode) return nullptr; } if (service.value(QStringLiteral("X-Plasma-API")) != QStringLiteral("declarativeappletscript")) { - qDebug() << "Window Switcher Layout is no declarativeappletscript"; + qCDebug(KWIN_TABBOX) << "Window Switcher Layout is no declarativeappletscript"; return nullptr; } auto findScriptFile = [desktopMode, service, folderName] { @@ -282,12 +282,12 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode) file = findScriptFile(); } if (file.isNull()) { - qDebug() << "Could not find QML file for window switcher"; + qCDebug(KWIN_TABBOX) << "Could not find QML file for window switcher"; return nullptr; } m_qmlComponent->loadUrl(QUrl::fromLocalFile(file)); if (m_qmlComponent->isError()) { - qDebug() << "Component failed to load: " << m_qmlComponent->errors(); + qCDebug(KWIN_TABBOX) << "Component failed to load: " << m_qmlComponent->errors(); QStringList args; args << QStringLiteral("--passivepopup") << i18n("The Window Switcher installation is broken, resources are missing.\n" "Contact your distribution about this.") << QStringLiteral("20");