fix(editor): remove redundant audio device disabled toast on each tab - #519
Merged
deepin-bot[bot] merged 1 commit intoAug 13, 2026
Merged
Conversation
When audio devices are disabled via control center, each TextEdit instance (tab) subscribes to com.deepin.daemon.Audio PortEnabledChanged signal and proactively shows a "no audio device" float message. With N tabs open, N toasts fire simultaneously, which is unwanted. The on-demand device checks in slotVoiceReadingAction and slotdictationAction remain intact, so the user still gets a prompt when actively clicking voice reading or dictation. 音频设备被禁用时,每个标签页主动弹出"无音频设备"提示,多标签页 重复弹窗不符合预期。移除构造函数的 PortEnabledChanged 信号订阅 和 onAudioPortEnabledChanged 槽函数,保留按需设备检查。 Log: 移除音频设备禁用时每个标签页主动弹出提示的逻辑 PMS: BUG-373361 Influence: 控制中心禁用音频设备后,文本编辑器不再向所有标签页弹出"无音频设备"提示;用户主动点击语音朗读/听写时的按需提示不受影响
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves the per-tab DBus subscription to the audio daemon’s PortEnabledChanged signal and its handler, leaving only the on-demand audio device checks triggered by voice reading/dictation actions so that disabling devices no longer spams a toast on every open editor tab. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 无需改进,当前 diff 即为最佳实践。
// 移除越权的 DBus 监听逻辑,保持文本编辑器的纯粹性。
// 若后续确实需要提示用户音频设备异常,应通过系统级全局通知机制统一处理,
// 而非在单个应用内通过 DBus 直连底层 daemon 弹窗。 |
max-lvs
approved these changes
Aug 13, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: max-lvs, tianming-1996 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因分析
每个标签页对应的
TextEdit在构造函数(src/editor/dtextedit.cpp:143-146)中订阅了音频守护进程com.deepin.daemon.Audio的PortEnabledChanged信号,并在回调onAudioPortEnabledChanged(dtextedit.cpp:8280-8316)中于设备被禁用时主动向自身弹浮窗提示。N 个标签页 = N 个订阅者,因此控制中心禁用设备时每个标签页各弹一次"未检测到音频输出/输入设备"提示,与 bug 现象"多标签页均提示"一致。该逻辑由提交c0461e00(Task 378245)引入,后续04a5e042(Bug 323813)仅改按需路径,未触及本路径,release/eagleHEAD 仍存在。修复方案
移除"主动监听并弹窗"的路径,保留"用户主动点击语音功能时的按需检查":
dtextedit.cpp构造函数中对PortEnabledChanged的 DBus 订阅。onAudioPortEnabledChanged槽函数实现及其在头文件的声明。checkAudioOutputDevice()/checkAudioInputDevice()及其在slotVoiceReadingAction/slotdictationAction中的按需调用——用户主动点击语音朗读/听写时仍会给出"无设备"提示。按需路径与主动弹窗路径完全独立:
checkAudio*Device()是同步 DBus 方法调用,不依赖被删除的信号;onAudioPortEnabledChanged回调体内不含任何dbus-send/QProcess/TextToSpeech调用,从不启动或控制朗读。改动安全评估
低风险。
onAudioPortEnabledChanged仅被本类构造函数内部的 DBus 订阅使用,全仓库无第三个引用点(reference_count=2,均为本次删除对象)。删除订阅与删除声明成对进行,内部自洽,无外部调用者受影响。不修改任何函数签名,不触碰保留的按需检查与语音朗读/听写执行链路。PMS: BUG-373361
Summary by Sourcery
Remove automatic audio device state monitoring in the editor to avoid duplicate device-disabled toasts across multiple tabs while preserving on-demand checks when users trigger voice features.
Bug Fixes:
Enhancements: