[vlc-devel] [PATCH] qml: update automatic switch to player view policy

Pierre Lamot pierre at videolabs.io
Mon Jul 29 16:56:13 CEST 2019


  This fix an issue where the UI would navigate back in its history
  when a video media ends while using the mini-player

  the new policy is:

  * go to the player view when video tracks are reported with the player
    in playing state.

  * go to the previous view when the player stops from the player view
---
 modules/gui/qt/qml/MainInterface.qml | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt/qml/MainInterface.qml b/modules/gui/qt/qml/MainInterface.qml
index bbd72add75..9535d8ba27 100644
--- a/modules/gui/qt/qml/MainInterface.qml
+++ b/modules/gui/qt/qml/MainInterface.qml
@@ -124,18 +124,22 @@ Rectangle {
             focus: true
 
             Connections {
-                target: player.videoTracks
+                target: player
+                onPlayingStateChanged: {
+                    if (player.playingState === PlayerController.PLAYING_STATE_STOPPED
+                        && history.current.view === "player") {
+                        history.previous(History.Go)
+                    }
+                }
+            }
 
+            Connections {
+                target: player.videoTracks
                 onDataChanged: {
-                    var nbVideoTracks = player.videoTracks.rowCount()
-
-                    if (nbVideoTracks > 0) {
-                        if (history.current.view !== "player")
-                            history.push(["player"], History.Go)
-                    }
-                    else {
-                        if (history.current.view === "player")
-                            history.previous(History.Go)
+                    if (player.videoTracks.rowCount() > 0
+                        && player.playingState === PlayerController.PLAYING_STATE_PLAYING
+                        && history.current.view !== "player") {
+                        history.push(["player"], History.Go)
                     }
                 }
             }
-- 
2.17.1



More information about the vlc-devel mailing list