kdeconnect_add_plugin: Autogenerate logging category

This is far less code and allows for an easier enforcing of standards, for
example the name of the log identifiers which were adjusted in a few cases.

Also clean up unused includes when noticed.
This commit is contained in:
Alexander Lohnau 2023-08-06 12:00:02 +02:00
parent 7feb3bdd0d
commit ed1e24d231
45 changed files with 62 additions and 239 deletions

View file

@ -1,9 +1,17 @@
# SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# Function to create the plugin and generate a logging category for it
function(kdeconnect_add_plugin plugin_name)
kcoreaddons_add_plugin(${plugin_name} ${ARGN} INSTALL_NAMESPACE kdeconnect)
function(kdeconnect_add_plugin)
kcoreaddons_add_plugin(${ARGN} INSTALL_NAMESPACE kdeconnect)
string(REPLACE "kdeconnect_" "" PlUGIN_WITHOUT_PREFIX "${plugin_name}") # For the file name and description, we don't want this
string(TOUPPER "${PlUGIN_WITHOUT_PREFIX}" PLUGIN_UPPER) # The identifier is all capy
ecm_qt_declare_logging_category(${plugin_name}
HEADER plugin_${PlUGIN_WITHOUT_PREFIX}_debug.h
IDENTIFIER KDECONNECT_PLUGIN_${PLUGIN_UPPER} CATEGORY_NAME kdeconnect.plugin.${PlUGIN_WITHOUT_PREFIX}
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin ${PlUGIN_WITHOUT_PREFIX})")
endfunction()
function(kdeconnect_add_kcm plugin)

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_battery SOURCES batteryplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_battery
HEADER plugin_battery_debug.h
IDENTIFIER KDECONNECT_PLUGIN_BATTERY CATEGORY_NAME kdeconnect.plugin.battery
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin battery)")
target_link_libraries(kdeconnect_battery
kdeconnectcore
Qt::DBus

View file

@ -1,5 +1,4 @@
kdeconnect_add_plugin(kdeconnect_bigscreen SOURCES bigscreenplugin.cpp)
target_link_libraries(kdeconnect_bigscreen
kdeconnectcore
kdeconnectinterfaces

View file

@ -18,8 +18,6 @@
K_PLUGIN_CLASS_WITH_JSON(BigscreenPlugin, "kdeconnect_bigscreen.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BIGSCREEN, "kdeconnect.plugin.bigscreen")
void BigscreenPlugin::receivePacket(const NetworkPacket &np)
{
QString message = np.get<QString>(QStringLiteral("content"));

View file

@ -1,11 +1,5 @@
kdeconnect_add_plugin(kdeconnect_clipboard SOURCES clipboardplugin.cpp clipboardlistener.cpp)
ecm_qt_declare_logging_category(kdeconnect_clipboard
HEADER plugin_clipboard_debug.h
IDENTIFIER KDECONNECT_PLUGIN_CLIPBOARD CATEGORY_NAME kdeconnect.plugin.clipboard
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin clipboard)")
target_link_libraries(kdeconnect_clipboard kdeconnectcore
Qt::DBus
KF${QT_MAJOR_VERSION}::GuiAddons

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_connectivity_report SOURCES connectivity_reportplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_connectivity_report
HEADER plugin_connectivity_report_debug.h
IDENTIFIER KDECONNECT_PLUGIN_CONNECTIVITY_REPORT CATEGORY_NAME kdeconnect.plugin.connectivity_report
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin connectivity_report)")
target_link_libraries(kdeconnect_connectivity_report
kdeconnectcore
Qt::DBus

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_contacts SOURCES contactsplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_contacts
HEADER plugin_contacts_debug.h
IDENTIFIER KDECONNECT_PLUGIN_CONTACTS CATEGORY_NAME kdeconnect.plugin.contacts
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin contacts)")
target_link_libraries(kdeconnect_contacts
kdeconnectcore
Qt::DBus

View file

@ -1,9 +1,3 @@
set(kdeconnect_findmyphone_SRCS
findmyphoneplugin.cpp
)
kdeconnect_add_plugin(kdeconnect_findmyphone SOURCES ${kdeconnect_findmyphone_SRCS})
kdeconnect_add_plugin(kdeconnect_findmyphone SOURCES findmyphoneplugin.cpp)
target_link_libraries(kdeconnect_findmyphone kdeconnectcore Qt::Core Qt::DBus)

View file

@ -1,11 +1,5 @@
kdeconnect_add_plugin(kdeconnect_findthisdevice SOURCES findthisdeviceplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_findthisdevice
HEADER plugin_findthisdevice_debug.h
IDENTIFIER KDECONNECT_PLUGIN_FINDTHISDEVICE CATEGORY_NAME kdeconnect.plugin.findthisdevice
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin findthisdevice)")
target_link_libraries(kdeconnect_findthisdevice
kdeconnectcore
Qt::Core

View file

@ -1,17 +1,10 @@
kdeconnect_add_plugin(kdeconnect_lockdevice)
if (WIN32)
list(APPEND lockdevice_SRCS lockdeviceplugin-win.cpp)
target_sources(kdeconnect_lockdevice PRIVATE lockdeviceplugin-win.cpp)
else ()
list(APPEND lockdevice_SRCS lockdeviceplugin.cpp)
target_sources(kdeconnect_lockdevice PRIVATE lockdeviceplugin.cpp)
endif()
kdeconnect_add_plugin(kdeconnect_lockdevice SOURCES ${lockdevice_SRCS})
ecm_qt_declare_logging_category(kdeconnect_lockdevice
HEADER plugin_lock_debug.h
IDENTIFIER KDECONNECT_PLUGIN_LOCKREMOTE CATEGORY_NAME kdeconnect.plugin.lock
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin lockremote)")
target_link_libraries(kdeconnect_lockdevice
kdeconnectcore
kdeconnectinterfaces

View file

@ -8,8 +8,6 @@
#include <KLocalizedString>
#include <KPluginFactory>
#include "plugin_lock_debug.h"
#include <QDebug>
#include <core/daemon.h>

View file

@ -9,7 +9,7 @@
#include <KLocalizedString>
#include <KPluginFactory>
#include "plugin_lock_debug.h"
#include "plugin_lockdevice_debug.h"
#include <QDebug>
#include <core/daemon.h>
@ -27,11 +27,11 @@ LockDevicePlugin::LockDevicePlugin(QObject *parent, const QVariantList &args)
, m_propertiesInterface(QStringLiteral("org.freedesktop.login1"), QString(), QDBusConnection::systemBus())
{
if (!m_login1Interface.isValid()) {
qCWarning(KDECONNECT_PLUGIN_LOCKREMOTE) << "Could not connect to logind interface" << m_login1Interface.lastError();
qCWarning(KDECONNECT_PLUGIN_LOCKDEVICE) << "Could not connect to logind interface" << m_login1Interface.lastError();
}
if (!m_propertiesInterface.isValid()) {
qCWarning(KDECONNECT_PLUGIN_LOCKREMOTE) << "Could not connect to logind properties interface" << m_propertiesInterface.lastError();
qCWarning(KDECONNECT_PLUGIN_LOCKDEVICE) << "Could not connect to logind properties interface" << m_propertiesInterface.lastError();
}
connect(&m_propertiesInterface,

View file

@ -1,11 +1,4 @@
kdeconnect_add_plugin(kdeconnect_mmtelephony SOURCES mmtelephonyplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_mmtelephony
HEADER plugin_mmtelephony_debug.h
IDENTIFIER KDECONNECT_PLUGIN_MMTELEPHONY CATEGORY_NAME kdeconnect.plugin.mmtelephony
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin mmtelephony)")
target_link_libraries(kdeconnect_mmtelephony
kdeconnectcore
Qt::DBus

View file

@ -6,7 +6,6 @@
#include "abstractremoteinput.h"
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MOUSEPAD, "kdeconnect.plugin.mousepad")
AbstractRemoteInput::AbstractRemoteInput(QObject *parent)
: QObject(parent)
{

View file

@ -9,10 +9,9 @@
#include <QLoggingCategory>
#include <QObject>
#include "plugin_mousepad_debug.h"
#include <core/networkpacket.h>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MOUSEPAD)
class AbstractRemoteInput : public QObject
{
Q_OBJECT

View file

@ -10,12 +10,6 @@ endif()
kdeconnect_add_plugin(kdeconnect_mpriscontrol SOURCES ${kdeconnect_mpriscontrol_SRCS})
ecm_qt_declare_logging_category(kdeconnect_mpriscontrol
HEADER plugin_mpris_debug.h
IDENTIFIER KDECONNECT_PLUGIN_MPRIS CATEGORY_NAME kdeconnect.plugin.mpris
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin mpris)")
if(WIN32)
target_link_libraries(kdeconnect_mpriscontrol kdeconnectcore windowsapp)
else()

View file

@ -5,8 +5,8 @@
*/
#include "mpriscontrolplugin-win.h"
#include "plugin_mpris_debug.h"
#include "plugin_mpriscontrol_debug.h"
#include <core/device.h>
#include <KPluginFactory>
@ -37,7 +37,7 @@ std::optional<QString> MprisControlPlugin::getPlayerName(GlobalSystemMediaTransp
auto entry = std::find(this->playerList.constBegin(), this->playerList.constEnd(), player);
if (entry == this->playerList.constEnd()) {
qCWarning(KDECONNECT_PLUGIN_MPRIS) << "PlaybackInfoChanged received for no longer tracked session" << player.SourceAppUserModelId().c_str();
qCWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "PlaybackInfoChanged received for no longer tracked session" << player.SourceAppUserModelId().c_str();
return std::nullopt;
}
@ -172,7 +172,7 @@ void MprisControlPlugin::updatePlayerList()
try {
playerName = AppInfo::GetFromAppUserModelId(playerName).DisplayInfo().DisplayName();
} catch (winrt::hresult_error e) {
qCDebug(KDECONNECT_PLUGIN_MPRIS) << QString::fromWCharArray(playerName.c_str()) << "doesn\'t have a valid AppUserModelID! Sending as-is..";
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << QString::fromWCharArray(playerName.c_str()) << "doesn\'t have a valid AppUserModelID! Sending as-is..";
}
#endif
QString uniqueName = QString::fromWCharArray(playerName.c_str());
@ -248,7 +248,7 @@ bool MprisControlPlugin::sendAlbumArt(std::variant<NetworkPacket, QString> const
GlobalSystemMediaTransportControlsSession const &player,
QString artUrl)
{
qWarning(KDECONNECT_PLUGIN_MPRIS) << "Sending Album Art";
qWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "Sending Album Art";
NetworkPacket np = packetOrName.index() == 0 ? std::get<0>(packetOrName) : NetworkPacket(PACKET_TYPE_MPRIS);
if (packetOrName.index() == 1)
np.set(QStringLiteral("player"), std::get<1>(packetOrName));
@ -320,11 +320,11 @@ void MprisControlPlugin::receivePacket(const NetworkPacket &np)
}
}
if (np.has(QStringLiteral("setVolume"))) {
qWarning(KDECONNECT_PLUGIN_MPRIS) << "Setting volume is not supported";
qWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "Setting volume is not supported";
}
if (np.has(QStringLiteral("Seek"))) {
TimeSpan offset = std::chrono::microseconds(np.get<int>(QStringLiteral("Seek")));
qWarning(KDECONNECT_PLUGIN_MPRIS) << "Seeking" << offset.count() << "ns to" << name;
qWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "Seeking" << offset.count() << "ns to" << name;
player.TryChangePlaybackPositionAsync((player.GetTimelineProperties().Position() + offset).count()).get();
}

View file

@ -20,7 +20,7 @@
#include "generated/systeminterfaces/dbusproperties.h"
#include "generated/systeminterfaces/mprisplayer.h"
#include "generated/systeminterfaces/mprisroot.h"
#include "plugin_mpris_debug.h"
#include "plugin_mpriscontrol_debug.h"
K_PLUGIN_CLASS_WITH_JSON(MprisControlPlugin, "kdeconnect_mpriscontrol.json")
@ -61,12 +61,12 @@ void MprisControlPlugin::serviceOwnerChanged(const QString &serviceName, const Q
return;
if (!oldOwner.isEmpty()) {
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "MPRIS service" << serviceName << "just went offline";
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "MPRIS service" << serviceName << "just went offline";
removePlayer(serviceName);
}
if (!newOwner.isEmpty()) {
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "MPRIS service" << serviceName << "just came online";
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "MPRIS service" << serviceName << "just came online";
addPlayer(serviceName);
}
}
@ -94,7 +94,7 @@ void MprisControlPlugin::addPlayer(const QString &service)
connect(player.propertiesInterface(), &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, this, &MprisControlPlugin::propertiesChanged);
connect(player.mediaPlayer2PlayerInterface(), &OrgMprisMediaPlayer2PlayerInterface::Seeked, this, &MprisControlPlugin::seeked);
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Mpris addPlayer" << service << "->" << uniqueName;
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "Mpris addPlayer" << service << "->" << uniqueName;
sendPlayerList();
}
@ -107,7 +107,7 @@ void MprisControlPlugin::seeked(qlonglong position)
return (player.mediaPlayer2PlayerInterface() == mediaPlayer2PlayerInterface);
});
if (it == end) {
qCWarning(KDECONNECT_PLUGIN_MPRIS) << "Seeked signal received for no longer tracked service" << mediaPlayer2PlayerInterface->service();
qCWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "Seeked signal received for no longer tracked service" << mediaPlayer2PlayerInterface->service();
return;
}
@ -127,7 +127,7 @@ void MprisControlPlugin::propertiesChanged(const QString & /*propertyInterface*/
return (player.propertiesInterface() == propertiesInterface);
});
if (it == end) {
qCWarning(KDECONNECT_PLUGIN_MPRIS) << "PropertiesChanged signal received for no longer tracked service" << propertiesInterface->service();
qCWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "PropertiesChanged signal received for no longer tracked service" << propertiesInterface->service();
return;
}
@ -202,12 +202,12 @@ void MprisControlPlugin::removePlayer(const QString &serviceName)
return (player.serviceName() == serviceName);
});
if (it == end) {
qCWarning(KDECONNECT_PLUGIN_MPRIS) << "Could not find player for serviceName" << serviceName;
qCWarning(KDECONNECT_PLUGIN_MPRISCONTROL) << "Could not find player for serviceName" << serviceName;
return;
}
const QString &playerName = it.key();
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Mpris removePlayer" << serviceName << "->" << playerName;
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "Mpris removePlayer" << serviceName << "->" << playerName;
playerList.erase(it);
@ -287,17 +287,17 @@ void MprisControlPlugin::receivePacket(const NetworkPacket &np)
}
if (np.has(QStringLiteral("setLoopStatus"))) {
const QString &loopStatus = np.get<QString>(QStringLiteral("setLoopStatus"));
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting loopStatus" << loopStatus << "to" << serviceName;
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "Setting loopStatus" << loopStatus << "to" << serviceName;
mprisInterface.setLoopStatus(loopStatus);
}
if (np.has(QStringLiteral("setShuffle"))) {
bool shuffle = np.get<bool>(QStringLiteral("setShuffle"));
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting shuffle" << shuffle << "to" << serviceName;
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "Setting shuffle" << shuffle << "to" << serviceName;
mprisInterface.setShuffle(shuffle);
}
if (np.has(QStringLiteral("setVolume"))) {
double volume = np.get<int>(QStringLiteral("setVolume")) / 100.f;
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting volume" << volume << "to" << serviceName;
qCDebug(KDECONNECT_PLUGIN_MPRISCONTROL) << "Setting volume" << volume << "to" << serviceName;
mprisInterface.setVolume(volume);
}
if (np.has(QStringLiteral("Seek"))) {

View file

@ -6,11 +6,6 @@ target_sources(kdeconnect_mprisremote PRIVATE
mprisremoteplayermediaplayer2.cpp
mprisremoteplayermediaplayer2player.cpp
)
ecm_qt_declare_logging_category(kdeconnect_mprisremote
HEADER plugin_mprisremote_debug.h
IDENTIFIER KDECONNECT_PLUGIN_MPRISREMOTE CATEGORY_NAME kdeconnect.plugin.mprisremote
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin mprisremote)")
target_link_libraries(kdeconnect_mprisremote
kdeconnectcore
Qt::DBus

View file

@ -1,12 +1,6 @@
kdeconnect_add_plugin(kdeconnect_notifications SOURCES sendreplydialog.cpp notificationsplugin.cpp notification.cpp)
ki18n_wrap_ui(kdeconnect_notifications sendreplydialog.ui)
ecm_qt_declare_logging_category(kdeconnect_notifications
HEADER plugin_notification_debug.h
IDENTIFIER KDECONNECT_PLUGIN_NOTIFICATION CATEGORY_NAME kdeconnect.plugin.notification
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin notification)")
target_link_libraries(kdeconnect_notifications
kdeconnectcore
Qt::DBus

View file

@ -5,7 +5,7 @@
*/
#include "notification.h"
#include "plugin_notification_debug.h"
#include "plugin_notifications_debug.h"
#include <KLocalizedString>
#include <KNotification>
@ -148,7 +148,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();
} else {
applyIcon();
}

View file

@ -6,7 +6,7 @@
#include "notificationsplugin.h"
#include "plugin_notification_debug.h"
#include "plugin_notifications_debug.h"
#include "sendreplydialog.h"
#include <dbushelper.h>
@ -31,7 +31,7 @@ void NotificationsPlugin::connected()
void NotificationsPlugin::receivePacket(const NetworkPacket &np)
{
if (np.get<bool>(QStringLiteral("request"))) {
qCWarning(KDECONNECT_PLUGIN_NOTIFICATION) << "Unexpected notification request. Maybe the paired client is very old?";
qCWarning(KDECONNECT_PLUGIN_NOTIFICATIONS) << "Unexpected notification request. Maybe the paired client is very old?";
}
if (np.get<bool>(QStringLiteral("isCancel"))) {
@ -89,7 +89,7 @@ void NotificationsPlugin::addNotification(Notification *noti)
removeNotification(internalId);
}
// qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "addNotification" << internalId;
// qCDebug(KDECONNECT_PLUGIN_NOTIFICATIONS) << "addNotification" << internalId;
connect(noti, &Notification::dismissRequested, this, &NotificationsPlugin::dismissRequested);
@ -114,10 +114,10 @@ void NotificationsPlugin::addNotification(Notification *noti)
void NotificationsPlugin::removeNotification(const QString &internalId)
{
// qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "removeNotification" << internalId;
// qCDebug(KDECONNECT_PLUGIN_NOTIFICATIONS) << "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;
}
@ -125,7 +125,7 @@ void NotificationsPlugin::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;
}

View file

@ -6,12 +6,6 @@ else()
target_sources(kdeconnect_pausemusic PRIVATE pausemusicplugin.cpp)
endif()
ecm_qt_declare_logging_category(kdeconnect_pausemusic
HEADER plugin_pausemusic_debug.h
IDENTIFIER KDECONNECT_PLUGIN_PAUSEMUSIC CATEGORY_NAME kdeconnect.plugin.pausemusic
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin pausemusic)")
target_link_libraries(kdeconnect_pausemusic
kdeconnectcore
kdeconnectinterfaces

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_photo SOURCES photoplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_photo
HEADER plugin_photo_debug.h
IDENTIFIER KDECONNECT_PLUGIN_PHOTO CATEGORY_NAME kdeconnect.plugin.photo
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin photo)")
target_link_libraries(kdeconnect_photo
kdeconnectcore
Qt::DBus

View file

@ -1,11 +1,4 @@
kdeconnect_add_plugin(kdeconnect_ping SOURCES pingplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_ping
HEADER plugin_ping_debug.h
IDENTIFIER KDECONNECT_PLUGIN_PING CATEGORY_NAME kdeconnect.plugin.ping
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin ping)")
target_link_libraries(kdeconnect_ping
kdeconnectcore
Qt::DBus

View file

@ -1,11 +1,6 @@
qt_add_resources(presenter_SRCS assets.qrc)
kdeconnect_add_plugin(kdeconnect_presenter SOURCES presenterplugin.cpp ${presenter_SRCS})
ecm_qt_declare_logging_category(kdeconnect_presenter
HEADER plugin_presenter_debug.h
IDENTIFIER KDECONNECT_PLUGIN_PRESENT CATEGORY_NAME kdeconnect.plugin.presenter
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin presenter)")
target_link_libraries(kdeconnect_presenter
kdeconnectcore

View file

@ -44,7 +44,7 @@ public:
const auto ourErrors = errors();
for (const auto &error : ourErrors) {
qCWarning(KDECONNECT_PLUGIN_PRESENT) << "error" << error.description() << error.url() << error.line() << error.column();
qCWarning(KDECONNECT_PLUGIN_PRESENTER) << "error" << error.description() << error.url() << error.line() << error.column();
}
}
};

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_remotecommands SOURCES remotecommandsplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_remotecommands
HEADER plugin_remotecommands_debug.h
IDENTIFIER KDECONNECT_PLUGIN_REMOTECOMMANDS CATEGORY_NAME kdeconnect.plugin.remotecommands
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin remotecommands)")
target_link_libraries(kdeconnect_remotecommands
kdeconnectcore
Qt::DBus

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_remotecontrol SOURCES remotecontrolplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_remotecontrol
HEADER plugin_remotecontrol_debug.h
IDENTIFIER KDECONNECT_PLUGIN_REMOTECONTROL CATEGORY_NAME kdeconnect.plugin.remotecontrol
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin remotecontrol)")
target_link_libraries(kdeconnect_remotecontrol
kdeconnectcore
Qt::DBus

View file

@ -1,11 +1,4 @@
kdeconnect_add_plugin(kdeconnect_remotekeyboard SOURCES remotekeyboardplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_remotekeyboard
HEADER plugin_remotekeyboard_debug.h
IDENTIFIER KDECONNECT_PLUGIN_REMOTEKEYBOARD CATEGORY_NAME kdeconnect.plugin.remotekeyboard
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin remotekeyboard)")
target_link_libraries(kdeconnect_remotekeyboard
kdeconnectcore
Qt::DBus

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_remotesystemvolume SOURCES remotesystemvolumeplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_remotesystemvolume
HEADER plugin_remotesystemvolume_debug.h
IDENTIFIER KDECONNECT_PLUGIN_REMOTESYSTEMVOLUME CATEGORY_NAME kdeconnect.plugin.remotesystemvolume
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin remotesystemvolume)")
target_link_libraries(kdeconnect_remotesystemvolume
kdeconnectcore
Qt::DBus

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_runcommand SOURCES runcommandplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_runcommand
HEADER plugin_runcommand_debug.h
IDENTIFIER KDECONNECT_PLUGIN_RUNCOMMAND CATEGORY_NAME kdeconnect.plugin.runcommand
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin runcommand)")
target_link_libraries(kdeconnect_runcommand
kdeconnectcore
Qt::DBus

View file

@ -14,13 +14,6 @@ endif()
kdeconnect_add_plugin(kdeconnect_screensaver_inhibit SOURCES ${kdeconnect_screensaver_inhibit_SRCS})
ecm_qt_declare_logging_category(kdeconnect_screensaver_inhibit
HEADER kdeconnect_screensaverinhibit_debug.h
IDENTIFIER KDECONNECT_PLUGIN_SCREENSAVERINHIBIT CATEGORY_NAME kdeconnect.plugin.screensaverinhibit
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin screensaverinhibit)")
target_link_libraries(kdeconnect_screensaver_inhibit kdeconnectcore kdeconnectinterfaces)
if(NOT APPLE AND NOT WIN32)
target_link_libraries(kdeconnect_screensaver_inhibit

View file

@ -6,7 +6,7 @@
#include "screensaverinhibitplugin-macos.h"
#include "kdeconnect_screensaverinhibit_debug.h"
#include "plugin_screensaver_inhibit_debug.h"
#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(ScreensaverInhibitPlugin, "kdeconnect_screensaver_inhibit.json")
@ -21,7 +21,7 @@ ScreensaverInhibitPlugin::ScreensaverInhibitPlugin(QObject *parent, const QVaria
m_caffeinateProcess->setArguments({QStringLiteral("-d")}); // Prevent the display from sleeping
m_caffeinateProcess->start();
} else {
qWarning(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Cannot find caffeinate on macOS install";
qWarning(KDECONNECT_PLUGIN_SCREENSAVER_INHIBIT) << "Cannot find caffeinate on macOS install";
}
}

View file

@ -6,7 +6,6 @@
#include "screensaverinhibitplugin-win.h"
#include "kdeconnect_screensaverinhibit_debug.h"
#include <KPluginFactory>
#include <Windows.h>

View file

@ -7,7 +7,6 @@
#include "screensaverinhibitplugin.h"
#include "generated/systeminterfaces/screensaver.h"
#include "kdeconnect_screensaverinhibit_debug.h"
#include <KLocalizedString>
#include <KPluginFactory>
#include <QDBusConnection>

View file

@ -5,11 +5,6 @@ target_sources(kdeconnect_sendnotifications PRIVATE
notificationslistener.cpp
notifyingapplication.cpp
)
ecm_qt_declare_logging_category(kdeconnect_sendnotifications
HEADER plugin_sendnotification_debug.h
IDENTIFIER KDECONNECT_PLUGIN_SENDNOTIFICATION CATEGORY_NAME kdeconnect.plugin.sendnotification
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin sendnotification)")
target_link_libraries(kdeconnect_sendnotifications
kdeconnectcore
Qt::DBus

View file

@ -25,7 +25,7 @@
#include <dbushelper.h>
#include "notifyingapplication.h"
#include "plugin_sendnotification_debug.h"
#include "plugin_sendnotifications_debug.h"
#include "sendnotificationsplugin.h"
NotificationsListener::NotificationsListener(KdeConnectPlugin *aPlugin)
@ -60,7 +60,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin *aPlugin)
NotificationsListener::~NotificationsListener()
{
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Destroying NotificationsListener";
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Destroying NotificationsListener";
g_dbus_connection_remove_filter(m_gdbusConnection, m_gdbusFilterId);
g_object_unref(m_gdbusConnection);
}
@ -70,7 +70,8 @@ void NotificationsListener::setTranslatedAppName()
QString filePath =
QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("knotifications5/kdeconnect.notifyrc"), QStandardPaths::LocateFile);
if (filePath.isEmpty()) {
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Couldn't find kdeconnect.notifyrc to hide kdeconnect notifications on the devices. Using default name.";
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS)
<< "Couldn't find kdeconnect.notifyrc to hide kdeconnect notifications on the devices. Using default name.";
m_translatedAppName = QStringLiteral("KDE Connect");
return;
}
@ -90,7 +91,7 @@ void NotificationsListener::loadApplications()
m_applications.insert(app.name, app);
}
}
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Loaded" << applications.size() << " applications";
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Loaded" << applications.size() << " applications";
}
bool NotificationsListener::parseImageDataArgument(GVariant *argument,
@ -163,9 +164,9 @@ QSharedPointer<QIODevice> NotificationsListener::iconForImageData(GVariant *argu
return QSharedPointer<QIODevice>();
if (bitsPerSample != 8) {
qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Unsupported image format:"
<< "width=" << width << "height=" << height << "rowStride=" << rowStride
<< "bitsPerSample=" << bitsPerSample << "channels=" << channels << "hasAlpha=" << hasAlpha;
qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Unsupported image format:"
<< "width=" << width << "height=" << height << "rowStride=" << rowStride
<< "bitsPerSample=" << bitsPerSample << "channels=" << channels << "hasAlpha=" << hasAlpha;
return QSharedPointer<QIODevice>();
}
@ -175,7 +176,7 @@ QSharedPointer<QIODevice> NotificationsListener::iconForImageData(GVariant *argu
QSharedPointer<QBuffer> buffer = QSharedPointer<QBuffer>(new QBuffer);
if (!buffer || !buffer->open(QIODevice::WriteOnly) || !image.save(buffer.data(), "PNG")) {
qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Could not initialize image buffer";
qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Could not initialize image buffer";
return QSharedPointer<QIODevice>();
}
@ -193,7 +194,7 @@ QSharedPointer<QIODevice> NotificationsListener::iconForIconName(const QString &
KIconTheme hicolor(QStringLiteral("hicolor"));
if (hicolor.isValid()) {
iconPath = hicolor.iconPath(iconName + QStringLiteral(".png"), size, KIconLoader::MatchBest);
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath;
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Found non-png icon in default theme trying fallback to hicolor:" << iconPath;
}
}
}
@ -250,7 +251,7 @@ GDBusMessage *NotificationsListener::onMessageFiltered(GDBusConnection *, GDBusM
for (const auto &a : std::as_const(listener->m_applications))
list << QVariant::fromValue<NotifyingApplication>(a);
listener->m_plugin->config()->setList(QStringLiteral("applications"), list);
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Added new application to config:" << app;
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Added new application to config:" << app;
} else {
app = listener->m_applications.value(appName);
}
@ -308,7 +309,7 @@ GDBusMessage *NotificationsListener::onMessageFiltered(GDBusConnection *, GDBusM
variant = g_variant_get_child_value(bodyVariant, 1);
const unsigned replacesId = g_variant_get_uint32(variant);
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
// qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Sending notification from" << appName << ":" <<ticker << "; appIcon=" << appIcon;
NetworkPacket np(PACKET_TYPE_NOTIFICATION,
{{QStringLiteral("id"), QString::number(replacesId > 0 ? replacesId : ++id)},
{QStringLiteral("appName"), appName},
@ -342,9 +343,9 @@ GDBusMessage *NotificationsListener::onMessageFiltered(GDBusConnection *, GDBusM
listener->m_plugin->sendPacket(np);
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) << "Got notification appName=" << appName << "replacesId=" << replacesId << "appIcon=" << appIcon
<< "summary=" << ticker << "body=" << body << "hints=" << hints.size() << "urgency=" << urgency
<< "timeout=" << timeout;
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATIONS) << "Got notification appName=" << appName << "replacesId=" << replacesId << "appIcon=" << appIcon
<< "summary=" << ticker << "body=" << body << "hints=" << hints.size() << "urgency=" << urgency
<< "timeout=" << timeout;
return nullptr;
}

View file

@ -7,7 +7,6 @@
#include "sendnotificationsplugin.h"
#include "notificationslistener.h"
#include "plugin_sendnotification_debug.h"
#include <KPluginFactory>

View file

@ -15,12 +15,6 @@ else()
endif()
kdeconnect_add_plugin(kdeconnect_sftp SOURCES ${kdeconnect_sftp_SRCS})
ecm_qt_declare_logging_category(kdeconnect_sftp
HEADER plugin_sftp_debug.h
IDENTIFIER KDECONNECT_PLUGIN_SFTP CATEGORY_NAME kdeconnect.plugin.sftp
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin sftp)")
target_link_libraries(kdeconnect_sftp
kdeconnectcore
Qt::DBus

View file

@ -1,13 +1,4 @@
kdeconnect_add_plugin(kdeconnect_share SOURCES shareplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_share
HEADER plugin_share_debug.h
IDENTIFIER KDECONNECT_PLUGIN_SHARE
CATEGORY_NAME kdeconnect.plugin.share
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde
DESCRIPTION "kdeconnect (plugin share)"
)
target_link_libraries(kdeconnect_share
kdeconnectcore
Qt::DBus
@ -18,11 +9,7 @@ target_link_libraries(kdeconnect_share
KF${QT_MAJOR_VERSION}::Service
)
#######################################
# Config
kdeconnect_add_kcm(kdeconnect_share_config SOURCES share_config.cpp)
ki18n_wrap_ui(kdeconnect_share_config share_config.ui)
target_link_libraries(kdeconnect_share_config
kdeconnectpluginkcm

View file

@ -5,12 +5,6 @@ target_sources(kdeconnect_sms PRIVATE
conversationsdbusinterface.cpp
requestconversationworker.cpp
)
ecm_qt_declare_logging_category(kdeconnect_sms
HEADER plugin_sms_debug.h
IDENTIFIER KDECONNECT_PLUGIN_SMS CATEGORY_NAME kdeconnect.plugin.sms
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin sms)")
ecm_qt_declare_logging_category(kdeconnect_sms
HEADER kdeconnect_conversations_debug.h
IDENTIFIER KDECONNECT_CONVERSATIONS CATEGORY_NAME kdeconnect.conversations

View file

@ -14,11 +14,6 @@ endif()
kdeconnect_add_plugin(kdeconnect_systemvolume SOURCES ${kdeconnect_systemvolume_SRCS})
ecm_qt_declare_logging_category(kdeconnect_systemvolume
HEADER plugin_systemvolume_debug.h
IDENTIFIER KDECONNECT_PLUGIN_SYSTEMVOLUME CATEGORY_NAME kdeconnect.plugin.systemvolume
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin systemvolume)")
if(WIN32)
target_link_libraries(kdeconnect_systemvolume
kdeconnectcore

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_telephony SOURCES telephonyplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_telephony
HEADER plugin_telephony_debug.h
IDENTIFIER KDECONNECT_PLUGIN_TELEPHONY CATEGORY_NAME kdeconnect.plugin.telephony
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin telephony)")
target_link_libraries(kdeconnect_telephony
kdeconnectcore
KF${QT_MAJOR_VERSION}::I18n

View file

@ -1,10 +1,4 @@
kdeconnect_add_plugin(kdeconnect_virtualmonitor SOURCES virtualmonitorplugin.cpp)
ecm_qt_declare_logging_category(kdeconnect_virtualmonitor
HEADER plugin_virtualmonitor_debug.h
IDENTIFIER KDECONNECT_PLUGIN_VIRTUALMONITOR CATEGORY_NAME kdeconnect.plugin.virtualmonitor
DEFAULT_SEVERITY Warning
EXPORT kdeconnect-kde DESCRIPTION "kdeconnect (plugin virtualmonitor)")
target_link_libraries(kdeconnect_virtualmonitor
kdeconnectcore
Qt::Core