[SystemVolumePlugin][PulseAudio] Send data about default audio device

This commit is contained in:
Art Pinch 2020-11-23 18:17:30 +03:00 committed by Simon Redman
parent 69898ca553
commit ebd7e53440

View file

@ -80,12 +80,20 @@ void SystemvolumePlugin::sendSinkList() {
sendPacket(np); sendPacket(np);
}); });
connect(sink, &PulseAudioQt::Sink::defaultChanged, this, [this, sink] {
NetworkPacket np(PACKET_TYPE_SYSTEMVOLUME);
np.set<bool>(QStringLiteral("enabled"), sink->isDefault());
np.set<QString>(QStringLiteral("name"), sink->name());
sendPacket(np);
});
QJsonObject sinkObject { QJsonObject sinkObject {
{QStringLiteral("name"), sink->name()}, {QStringLiteral("name"), sink->name()},
{QStringLiteral("muted"), sink->isMuted()}, {QStringLiteral("muted"), sink->isMuted()},
{QStringLiteral("description"), sink->description()}, {QStringLiteral("description"), sink->description()},
{QStringLiteral("volume"), sink->volume()}, {QStringLiteral("volume"), sink->volume()},
{QStringLiteral("maxVolume"), PulseAudioQt::normalVolume()} {QStringLiteral("maxVolume"), PulseAudioQt::normalVolume()},
{QStringLiteral("enabled"), sink->isDefault()}
}; };
array.append(sinkObject); array.append(sinkObject);