Commit 7d0b7441 authored by Nicolas Fella's avatar Nicolas Fella

Automatically create debug category for plugins

parent 5727d123
Pipeline #4284 failed with stage
in 10 minutes
......@@ -4,7 +4,18 @@
# Thoroughly inspired in kdevplatform_add_plugin
function(kdeconnect_add_plugin)
string(TOUPPER ${ARGV0} identifier)
ecm_qt_declare_logging_category(
kdeconnect_${ARGV0}_SRCS
HEADER ${ARGV0}-debug.h
IDENTIFIER KDECONNECT_PLUGIN_${identifier}
CATEGORY_NAME kdeconnect.plugin.${ARGV0}
)
kcoreaddons_add_plugin(kdeconnect_${ARGV0} JSON kdeconnect_${ARGV0}.json SOURCES ${kdeconnect_${ARGV0}_SRCS} INSTALL_NAMESPACE kdeconnect)
endfunction()
function(kdeconnect_add_plugin_old)
......
......@@ -20,6 +20,7 @@
#include "batterydbusinterface.h"
#include "batteryplugin.h"
#include "battery-debug.h"
#include <QDebug>
#include <core/device.h>
......
......@@ -29,8 +29,6 @@
K_PLUGIN_CLASS_WITH_JSON(BatteryPlugin, "kdeconnect_battery.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BATTERY, "kdeconnect.plugin.battery")
BatteryPlugin::BatteryPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, batteryDbusInterface(new BatteryDbusInterface(device()))
......
......@@ -21,12 +21,10 @@
#ifndef BATTERYPLUGIN_H
#define BATTERYPLUGIN_H
#include <QLoggingCategory>
#include <core/kdeconnectplugin.h>
#define PACKET_TYPE_BATTERY_REQUEST QStringLiteral("kdeconnect.battery.request")
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BATTERY)
class BatteryDbusInterface;
class BatteryPlugin
......
......@@ -26,8 +26,6 @@
K_PLUGIN_CLASS_WITH_JSON(ClipboardPlugin, "kdeconnect_clipboard.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CLIPBOARD, "kdeconnect.plugin.clipboard")
ClipboardPlugin::ClipboardPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
......
......@@ -23,10 +23,8 @@
#include <QObject>
#include <QClipboard>
#include <QLoggingCategory>
#include <core/kdeconnectplugin.h>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CLIPBOARD)
#define PACKET_TYPE_CLIPBOARD QStringLiteral("kdeconnect.clipboard")
class ClipboardPlugin
......
......@@ -30,11 +30,10 @@
#include <QIODevice>
#include <core/device.h>
#include <contacts-debug.h>
K_PLUGIN_CLASS_WITH_JSON(ContactsPlugin, "kdeconnect_contacts.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CONTACTS, "kdeconnect.plugin.contacts")
ContactsPlugin::ContactsPlugin(QObject* parent, const QVariantList& args) :
KdeConnectPlugin(parent, args)
{
......
......@@ -20,6 +20,8 @@
#include "findthisdeviceplugin.h"
#include "findthisdevice-debug.h"
// KF
#include <KPluginFactory>
......@@ -36,8 +38,6 @@
K_PLUGIN_CLASS_WITH_JSON(FindThisDevicePlugin, "kdeconnect_findthisdevice.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_FINDTHISDEVICE, "kdeconnect.plugin.findthisdevice")
FindThisDevicePlugin::FindThisDevicePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
......
......@@ -22,13 +22,9 @@
#define FINDTHISDEVICEPLUGIN_H
#include <core/kdeconnectplugin.h>
// Qt
#include <QLoggingCategory>
#define PACKET_TYPE_FINDMYPHONE_REQUEST QStringLiteral("kdeconnect.findmyphone.request")
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_FINDTHISDEVICE)
inline QString defaultSound(){
#ifdef Q_OS_WIN
return QStringLiteral("Ring01.wav");
......
......@@ -29,8 +29,6 @@
K_PLUGIN_CLASS_WITH_JSON(MprisRemotePlugin, "kdeconnect_mprisremote.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MPRISREMOTE, "kdeconnect.plugin.mprisremote")
MprisRemotePlugin::MprisRemotePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, m_currentPlayer()
......
......@@ -19,7 +19,7 @@
*/
#include "notification.h"
#include "notification_debug.h"
#include "notifications-debug.h"
#include <KNotification>
#include <QtGlobal>
......@@ -167,7 +167,7 @@ void Notification::loadIcon(const NetworkPacket& np)
connect(fileTransferJob, &FileTransferJob::result, this, [this, fileTransferJob]{
s_downloadsInProgress.remove(m_iconPath);
if (fileTransferJob->error()) {
qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Error in FileTransferJob: " << fileTransferJob->errorString();
qCDebug(KDECONNECT_PLUGIN_NOTIFICATIONS) << "Error in FileTransferJob: " << fileTransferJob->errorString();
applyNoIcon();
} else {
applyIcon();
......
/**
* Copyright 2014 Alejandro Fiestas Olivares <afiestas@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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef NOTIFICATION_DEBUG_H
#define NOTIFICATION_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_NOTIFICATION)
#endif //NOTIFICATION_DEBUG_H
......@@ -19,7 +19,7 @@
*/
#include "notificationsdbusinterface.h"
#include "notification_debug.h"
#include "notifications-debug.h"
#include "notification.h"
#include <core/device.h>
......@@ -43,7 +43,7 @@ NotificationsDbusInterface::NotificationsDbusInterface(KdeConnectPlugin* plugin)
NotificationsDbusInterface::~NotificationsDbusInterface()
{
qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Destroying NotificationsDbusInterface";
qCDebug(KDECONNECT_PLUGIN_NOTIFICATIONS) << "Destroying NotificationsDbusInterface";
}
void NotificationsDbusInterface::clearNotifications()
......@@ -127,7 +127,7 @@ void NotificationsDbusInterface::removeNotification(const QString& internalId)
//qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "removeNotification" << internalId;
if (!m_internalIdToPublicId.contains(internalId)) {
qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Not found noti by internal Id: " << internalId;
qCDebug(KDECONNECT_PLUGIN_NOTIFICATIONS) << "Not found noti by internal Id: " << internalId;
return;
}
......@@ -135,7 +135,7 @@ void NotificationsDbusInterface::removeNotification(const QString& internalId)
Notification* noti = m_notifications.take(publicId);
if (!noti) {
qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Not found noti by public Id: " << publicId;
qCDebug(KDECONNECT_PLUGIN_NOTIFICATIONS) << "Not found noti by public Id: " << publicId;
return;
}
......
......@@ -21,8 +21,7 @@
#include "notificationsplugin.h"
#include "notificationsdbusinterface.h"
#include "notification_debug.h"
#include "notifications-debug.h"
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json")
......
......@@ -30,14 +30,13 @@
#include <PulseAudioQt/Sink>
#include <dbushelper.h>
#include "pausemusic-debug.h"
//In older Qt released, qAsConst isnt available
#include "qtcompat_p.h"
K_PLUGIN_CLASS_WITH_JSON(PauseMusicPlugin, "kdeconnect_pausemusic.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PAUSEMUSIC, "kdeconnect.plugin.pausemusic")
PauseMusicPlugin::PauseMusicPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, mutedSinks()
......
......@@ -27,10 +27,6 @@
#include <core/kdeconnectplugin.h>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PAUSEMUSIC)
class PauseMusicPlugin
: public KdeConnectPlugin
{
......@@ -41,7 +37,7 @@ public:
bool receivePacket(const NetworkPacket& np) override;
void connected() override { }
private:
QSet<QString> pausedSources;
QSet<QString> mutedSinks;
......
......@@ -22,15 +22,11 @@
#include <KPluginFactory>
#include <QDebug>
#include <QLoggingCategory>
#include <core/filetransferjob.h>
#include "photo-debug.h"
K_PLUGIN_CLASS_WITH_JSON(PhotoPlugin, "kdeconnect_photo.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PHOTO, "kdeconnect.plugin.photo")
PhotoPlugin::PhotoPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
......
......@@ -19,21 +19,19 @@
*/
#include "pingplugin.h"
#include "ping-debug.h"
#include <KLocalizedString>
#include <KPluginFactory>
#include <QDebug>
#include <QDBusConnection>
#include <QLoggingCategory>
#include <core/device.h>
#include <core/daemon.h>
K_PLUGIN_CLASS_WITH_JSON(PingPlugin, "kdeconnect_ping.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PING, "kdeconnect.plugin.ping")
PingPlugin::PingPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
......
......@@ -26,13 +26,12 @@
#include <core/networkpacket.h>
#include <core/device.h>
#include "remotecommands-debug.h"
#define PACKET_TYPE_RUNCOMMAND_REQUEST QLatin1String("kdeconnect.runcommand.request")
K_PLUGIN_CLASS_WITH_JSON(RemoteCommandsPlugin, "kdeconnect_remotecommands.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTECOMMANDS, "kdeconnect.plugin.remotecommands")
RemoteCommandsPlugin::RemoteCommandsPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, m_commands("{}")
......
......@@ -32,8 +32,6 @@
K_PLUGIN_CLASS_WITH_JSON(RemoteControlPlugin, "kdeconnect_remotecontrol.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTECONTROL, "kdeconnect.plugin.remotecontrol")
RemoteControlPlugin::RemoteControlPlugin(QObject* parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
......
......@@ -24,9 +24,9 @@
#include <QString>
#include <QVariantMap>
K_PLUGIN_CLASS_WITH_JSON(RemoteKeyboardPlugin, "kdeconnect_remotekeyboard.json")
#include <remotekeyboard-debug.h>
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTEKEYBOARD, "kdeconnect.plugin.remotekeyboard");
K_PLUGIN_CLASS_WITH_JSON(RemoteKeyboardPlugin, "kdeconnect_remotekeyboard.json")
// Mapping of Qt::Key to internal codes, corresponds to the mapping in mousepadplugin
QMap<int, int> specialKeysMap = {
......
......@@ -23,13 +23,10 @@
#include <core/kdeconnectplugin.h>
#include <QDBusInterface>
#include <QLoggingCategory>
#include <QVariantMap>
struct FakeKey;
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTEKEYBOARD);
#define PACKET_TYPE_MOUSEPAD_REQUEST QLatin1String("kdeconnect.mousepad.request")
#define PACKET_TYPE_MOUSEPAD_ECHO QLatin1String("kdeconnect.mousepad.echo")
#define PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE QLatin1String("kdeconnect.mousepad.keyboardstate")
......
......@@ -33,6 +33,7 @@
#include <core/networkpacket.h>
#include <core/device.h>
#include "runcommand-debug.h"
#define PACKET_TYPE_RUNCOMMAND QStringLiteral("kdeconnect.runcommand")
......@@ -48,8 +49,6 @@
K_PLUGIN_CLASS_WITH_JSON(RunCommandPlugin, "kdeconnect_runcommand.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_RUNCOMMAND, "kdeconnect.plugin.runcommand")
RunCommandPlugin::RunCommandPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
......
......@@ -28,8 +28,8 @@
#include "mountloop.h"
#include "config-sftp.h"
#include "sftp_debug.h"
#include "kdeconnectconfig.h"
#include "sftp-debug.h"
Mounter::Mounter(SftpPlugin* sftp)
: QObject(sftp)
......@@ -82,7 +82,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np)
unmount(false);
return;
}
if (np.has(QStringLiteral("errorMessage"))) {
Q_EMIT failed(np.get<QString>(QStringLiteral("errorMessage")));
return;
......
/**
* Copyright 2014 Alejandro Fiestas Olivares <afiestas@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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef SFTP_DEBUG_H
#define SFTP_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SFTP)
#endif //SFTP_DEBUG_H
......@@ -32,12 +32,10 @@
#include <KPluginFactory>
#include "mounter.h"
#include "sftp_debug.h"
#include "sftp-debug.h"
K_PLUGIN_CLASS_WITH_JSON(SftpPlugin, "kdeconnect_sftp.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SFTP, "kdeconnect.plugin.sftp")
static const QSet<QString> fields_c = QSet<QString>() << QStringLiteral("ip") << QStringLiteral("port") << QStringLiteral("user") << QStringLiteral("port") << QStringLiteral("path");
struct SftpPlugin::Pimpl
......
/**
* Copyright 2014 Alejandro Fiestas Olivares <afiestas@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) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef SHARE_DEBUG_H
#define SHARE_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SHARE)
#endif //SHARE_DEBUG_H
......@@ -19,7 +19,6 @@
*/
#include "shareplugin.h"
#include "share_debug.h"
#include <QStandardPaths>
#include <QProcess>
......@@ -36,11 +35,10 @@
#include <KMimeTypeTrader>
#include "core/filetransferjob.h"
#include <share-debug.h>
K_PLUGIN_CLASS_WITH_JSON(SharePlugin, "kdeconnect_share.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SHARE, "kdeconnect.plugin.share")
SharePlugin::SharePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, m_compositeJob()
......
......@@ -32,11 +32,10 @@
#include <core/daemon.h>
#include "sendreplydialog.h"
#include "sms-debug.h"
K_PLUGIN_CLASS_WITH_JSON(SmsPlugin, "kdeconnect_sms.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SMS, "kdeconnect.plugin.sms")
SmsPlugin::SmsPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, m_telepathyInterface(QStringLiteral("org.freedesktop.Telepathy.ConnectionManager.kdeconnect"), QStringLiteral("/kdeconnect"))
......
......@@ -85,8 +85,6 @@
*/
#define PACKET_TYPE_SMS_REQUEST_CONVERSATION QStringLiteral("kdeconnect.sms.request_conversation")
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SMS)
class Q_DECL_EXPORT SmsPlugin
: public KdeConnectPlugin
{
......
......@@ -22,22 +22,19 @@
#include <KPluginFactory>
#include <QDebug>
#include <QLoggingCategory>
#include <QProcess>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <core/device.h>
#include "systemvolume-debug.h"
#include <PulseAudioQt/Sink>
#include <PulseAudioQt/Context>
K_PLUGIN_CLASS_WITH_JSON(SystemvolumePlugin, "kdeconnect_systemvolume.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SYSTEMVOLUME, "kdeconnect.plugin.systemvolume")
SystemvolumePlugin::SystemvolumePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
, sinksMap()
......
......@@ -28,9 +28,9 @@
#include <KPluginFactory>
#include <KNotification>
K_PLUGIN_CLASS_WITH_JSON(TelephonyPlugin, "kdeconnect_telephony.json")
#include "telephony-debug.h"
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY, "kdeconnect.plugin.telephony")
K_PLUGIN_CLASS_WITH_JSON(TelephonyPlugin, "kdeconnect_telephony.json")
TelephonyPlugin::TelephonyPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
......
......@@ -22,7 +22,6 @@
#ifndef TELEPHONYPLUGIN_H
#define TELEPHONYPLUGIN_H
#include <QLoggingCategory>
#include <QDBusInterface>
#include <KNotification>
......@@ -45,8 +44,6 @@
#define PACKET_TYPE_TELEPHONY_REQUEST_MUTE QStringLiteral("kdeconnect.telephony.request_mute")
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY)
class TelephonyPlugin
: public KdeConnectPlugin
{
......
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