2018-11-07 19:54:00 +00:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
2018-11-07 19:54:00 +00: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
|
2018-11-07 19:54:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef REMOTESYSTEMVOLUMEPLUGIN_H
|
|
|
|
#define REMOTESYSTEMVOLUMEPLUGIN_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include <core/kdeconnectplugin.h>
|
|
|
|
|
|
|
|
#define PACKET_TYPE_SYSTEMVOLUME QStringLiteral("kdeconnect.systemvolume")
|
|
|
|
#define PACKET_TYPE_SYSTEMVOLUME_REQUEST QStringLiteral("kdeconnect.systemvolume.request")
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
class Q_DECL_EXPORT RemoteSystemVolumePlugin : public KdeConnectPlugin
|
2018-11-07 19:54:00 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotesystemvolume")
|
|
|
|
Q_PROPERTY(QByteArray sinks READ sinks NOTIFY sinksChanged)
|
|
|
|
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
|
|
|
|
|
|
|
|
public:
|
2022-09-10 22:23:52 +01:00
|
|
|
explicit RemoteSystemVolumePlugin(QObject *parent, const QVariantList &args);
|
2018-11-07 19:54:00 +00:00
|
|
|
~RemoteSystemVolumePlugin() override;
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
bool receivePacket(const NetworkPacket &np) override;
|
2018-11-07 19:54:00 +00:00
|
|
|
void connected() override;
|
|
|
|
QString dbusPath() const override;
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
QString deviceId() const
|
|
|
|
{
|
|
|
|
return device()->id();
|
|
|
|
}
|
2018-11-07 19:54:00 +00:00
|
|
|
QByteArray sinks();
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
Q_SCRIPTABLE void sendVolume(const QString &name, int volume);
|
|
|
|
Q_SCRIPTABLE void sendMuted(const QString &name, bool muted);
|
2018-11-07 19:54:00 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
Q_SCRIPTABLE void sinksChanged();
|
2022-09-10 22:23:52 +01:00
|
|
|
Q_SCRIPTABLE void volumeChanged(const QString &name, int volume);
|
|
|
|
Q_SCRIPTABLE void mutedChanged(const QString &name, bool muted);
|
2018-11-07 19:54:00 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QByteArray m_sinks;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // REMOTESYSTEMVOLUMEPLUGIN_H
|