[tabbox] Add dedicated logging category for TabBox

This commit is contained in:
Martin Gräßlin 2015-07-31 13:03:35 +02:00
parent fe28ca1d8a
commit 910c49959a
7 changed files with 64 additions and 11 deletions

View file

@ -417,6 +417,7 @@ if(KWIN_BUILD_TABBOX)
tabbox/switcheritem.cpp tabbox/switcheritem.cpp
tabbox/tabboxconfig.cpp tabbox/tabboxconfig.cpp
tabbox/tabboxhandler.cpp tabbox/tabboxhandler.cpp
tabbox/tabbox_logging.cpp
) )
endif() endif()

View file

@ -9,4 +9,5 @@ kwin_wayland_hwcomposer KWin Wayland (hwcomposer backend)
kwin_wayland_backend KWin Wayland (Wayland backend) kwin_wayland_backend KWin Wayland (Wayland backend)
kwin_wayland_x11windowed KWin Wayland (X11 backend) kwin_wayland_x11windowed KWin Wayland (X11 backend)
kwin_libinput KWin Libinput Integration kwin_libinput KWin Libinput Integration
kwin_tabbox KWin Window Switcher
aurorae KWin Aurorae Window Decoration Engine aurorae KWin Aurorae Window Decoration Engine

View file

@ -8,6 +8,7 @@ set( testTabBoxClientModel_SRCS
../desktopmodel.cpp ../desktopmodel.cpp
../tabboxconfig.cpp ../tabboxconfig.cpp
../tabboxhandler.cpp ../tabboxhandler.cpp
../tabbox_logging.cpp
test_tabbox_clientmodel.cpp test_tabbox_clientmodel.cpp
mock_tabboxhandler.cpp mock_tabboxhandler.cpp
mock_tabboxclient.cpp mock_tabboxclient.cpp
@ -36,6 +37,7 @@ set( testTabBoxHandler_SRCS
../desktopmodel.cpp ../desktopmodel.cpp
../tabboxconfig.cpp ../tabboxconfig.cpp
../tabboxhandler.cpp ../tabboxhandler.cpp
../tabbox_logging.cpp
test_tabbox_handler.cpp test_tabbox_handler.cpp
mock_tabboxhandler.cpp mock_tabboxhandler.cpp
mock_tabboxclient.cpp mock_tabboxclient.cpp
@ -61,6 +63,7 @@ ecm_mark_as_test(testTabBoxHandler)
######################################################## ########################################################
set( testTabBoxConfig_SRCS set( testTabBoxConfig_SRCS
../tabboxconfig.cpp ../tabboxconfig.cpp
../tabbox_logging.cpp
test_tabbox_config.cpp test_tabbox_config.cpp
) )
@ -75,6 +78,7 @@ ecm_mark_as_test(testTabBoxConfig)
######################################################## ########################################################
set( testDesktopChain_SRCS set( testDesktopChain_SRCS
../desktopchain.cpp ../desktopchain.cpp
../tabbox_logging.cpp
test_desktopchain.cpp test_desktopchain.cpp
) )

View file

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tabbox/desktopmodel.h" #include "tabbox/desktopmodel.h"
#include "tabbox/tabboxconfig.h" #include "tabbox/tabboxconfig.h"
#include "tabbox/desktopchain.h" #include "tabbox/desktopchain.h"
#include "tabbox/tabbox_logging.h"
// kwin // kwin
#ifdef KWIN_BUILD_ACTIVITIES #ifdef KWIN_BUILD_ACTIVITIES
#include "activities.h" #include "activities.h"
@ -44,7 +45,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "xcbutils.h" #include "xcbutils.h"
// Qt // Qt
#include <QAction> #include <QAction>
#include <QDebug>
#include <QKeyEvent> #include <QKeyEvent>
// KDE // KDE
#include <KConfig> #include <KConfig>
@ -754,7 +754,7 @@ void TabBox::hide(bool abort)
} }
emit tabBoxClosed(); emit tabBoxClosed();
if (isDisplayed()) 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); m_tabBox->hide(abort);
Xcb::sync(); Xcb::sync();
} }
@ -930,7 +930,7 @@ struct KeySymbolsDeleter
*/ */
static bool areKeySymXsDepressed(bool bAll, const uint keySyms[], int nKeySyms) { 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; Xcb::QueryKeymap keys;
@ -958,7 +958,7 @@ static bool areKeySymXsDepressed(bool bAll, const uint keySyms[], int nKeySyms)
if (i < 0 || i >= 32) if (i < 0 || i >= 32)
return false; 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) << " i=" << i << " mask=0x" << QString::number(mask, 16)
<< " keymap[i]=0x" << QString::number(keymap[i], 16); << " keymap[i]=0x" << QString::number(keymap[i], 16);
@ -1342,7 +1342,7 @@ void TabBox::keyPress(int keyQt)
backwardShortcut = m_cutWalkThroughCurrentAppWindowsAlternativeReverse; backwardShortcut = m_cutWalkThroughCurrentAppWindowsAlternativeReverse;
break; break;
default: default:
qDebug() << "Invalid TabBoxMode"; qCDebug(KWIN_TABBOX) << "Invalid TabBoxMode";
return; return;
} }
forward = contains(forwardShortcut, keyQt); forward = contains(forwardShortcut, keyQt);
@ -1373,7 +1373,7 @@ void TabBox::keyPress(int keyQt)
} }
} }
if (forward || backward) { if (forward || backward) {
qDebug() << "== " << forwardShortcut.toString() qCDebug(KWIN_TABBOX) << "== " << forwardShortcut.toString()
<< " or " << backwardShortcut.toString(); << " or " << backwardShortcut.toString();
KDEWalkThroughWindows(forward); KDEWalkThroughWindows(forward);
} }

