Create logging categories via CMake

Summary:
Also set a consistent naming structure and to be only Info+ by default.

This may mean you need to update your logging rules if you want debug
output.

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: graesslin, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1956
wilder-5.14
David Edmundson 10 years ago
parent aa5fde007d
commit ef2fd6d979
  1. 6
      applets/systemtray/CMakeLists.txt
  2. 29
      applets/systemtray/debug.h
  3. 22
      applets/systemtray/systemtray.cpp
  4. 6
      components/keyboardlayout/CMakeLists.txt
  5. 3
      components/keyboardlayout/keyboardlayout.cpp
  6. 3
      components/keyboardlayout/keyboardlayout.h
  7. 5
      dataengines/mpris2/CMakeLists.txt
  8. 2
      dataengines/mpris2/debug.h
  9. 2
      dataengines/mpris2/mpris2engine.cpp

@ -6,6 +6,11 @@ set(systemtray_SRCS
systemtray.cpp
)
ecm_qt_declare_logging_category(systemtray_SRCS HEADER debug.h
IDENTIFIER SYSTEM_TRAY
CATEGORY_NAME kde.systemtray
DEFAULT_SEVERITY Info)
add_library(org.kde.plasma.private.systemtray MODULE ${systemtray_SRCS})
kcoreaddons_desktop_to_json(org.kde.plasma.private.systemtray package/metadata.desktop)
@ -19,7 +24,6 @@ target_link_libraries(org.kde.plasma.private.systemtray
KF5::XmlGui
KF5::I18n)
install(TARGETS org.kde.plasma.private.systemtray DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
add_subdirectory(container)

@ -1,29 +0,0 @@
/***************************************************************************
* debug.h *
* *
* Copyright 2013 Sebastian Kügler <sebas@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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef SYSTEMTRAYDEBUG_H
#define SYSTEMTRAYDEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(SYSTEMTRAY)
#endif

@ -44,8 +44,6 @@
#include <plasma_version.h>
Q_LOGGING_CATEGORY(SYSTEMTRAY, "systemtray")
/*
* An app may also load icons from their own directories, so we need a new iconloader that takes this into account
* This is wrapped into a subclass of iconengine so the iconloader lifespan matches the icon object
@ -149,7 +147,7 @@ QVariant SystemTray::resolveIcon(const QVariant &variant, const QString &iconThe
return QVariant(QIcon(new AppIconEngine(variant.toString(), path, appName)));
} else {
qCWarning(SYSTEMTRAY) << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'";
qCWarning(SYSTEM_TRAY) << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'";
}
}
@ -344,7 +342,7 @@ void SystemTray::restoreContents(KConfigGroup &group)
void SystemTray::restorePlasmoids()
{
if (!isContainment()) {
qCWarning(SYSTEMTRAY) << "Loaded as an applet, this shouldn't have happened";
qCWarning(SYSTEM_TRAY) << "Loaded as an applet, this shouldn't have happened";
return;
}
@ -374,7 +372,7 @@ void SystemTray::restorePlasmoids()
m_knownPlugins[plugin] = group.toInt();
}
}
qCWarning(SYSTEMTRAY) << "Known plasmoid ids:"<< m_knownPlugins;
qCWarning(SYSTEM_TRAY) << "Known plasmoid ids:"<< m_knownPlugins;
//X-Plasma-NotificationArea
@ -391,7 +389,7 @@ void SystemTray::restorePlasmoids()
foreach (const KPluginInfo &info, applets) {
const QString dbusactivation = info.property(QStringLiteral("X-Plasma-DBusActivationService")).toString();
if (!dbusactivation.isEmpty()) {
qCDebug(SYSTEMTRAY) << "ST Found DBus-able Applet: " << info.pluginName() << dbusactivation;
qCDebug(SYSTEM_TRAY) << "ST Found DBus-able Applet: " << info.pluginName() << dbusactivation;
m_dbusActivatableTasks[info.pluginName()] = dbusactivation;
continue;
}
@ -426,7 +424,7 @@ void SystemTray::restorePlasmoids()
}
foreach (const KPluginInfo &info, sortedApplets) {
qCDebug(SYSTEMTRAY) << " Adding applet: " << info.name();
qCDebug(SYSTEM_TRAY) << " Adding applet: " << info.name();
if (m_allowedPlasmoids.contains(info.pluginName())) {
newTask(info.pluginName());
}
@ -526,7 +524,7 @@ void SystemTray::serviceNameFetchFinished(QDBusPendingCallWatcher* watcher, cons
watcher->deleteLater();
if (propsReply.isError()) {
qCWarning(SYSTEMTRAY) << "Could not get list of available D-Bus services";
qCWarning(SYSTEM_TRAY) << "Could not get list of available D-Bus services";
} else {
foreach (const QString& serviceName, propsReply.value()) {
serviceRegistered(serviceName);
@ -556,7 +554,7 @@ void SystemTray::serviceOwnerChanged(const QString &serviceName, const QString &
void SystemTray::serviceRegistered(const QString &service)
{
//qCDebug(SYSTEMTRAY) << "DBus service appeared:" << service;
//qCDebug(SYSTEM_TRAY) << "DBus service appeared:" << service;
for (auto it = m_dbusActivatableTasks.constBegin(), end = m_dbusActivatableTasks.constEnd(); it != end; ++it) {
const QString &plugin = it.key();
if (!m_allowedPlasmoids.contains(plugin)) {
@ -567,7 +565,7 @@ void SystemTray::serviceRegistered(const QString &service)
QRegExp rx(pattern);
rx.setPatternSyntax(QRegExp::Wildcard);
if (rx.exactMatch(service)) {
//qCDebug(SYSTEMTRAY) << "ST : DBus service " << m_dbusActivatableTasks[plugin] << "appeared. Loading " << plugin;
//qCDebug(SYSTEM_TRAY) << "ST : DBus service " << m_dbusActivatableTasks[plugin] << "appeared. Loading " << plugin;
newTask(plugin);
m_dbusServiceCounts[plugin]++;
}
@ -576,7 +574,7 @@ void SystemTray::serviceRegistered(const QString &service)
void SystemTray::serviceUnregistered(const QString &service)
{
//qCDebug(SYSTEMTRAY) << "DBus service disappeared:" << service;
//qCDebug(SYSTEM_TRAY) << "DBus service disappeared:" << service;
for (auto it = m_dbusActivatableTasks.constBegin(), end = m_dbusActivatableTasks.constEnd(); it != end; ++it) {
const QString &plugin = it.key();
@ -591,7 +589,7 @@ void SystemTray::serviceUnregistered(const QString &service)
m_dbusServiceCounts[plugin]--;
Q_ASSERT(m_dbusServiceCounts[plugin] >= 0);
if (m_dbusServiceCounts[plugin] == 0) {
//qCDebug(SYSTEMTRAY) << "ST : DBus service " << m_dbusActivatableTasks[plugin] << " disappeared. Unloading " << plugin;
//qCDebug(SYSTEM_TRAY) << "ST : DBus service " << m_dbusActivatableTasks[plugin] << " disappeared. Unloading " << plugin;
cleanupTask(plugin);
}
}

@ -2,6 +2,12 @@ set(keyboardlayoutplugin_SRCS
keyboardlayout.cpp
keyboardlayoutplugin.cpp)
ecm_qt_declare_logging_category(keyboardlayoutplugin_SRCS HEADER debug.h
IDENTIFIER KEYBOARD_LAYOUT
CATEGORY_NAME kde.keyboardlayout
DEFAULT_SEVERITY Info)
add_library(keyboardlayoutplugin SHARED ${keyboardlayoutplugin_SRCS})
target_link_libraries(keyboardlayoutplugin Qt5::Core

@ -23,8 +23,7 @@
#include <QtDBus/QDBusReply>
#include <QDebug>
Q_LOGGING_CATEGORY(KEYBOARD_LAYOUT, "org.kde.keyboardLayout")
#include "debug.h"
KeyboardLayout::KeyboardLayout(QObject* parent)
: QObject(parent)

@ -22,7 +22,6 @@
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QLoggingCategory>
class QDBusInterface;
class QDBusPendingCallWatcher;
@ -77,7 +76,5 @@ private:
};
Q_DECLARE_LOGGING_CATEGORY(KEYBOARD_LAYOUT)
#endif // KEYBOARDLAYOUT_H

@ -10,6 +10,11 @@ set(mpris2_engine_SRCS
playercontainer.cpp
)
ecm_qt_declare_logging_category(mpris2_engine_SRCS HEADER debug.h
IDENTIFIER MPRIS2
CATEGORY_NAME kde.dataengine.mpris
DEFAULT_SEVERITY Info)
set_source_files_properties(
org.freedesktop.DBus.Properties.xml
org.mpris.MediaPlayer2.Player.xml

@ -1,2 +0,0 @@
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(MPRIS2)

@ -30,8 +30,6 @@
#include "multiplexer.h"
#include "multiplexedservice.h"
Q_LOGGING_CATEGORY(MPRIS2, "plasma.engine.mpris2")
Mpris2Engine::Mpris2Engine(QObject* parent,
const QVariantList& args)
: Plasma::DataEngine(parent)

Loading…
Cancel
Save