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

Pierre Lamot git at videolan.org
Tue Jul 30 17:42:49 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Jul 29 16:56:13 2019 +0200| [e672c0d8010e46b5c32af26d8dca38f53f6e9fc5] | committer: Jean-Baptiste Kempf

qml: update automatic switch to player view policy

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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e672c0d8010e46b5c32af26d8dca38f53f6e9fc5
---

 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)
                     }
                 }
             }



More information about the vlc-commits mailing list