[vlc-commits] qt: Don't load the media center view when a playback will start

Hugo Beauzée-Luyssen git at videolan.org
Thu Jan 9 16:54:47 CET 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Nov 27 18:05:33 2019 +0100| [20f18bf815715f5dda9318cabc3b48a4f819db5d] | committer: Hugo Beauzée-Luyssen

qt: Don't load the media center view when a playback will start

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

 modules/gui/qt/maininterface/qml/MainInterface.qml | 38 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
index db1e3014c5..84b436ad17 100644
--- a/modules/gui/qt/maininterface/qml/MainInterface.qml
+++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
@@ -33,6 +33,8 @@ import QtQuick.Window 2.11
 Rectangle {
     id: root
     color: "transparent"
+    property bool _interfaceReady: false
+    property bool _playlistReady: false
 
     Loader {
         id: playlistWindowLoader
@@ -53,6 +55,12 @@ Rectangle {
     PlaylistControllerModel {
         id: mainPlaylistController
         playlistPtr: mainctx.playlist
+
+        onPlaylistInitialized: {
+            root._playlistReady = true
+            if (root._interfaceReady)
+                setInitialView()
+        }
     }
 
     Component {
@@ -94,12 +102,24 @@ Rectangle {
         onCurrentChanged: loadCurrentHistoryView()
     }
 
-    Component.onCompleted: {
+    function setInitialView() {
         //set the initial view
-        if (medialib)
-            history.push(["mc", "video"], History.Go)
+        if (!mainPlaylistController.empty)
+            history.push(["player"], History.Go)
         else
-            history.push(["playlist"], History.Go)
+        {
+            if (medialib)
+                history.push(["mc", "video"], History.Go)
+            else
+                history.push(["playlist"], History.Go)
+        }
+    }
+
+
+    Component.onCompleted: {
+        root._interfaceReady = true;
+        if (root._playlistReady)
+            setInitialView()
     }
 
 
@@ -128,7 +148,15 @@ Rectangle {
                 onPlayingStateChanged: {
                     if (player.playingState === PlayerController.PLAYING_STATE_STOPPED
                             && history.current.view === "player") {
-                        history.previous(History.Go)
+                        if (history.previousEmpty)
+                        {
+                            if (medialib)
+                                history.push(["mc", "video"], History.Go)
+                            else
+                                history.push(["playlist"], History.Go)
+                        }
+                        else
+                            history.previous(History.Go)
                     }
                 }
             }



More information about the vlc-commits mailing list