fix: 修复控制中心禁用所有声音输出设备后,通过任务栏点击音量的开/关,声音变为输出状态的bug

问题:全部声卡禁用后,任务栏取消静音的情况下,可以听见声音输出,
修复方法:在声卡全部禁用后,置灰静音按钮和右键菜单静音选项,其他情况逻辑不变.

Bug: https://pms.uniontech.com/zentao/bug-view-86853.html
Log: 优化任务栏声音插件
Influence: 华为云音量调节
Change-Id: Ifee21868f64f26165d077016b9cb4f16f2dced85
(cherry picked from commit 9f84ddb8ddbc1e6b5e79abcf91afc1fea2ac2687)
This commit is contained in:
WenTao Song 2021-07-15 15:45:21 +08:00 committed by wubowen
parent 531075d5b1
commit 2396cd2b31
2 changed files with 6 additions and 7 deletions

View File

@ -650,6 +650,7 @@ bool SoundApplet::eventFilter(QObject *watcher, QEvent *event)
if (watcher == m_volumeIconMin && event->type() == QEvent::MouseButtonRelease) {
m_defSinkInter->SetMuteQueued(!m_defSinkInter->mute());
}
return false;
}

View File

@ -88,14 +88,12 @@ const QString SoundItem::contextMenu()
QMap<QString, QVariant> open;
open["itemId"] = MUTE;
// 如果没有可用输出设备,直接显示静音菜单不可用
if (!m_applet->existActiveOutputDevice()) {
if (m_sinkInter->mute()) {
open["itemText"] = tr("Unmute");
open["isActive"] = false;
} else if (m_sinkInter->mute()) {
open["itemText"] = tr("Unmute");
open["isActive"] = true;
if (!m_applet->existActiveOutputDevice())
open["isActive"] = false;
else
open["isActive"] = true;
} else {
open["itemText"] = tr("Mute");
open["isActive"] = true;