Projects
Eulaceura:Factory
kiran-control-panel
_service:obs_scm:0000-fix-audio-when-the-tray-i...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0000-fix-audio-when-the-tray-is-initialized-determine-whe.patch of Package kiran-control-panel
From 278237ebcb646037d6c77ebbbf3a9629d2b086c0 Mon Sep 17 00:00:00 2001 From: luoqing <luoqing@kylinsec.com.cn> Date: Fri, 23 Feb 2024 14:27:17 +0800 Subject: [PATCH 0/1] fix(audio):when the tray is initialized, determine whether there is asound card,if not, the volume icon is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 托盘初始化时,判断是否存在声卡,若不存在则音量图标显示禁用 Related #22865 --- plugins/audio/src/system-tray/audio-system-tray.cpp | 10 +++++++--- plugins/audio/src/system-tray/volume-setting-page.cpp | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/audio/src/system-tray/audio-system-tray.cpp b/plugins/audio/src/system-tray/audio-system-tray.cpp index 5b2522f..c4b726c 100644 --- a/plugins/audio/src/system-tray/audio-system-tray.cpp +++ b/plugins/audio/src/system-tray/audio-system-tray.cpp @@ -83,9 +83,13 @@ void AudioSystemTray::initMixedSettingPage() void AudioSystemTray::initTrayIcon() { - QDBusPendingReply<QString> defaultSinkPath = m_audioInterface->GetDefaultSink(); - AudioDeviceInterface defaultSink (AUDIO_DBUS_NAME, defaultSinkPath, QDBusConnection::sessionBus()); - double currentVolumeDouble = defaultSink.volume() * 100; + double currentVolumeDouble = 0; + if(!m_audioInterface->getCards().isEmpty()) + { + QDBusPendingReply<QString> defaultSinkPath = m_audioInterface->GetDefaultSink(); + AudioDeviceInterface defaultSink (AUDIO_DBUS_NAME, defaultSinkPath, QDBusConnection::sessionBus()); + currentVolumeDouble = defaultSink.volume() * 100; + } setTrayIcon(round(currentVolumeDouble)); } diff --git a/plugins/audio/src/system-tray/volume-setting-page.cpp b/plugins/audio/src/system-tray/volume-setting-page.cpp index b2dcb62..1925c8d 100644 --- a/plugins/audio/src/system-tray/volume-setting-page.cpp +++ b/plugins/audio/src/system-tray/volume-setting-page.cpp @@ -296,6 +296,7 @@ void VolumeSettingPage::disableSettings() ui->volume->setText(QString::number(0) + "%"); ui->volumeSetting->setEnabled(false); setVolumeIcon(0); + emit volumeChanged(0); } void VolumeSettingPage::hideLine() -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2