21
tabbox/tabbox_logging.cpp Normal file
View file

@ -0,0 +1,21 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
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 "tabbox_logging.h"
Q_LOGGING_CATEGORY(KWIN_TABBOX, "kwin_tabbox", QtCriticalMsg);

26
tabbox/tabbox_logging.h Normal file
View file

@ -0,0 +1,26 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
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 KWIN_TABBOX_LOGGING_H
#define KWIN_TABBOX_LOGGING_H
#include <QDebug>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KWIN_TABBOX)
#endif

View file

@ -30,8 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "thumbnailitem.h" #include "thumbnailitem.h"
#include "scripting/scripting.h" #include "scripting/scripting.h"
#include "switcheritem.h" #include "switcheritem.h"
#include "tabbox_logging.h"
// Qt // Qt
#include <QDebug>
#include <QKeyEvent> #include <QKeyEvent>
#include <QModelIndex> #include <QModelIndex>
#include <QStandardPaths> #include <QStandardPaths>
@ -260,7 +260,7 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode)
} }
); );
if (offers.isEmpty()) { if (offers.isEmpty()) {
qDebug() << "could not find default window switcher layout"; qCDebug(KWIN_TABBOX) << "could not find default window switcher layout";
return KPluginMetaData(); return KPluginMetaData();
} }
} }
@ -271,7 +271,7 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode)
return nullptr; return nullptr;
} }
if (service.value(QStringLiteral("X-Plasma-API")) != QStringLiteral("declarativeappletscript")) { 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; return nullptr;
} }
auto findScriptFile = [desktopMode, service, folderName] { auto findScriptFile = [desktopMode, service, folderName] {
@ -282,12 +282,12 @@ QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode)
file = findScriptFile(); file = findScriptFile();
} }
if (file.isNull()) { 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; return nullptr;
} }
m_qmlComponent->loadUrl(QUrl::fromLocalFile(file)); m_qmlComponent->loadUrl(QUrl::fromLocalFile(file));
if (m_qmlComponent->isError()) { if (m_qmlComponent->isError()) {
qDebug() << "Component failed to load: " << m_qmlComponent->errors(); qCDebug(KWIN_TABBOX) << "Component failed to load: " << m_qmlComponent->errors();
QStringList args; QStringList args;
args << QStringLiteral("--passivepopup") << i18n("The Window Switcher installation is broken, resources are missing.\n" args << QStringLiteral("--passivepopup") << i18n("The Window Switcher installation is broken, resources are missing.\n"
"Contact your distribution about this.") << QStringLiteral("20"); "Contact your distribution about this.") << QStringLiteral("20");