Commit 22b176c
fix: [Audio] Unify audio device detection and adapt DBus service for Qt version
This commit consolidates the duplicate audio device detection logic and adapts
the DBus service selection based on Qt version:
1. In iflytek_ai_assistant.cpp:
- Add Qt version check to select appropriate DBus service
- Qt >= 6.0: uses "org.deepin.dde.Audio1" (new DDE audio service)
- Qt < 6.0: uses "com.deepin.daemon.Audio" (legacy audio service)
2. In dtextedit.cpp:
- Remove duplicate checkAudioOutputDevice() and checkAudioInputDevice() methods
- Update onAudioPortEnabledChanged() to use IflytekAiAssistant's unified methods
- Add Qt version check for DBus signal connection to PortEnabledChanged
3. In dtextedit.h:
- Remove declarations of checkAudioOutputDevice() and checkAudioInputDevice()
This refactoring eliminates code duplication by using IflytekAiAssistant as
the single source of truth for audio device detection, improving maintainability
and ensuring consistent behavior across the application.
本次提交整合了重复的音频设备检测逻辑,并根据Qt版本适配不同的DBus服务:
1. iflytek_ai_assistant.cpp:
- 添加Qt版本判断来选择合适的DBus服务
- Qt >= 6.0: 使用 "org.deepin.dde.Audio1" (新版DDE音频服务)
- Qt < 6.0: 使用 "com.deepin.daemon.Audio" (旧版音频服务)
2. dtextedit.cpp:
- 删除重复的 checkAudioOutputDevice() 和 checkAudioInputDevice() 方法
- 修改 onAudioPortEnabledChanged() 使用 IflytekAiAssistant 的统一方法
- 为 PortEnabledChanged 信号连接添加Qt版本判断
3. dtextedit.h:
- 删除 checkAudioOutputDevice() 和 checkAudioInputDevice() 的声明
此次重构消除了代码重复,使用 IflytekAiAssistant 作为音频设备检测的唯一
入口,提高了代码可维护性并确保应用程序行为的一致性。
Log: fix: [Audio] Unify audio device detection and adapt DBus service for Qt version1 parent 5cd3fcb commit 22b176c
3 files changed
Lines changed: 21 additions & 72 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
| 155 | + | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
| |||
9241 | 9248 | | |
9242 | 9249 | | |
9243 | 9250 | | |
9244 | | - | |
9245 | | - | |
9246 | | - | |
9247 | | - | |
9248 | | - | |
9249 | | - | |
9250 | | - | |
9251 | | - | |
9252 | | - | |
9253 | | - | |
9254 | | - | |
9255 | | - | |
9256 | | - | |
9257 | | - | |
9258 | | - | |
9259 | | - | |
9260 | | - | |
9261 | | - | |
9262 | | - | |
9263 | | - | |
9264 | | - | |
9265 | | - | |
9266 | | - | |
9267 | | - | |
9268 | | - | |
9269 | | - | |
9270 | | - | |
9271 | | - | |
9272 | | - | |
9273 | | - | |
9274 | | - | |
9275 | | - | |
9276 | | - | |
9277 | | - | |
9278 | | - | |
9279 | | - | |
9280 | | - | |
9281 | | - | |
9282 | | - | |
9283 | | - | |
9284 | | - | |
9285 | | - | |
9286 | | - | |
9287 | | - | |
9288 | | - | |
9289 | | - | |
9290 | | - | |
9291 | | - | |
9292 | | - | |
9293 | | - | |
9294 | | - | |
9295 | | - | |
9296 | | - | |
9297 | | - | |
9298 | | - | |
9299 | | - | |
9300 | | - | |
9301 | | - | |
9302 | | - | |
9303 | | - | |
9304 | 9251 | | |
9305 | 9252 | | |
9306 | 9253 | | |
9307 | 9254 | | |
9308 | | - | |
| 9255 | + | |
9309 | 9256 | | |
9310 | 9257 | | |
9311 | 9258 | | |
9312 | | - | |
9313 | | - | |
9314 | | - | |
| 9259 | + | |
| 9260 | + | |
| 9261 | + | |
9315 | 9262 | | |
9316 | 9263 | | |
9317 | 9264 | | |
| |||
9320 | 9267 | | |
9321 | 9268 | | |
9322 | 9269 | | |
9323 | | - | |
| 9270 | + | |
9324 | 9271 | | |
9325 | 9272 | | |
9326 | 9273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 535 | + | |
540 | 536 | | |
541 | 537 | | |
542 | 538 | | |
| |||
0 commit comments