Commit cf2967b9 authored by Aditya Mehra's avatar Aditya Mehra Committed by Philip Cohn-Cort
Browse files

Add Bigscreen plugin with support for Bigscreen STT packet type

parent e084ae45
......@@ -65,6 +65,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
qmlRegisterUncreatableType<RemoteCommandsDbusInterface>(uri, 1, 0, "RemoteCommandsDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterUncreatableType<RemoteSystemVolumeDbusInterface>(uri, 1, 0, "RemoteSystemVolumeInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterUncreatableType<ShareDbusInterface>(uri, 1, 0, "ShareDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterUncreatableType<BigscreenDbusInterface>(uri, 1, 0, "BigscreenDbusInterface", QStringLiteral("You're not supposed to instantiate interfaces"));
qmlRegisterSingletonType<DaemonDbusInterface>(uri, 1, 0, "DaemonDbusInterface",
[](QQmlEngine*, QJSEngine*) -> QObject* {
return new DaemonDbusInterface;
......@@ -89,6 +90,7 @@ void KdeConnectDeclarativePlugin::registerTypes(const char* uri)
registerFactory<RemoteCommandsDbusInterface>(uri, "RemoteCommandsDbusInterfaceFactory");
registerFactory<ShareDbusInterface>(uri, "ShareDbusInterfaceFactory");
registerFactory<RemoteSystemVolumeDbusInterface>(uri, "RemoteSystemVolumeDbusInterfaceFactory");
registerFactory<BigscreenDbusInterface>(uri, "BigscreenDbusInterfaceFactory");
}
void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const char* uri)
......
......@@ -38,6 +38,7 @@ geninterface(${PROJECT_SOURCE_DIR}/plugins/sms/smsplugin.h smsinterface)
geninterface(${PROJECT_SOURCE_DIR}/plugins/sms/conversationsdbusinterface.h conversationsinterface)
geninterface(${PROJECT_SOURCE_DIR}/plugins/share/shareplugin.h shareinterface)
geninterface(${PROJECT_SOURCE_DIR}/plugins/remotesystemvolume/remotesystemvolumeplugin.h remotesystemvolumeinterface)
geninterface(${PROJECT_SOURCE_DIR}/plugins/bigscreen/bigscreenplugin.h bigscreeninterface)
add_library(kdeconnectinterfaces ${libkdeconnect_SRC})
set_target_properties(kdeconnectinterfaces PROPERTIES
......
......@@ -199,3 +199,12 @@ RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString&
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), DBusHelper::sessionBus(), parent)
{
}
BigscreenDbusInterface::BigscreenDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceBigscreenInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/bigscreen"), DBusHelper::sessionBus(), parent)
{
}
BigscreenDbusInterface::~BigscreenDbusInterface()
{
}
......@@ -39,6 +39,7 @@
#include "conversationsinterface.h"
#include "shareinterface.h"
#include "remotesystemvolumeinterface.h"
#include "bigscreeninterface.h"
/**
* Using these "proxy" classes just in case we need to rename the
......@@ -240,6 +241,15 @@ public:
~RemoteSystemVolumeDbusInterface() = default;
};
class KDECONNECTINTERFACES_EXPORT BigscreenDbusInterface
: public OrgKdeKdeconnectDeviceBigscreenInterface
{
Q_OBJECT
public:
explicit BigscreenDbusInterface(const QString& deviceId, QObject* parent = nullptr);
~BigscreenDbusInterface() override;
};
template <typename T, typename W>
static void setWhenAvailable(const QDBusPendingReply<T>& pending, W func, QObject* parent)
{
......
......@@ -9,6 +9,7 @@ add_subdirectory(remotecontrol)
add_subdirectory(remotesystemvolume)
add_subdirectory(clipboard)
add_subdirectory(runcommand)
add_subdirectory(bigscreen)
if(NOT APPLE)
add_subdirectory(presenter)
......
set(kdeconnect_bigscreen_SRCS
bigscreenplugin.cpp
)
kdeconnect_add_plugin(kdeconnect_bigscreen JSON kdeconnect_bigscreen.json SOURCES ${kdeconnect_bigscreen_SRCS})
target_link_libraries(kdeconnect_bigscreen kdeconnectcore Qt5::DBus KF5::I18n)
/**
* Copyright 2020 Aditya Mehra <aix.m@outlook.com>
*
* 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/>.
*/
#include "bigscreenplugin.h"
#include <KLocalizedString>
#include <KPluginFactory>
#include <QDebug>
#include <QDBusConnection>
#include <QLoggingCategory>
#include <core/device.h>
#include <core/daemon.h>
K_PLUGIN_CLASS_WITH_JSON(BigscreenPlugin, "kdeconnect_bigscreen.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BIGSCREEN, "kdeconnect.plugin.bigscreen")
BigscreenPlugin::BigscreenPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
}
BigscreenPlugin::~BigscreenPlugin() = default;
bool BigscreenPlugin::receivePacket(const NetworkPacket& np)
{
QString message = np.get<QString>(QStringLiteral("content"));
Q_EMIT messageReceived(message);
return true;
}
QString BigscreenPlugin::dbusPath() const
{
return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/bigscreen");
}
#include "bigscreenplugin.moc"
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* Copyright 2020 Aditya Mehra <aix.m@outlook.com>
*
* 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 BIGSCREENPLUGIN_H
#define BIGSCREENPLUGIN_H
#include <core/kdeconnectplugin.h>
#define PACKET_TYPE_BIGSCREEN_STT QStringLiteral("kdeconnect.bigscreen.stt")
class Q_DECL_EXPORT BigscreenPlugin
: public KdeConnectPlugin
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.bigscreen")
public:
explicit BigscreenPlugin(QObject* parent, const QVariantList& args);
~BigscreenPlugin() override;
bool receivePacket(const NetworkPacket& np) override;
void connected() override {};
QString dbusPath() const override;
Q_SIGNALS:
Q_SCRIPTABLE void messageReceived(const QString& message);
};
#endif
{
"KPlugin": {
"Authors": [
{
"Email": "aix.m@outlook.com",
"Name": "Aditya Mehra"
}
],
"Description": "Bigscreen Plugin",
"EnabledByDefault": true,
"Icon": "dialog-ok",
"Id": "kdeconnect_bigscreen",
"License": "GPL",
"Name": "Bigscreen",
"ServiceTypes": [
"KdeConnect/Plugin"
],
"Version": "0.1",
"Website": "https://aiix.tk"
},
"X-KdeConnect-OutgoingPacketType": [
"kdeconnect.mousepad.request",
"kdeconnect.bigscreen.stt"
],
"X-KdeConnect-SupportedPacketType": [
"kdeconnect.bigscreen.stt"
]
}
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