2020-05-05 12:53:41 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2020 Aditya Mehra <aix.m@outlook.com>
|
2020-05-05 12:53:41 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2020-05-05 12:53:41 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "bigscreenplugin.h"
|
|
|
|
|
|
|
|
#include <KLocalizedString>
|
|
|
|
#include <KPluginFactory>
|
|
|
|
|
|
|
|
#include <QDBusConnection>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QDebug>
|
2020-05-05 12:53:41 +01:00
|
|
|
#include <QLoggingCategory>
|
|
|
|
|
|
|
|
#include <core/daemon.h>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <core/device.h>
|
2020-05-05 12:53:41 +01:00
|
|
|
|
|
|
|
K_PLUGIN_CLASS_WITH_JSON(BigscreenPlugin, "kdeconnect_bigscreen.json")
|
|
|
|
|
|
|
|
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BIGSCREEN, "kdeconnect.plugin.bigscreen")
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
BigscreenPlugin::BigscreenPlugin(QObject *parent, const QVariantList &args)
|
2020-05-05 12:53:41 +01:00
|
|
|
: KdeConnectPlugin(parent, args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BigscreenPlugin::~BigscreenPlugin() = default;
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
bool BigscreenPlugin::receivePacket(const NetworkPacket &np)
|
2020-05-05 12:53:41 +01:00
|
|
|
{
|
|
|
|
QString message = np.get<QString>(QStringLiteral("content"));
|
2020-11-14 03:32:21 +00:00
|
|
|
/* Emit a signal that will be consumed by Plasma BigScreen:
|
|
|
|
* https://invent.kde.org/plasma/plasma-bigscreen/-/blob/master/containments/homescreen/package/contents/ui/indicators/KdeConnect.qml
|
|
|
|
*/
|
2020-05-05 12:53:41 +01:00
|
|
|
Q_EMIT messageReceived(message);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString BigscreenPlugin::dbusPath() const
|
|
|
|
{
|
|
|
|
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/bigscreen");
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "bigscreenplugin.moc"
|