fix: Media player auto-switching in Control Center

Detailed Explanation:
  Addresses an issue where the media player would automatically
switch,overriding user's manual selections when the Control Center was
open.

  The core problem was that the automatic player detection logic was too
aggressive and didn't respect explicit user choices. Previous attempts
to pause auto-switching based on UI visibility were unreliable due to
incorrect event handling for the custom NPanel component.
This commit is contained in:
loner
2025-11-01 02:15:44 +08:00
parent cf12b98351
commit 3b166bd270
3 changed files with 26 additions and 2 deletions
+1 -2
View File
@@ -179,8 +179,7 @@ NBox {
onTriggered: function (action) {
var index = parseInt(action)
if (!isNaN(index)) {
MediaService.selectedPlayerIndex = index
MediaService.updateCurrentPlayer()
MediaService.switchToPlayer(index)
}
}
}
@@ -63,6 +63,14 @@ NPanel {
readonly property int weatherHeight: Math.round(190 * Style.uiScaleRatio)
readonly property int mediaSysMonHeight: Math.round(260 * Style.uiScaleRatio)
onOpened: {
MediaService.autoSwitchingPaused = true
}
onClosed: {
MediaService.autoSwitchingPaused = false
}
panelContent: Item {
id: content