Remove requestSinks
from SystemVolume plugin
Sinks are sent at connect time and updated as necessary, so drop the request command. See: https://invent.kde.org/network/kdeconnect-meta/-/merge_requests/8
This commit is contained in:
parent
daf09c61d8
commit
ad7d3dd964
5 changed files with 47 additions and 67 deletions
|
@ -56,13 +56,6 @@ void RemoteSystemVolumePlugin::sendMuted(const QString &name, bool muted)
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteSystemVolumePlugin::connected()
|
|
||||||
{
|
|
||||||
NetworkPacket np(PACKET_TYPE_SYSTEMVOLUME_REQUEST);
|
|
||||||
np.set<bool>(QStringLiteral("requestSinks"), true);
|
|
||||||
sendPacket(np);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray RemoteSystemVolumePlugin::sinks()
|
QByteArray RemoteSystemVolumePlugin::sinks()
|
||||||
{
|
{
|
||||||
return m_sinks;
|
return m_sinks;
|
||||||
|
|
|
@ -24,7 +24,6 @@ public:
|
||||||
using KdeConnectPlugin::KdeConnectPlugin;
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
void connected() override;
|
|
||||||
QString dbusPath() const override;
|
QString dbusPath() const override;
|
||||||
|
|
||||||
QString deviceId() const
|
QString deviceId() const
|
||||||
|
|
|
@ -221,9 +221,6 @@ SystemvolumePlugin::~SystemvolumePlugin()
|
||||||
|
|
||||||
void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
if (np.has(QStringLiteral("requestSinks"))) {
|
|
||||||
sendSinkList();
|
|
||||||
} else {
|
|
||||||
QString name = np.get<QString>(QStringLiteral("name"));
|
QString name = np.get<QString>(QStringLiteral("name"));
|
||||||
|
|
||||||
if (m_sinksMap.contains(name)) {
|
if (m_sinksMap.contains(name)) {
|
||||||
|
@ -237,7 +234,6 @@ void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
m_sinksMap[name]->setDefault(np.get<bool>(QStringLiteral("enabled")));
|
m_sinksMap[name]->setDefault(np.get<bool>(QStringLiteral("enabled")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemvolumePlugin::sendSinkList()
|
void SystemvolumePlugin::sendSinkList()
|
||||||
|
|
|
@ -33,9 +33,6 @@ void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
if (!PulseAudioQt::Context::instance()->isValid())
|
if (!PulseAudioQt::Context::instance()->isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (np.has(QStringLiteral("requestSinks"))) {
|
|
||||||
sendSinkList();
|
|
||||||
} else {
|
|
||||||
QString name = np.get<QString>(QStringLiteral("name"));
|
QString name = np.get<QString>(QStringLiteral("name"));
|
||||||
|
|
||||||
PulseAudioQt::Sink *sink = sinksMap.value(name);
|
PulseAudioQt::Sink *sink = sinksMap.value(name);
|
||||||
|
@ -52,7 +49,6 @@ void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
sink->setDefault(np.get<bool>(QStringLiteral("enabled")));
|
sink->setDefault(np.get<bool>(QStringLiteral("enabled")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemvolumePlugin::sendSinkList()
|
void SystemvolumePlugin::sendSinkList()
|
||||||
|
|
|
@ -404,9 +404,6 @@ void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
if (!valid)
|
if (!valid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (np.has(QStringLiteral("requestSinks"))) {
|
|
||||||
sendSinkList();
|
|
||||||
} else {
|
|
||||||
QString name = np.get<QString>(QStringLiteral("name"));
|
QString name = np.get<QString>(QStringLiteral("name"));
|
||||||
|
|
||||||
auto sinkListIterator = this->sinkList.find(name);
|
auto sinkListIterator = this->sinkList.find(name);
|
||||||
|
@ -438,7 +435,6 @@ void SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_systemvolumeplugin-win.cpp"
|
#include "moc_systemvolumeplugin-win.cpp"
|
||||||
|
|
Loading…
Reference in a new issue