Compare strings like regular human beings

This commit is contained in:
Albert Vaca Cintora 2023-05-25 16:20:37 +02:00
parent 39050f9844
commit 92f0e467ae

View file

@ -72,6 +72,7 @@ public:
HRESULT STDMETHODCALLTYPE OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) override HRESULT STDMETHODCALLTYPE OnNotify(PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) override
{ {
qWarning("OnNotify");
NetworkPacket np(PACKET_TYPE_SYSTEMVOLUME); NetworkPacket np(PACKET_TYPE_SYSTEMVOLUME);
np.set<int>(QStringLiteral("volume"), (int)(pNotify->fMasterVolume * 100)); np.set<int>(QStringLiteral("volume"), (int)(pNotify->fMasterVolume * 100));
np.set<bool>(QStringLiteral("muted"), pNotify->bMuted); np.set<bool>(QStringLiteral("muted"), pNotify->bMuted);
@ -433,8 +434,7 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np)
// get current sink's device ID // get current sink's device ID
QString qDefaultId = QString::fromWCharArray(defaultId); QString qDefaultId = QString::fromWCharArray(defaultId);
QString currentDeviceId = idToNameMap.key(name); QString currentDeviceId = idToNameMap.key(name);
if (qDefaultId != currentDeviceId) {
if ((bool)qDefaultId.compare(currentDeviceId)) {
setDefaultAudioPlaybackDevice(name, np.get<bool>(QStringLiteral("enabled"))); setDefaultAudioPlaybackDevice(name, np.get<bool>(QStringLiteral("enabled")));
} }
} }