[vlc-devel] [PATCH v2 10/11] qml: don't preload the detached playlist window

Pierre Lamot pierre at videolabs.io
Wed Sep 16 09:24:58 CEST 2020


---
 modules/gui/qt/Makefile.am                    |  1 +
 .../qt/maininterface/qml/MainInterface.qml    | 19 ++++------
 .../playlist/qml/PlaylistDetachedWindow.qml   | 35 +++++++++++++++++++
 modules/gui/qt/vlc.qrc                        |  1 +
 4 files changed, 44 insertions(+), 12 deletions(-)
 create mode 100644 modules/gui/qt/playlist/qml/PlaylistDetachedWindow.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 0440020af5..39860ad33b 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -656,6 +656,7 @@ libqt_plugin_la_QML = \
 	gui/qt/playlist/qml/PlaylistMainView.qml \
 	gui/qt/playlist/qml/PlaylistMenu.qml \
 	gui/qt/playlist/qml/PlaylistToolbar.qml \
+	gui/qt/playlist/qml/PlaylistDetachedWindow.qml \
 	gui/qt/style/VLCColors.qml \
 	gui/qt/style/VLCIcons.qml \
 	gui/qt/style/VLCStyle.qml \
diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
index 0002be58ea..714e637b85 100644
--- a/modules/gui/qt/maininterface/qml/MainInterface.qml
+++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
@@ -26,7 +26,6 @@ import "qrc:///style/"
 
 import "qrc:///dialogs/" as DG
 import "qrc:///playlist/" as PL
-import QtQuick.Window 2.11
 
 Rectangle {
     id: root
@@ -50,19 +49,15 @@ Rectangle {
 
     Loader {
         id: playlistWindowLoader
+        asynchronous: true
         active: !mainInterface.playlistDocked && mainInterface.playlistVisible
-        sourceComponent: Window {
-            visible: true
-            title: i18n.qtr("Playlist")
-            color: VLCStyle.colors.bg
-            onClosing: mainInterface.playlistVisible = false
-            PL.PlaylistListView {
-                id: playlistView
-                focus: true
-                anchors.fill: parent
-            }
-        }
+        source: "qrc:///playlist/PlaylistDetachedWindow.qml"
     }
+    Connections {
+        target: playlistWindowLoader.item
+        onClosing: mainInterface.playlistVisible = false
+    }
+
 
     PlaylistControllerModel {
         id: mainPlaylistController
diff --git a/modules/gui/qt/playlist/qml/PlaylistDetachedWindow.qml b/modules/gui/qt/playlist/qml/PlaylistDetachedWindow.qml
new file mode 100644
index 0000000000..9d205389c7
--- /dev/null
+++ b/modules/gui/qt/playlist/qml/PlaylistDetachedWindow.qml
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (C) 2020 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+import QtQuick 2.11
+import org.videolan.vlc 0.1
+import QtQuick.Window 2.11
+
+import "qrc:///style/"
+
+
+Window {
+    visible: true
+    title: i18n.qtr("Playlist")
+    color: VLCStyle.colors.bg
+    PlaylistListView {
+        id: playlistView
+        focus: true
+        anchors.fill: parent
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 3c565ded9f..fdcfef307c 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -271,6 +271,7 @@
         <file alias="PlaylistMenu.qml">playlist/qml/PlaylistMenu.qml</file>
         <file alias="PlaylistMainView.qml">playlist/qml/PlaylistMainView.qml</file>
         <file alias="PlaylistToolbar.qml">playlist/qml/PlaylistToolbar.qml</file>
+        <file alias="PlaylistDetachedWindow.qml">playlist/qml/PlaylistDetachedWindow.qml</file>
     </qresource>
     <qresource prefix="/menus">
         <file alias="AudioMenu.qml">menus/qml/AudioMenu.qml</file>
-- 
2.25.1



More information about the vlc-devel mailing list