[vlc-devel] [PATCH 08/11] qml: change the no-medialibrary views

Pierre Lamot pierre at videolabs.io
Fri Oct 9 12:07:38 CEST 2020


---
 modules/gui/qt/Makefile.am                    |  1 +
 .../qt/maininterface/qml/MainInterface.qml    |  5 +--
 .../qt/maininterface/qml/NoMedialibHome.qml   | 44 +++++++++++++++++++
 .../gui/qt/medialibrary/qml/MainDisplay.qml   | 13 ++++--
 modules/gui/qt/vlc.qrc                        |  1 +
 5 files changed, 58 insertions(+), 6 deletions(-)
 create mode 100644 modules/gui/qt/maininterface/qml/NoMedialibHome.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index dae227fbe1..b7538b43f1 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -615,6 +615,7 @@ libqt_plugin_la_QML = \
 	gui/qt/dialogs/toolbar/qml/ToolbarEditorButtonList.qml \
 	gui/qt/maininterface/qml/BannerSources.qml \
 	gui/qt/maininterface/qml/MainInterface.qml \
+	gui/qt/maininterface/qml/NoMedialibHome.qml \
 	gui/qt/medialibrary/qml/ArtistTopBanner.qml \
 	gui/qt/medialibrary/qml/AudioGridItem.qml \
 	gui/qt/medialibrary/qml/EmptyLabel.qml \
diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
index 477464eb6f..a59293dc7e 100644
--- a/modules/gui/qt/maininterface/qml/MainInterface.qml
+++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
@@ -74,7 +74,6 @@ Rectangle {
     readonly property var pageModel: [
         { name: "about", url: "qrc:///about/About.qml" },
         { name: "mc", url: "qrc:///medialibrary/MainDisplay.qml" },
-        { name: "playlist", url: "qrc:///playlist/PlaylistMainView.qml" },
         { name: "player", url:"qrc:///player/Player.qml" },
     ]
 
@@ -101,7 +100,7 @@ Rectangle {
             if (medialib)
                 history.push(["mc", "video"])
             else
-                history.push(["playlist"])
+                history.push(["mc", "home"])
         }
     }
 
@@ -143,7 +142,7 @@ Rectangle {
                             if (medialib)
                                 history.push(["mc", "video"])
                             else
-                                history.push(["playlist"])
+                                history.push(["mc", "home"])
                         }
                         else
                             history.previous()
diff --git a/modules/gui/qt/maininterface/qml/NoMedialibHome.qml b/modules/gui/qt/maininterface/qml/NoMedialibHome.qml
new file mode 100644
index 0000000000..bf6fead43f
--- /dev/null
+++ b/modules/gui/qt/maininterface/qml/NoMedialibHome.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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 "qrc:///style/"
+import "qrc:///widgets/" as Widgets
+
+Widgets.NavigableFocusScope {
+
+    Column {
+        anchors.centerIn: parent
+
+        spacing: VLCStyle.margin_small
+
+        Image {
+            id: dropImg
+            source: "qrc:///dropzone.svg"
+            anchors.horizontalCenter: parent.horizontalCenter
+            height: VLCStyle.dp(150, VLCStyle.scale)
+            width: VLCStyle.dp(150, VLCStyle.scale)
+        }
+
+        Widgets.MenuLabel {
+            anchors .horizontalCenter: parent.horizontalCenter
+            text: i18n.qtr("Drag & Drop some content here!")
+        }
+    }
+
+}
diff --git a/modules/gui/qt/medialibrary/qml/MainDisplay.qml b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
index 32c6ee7fea..da75867033 100644
--- a/modules/gui/qt/medialibrary/qml/MainDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
@@ -42,7 +42,8 @@ Widgets.NavigableFocusScope {
     onViewPropertiesChanged: loadView()
     Component.onCompleted: {
         loadView()
-        medialib.reload()
+        if (medialib)
+            medialib.reload()
     }
 
     function loadView() {
@@ -87,17 +88,23 @@ Widgets.NavigableFocusScope {
 
     readonly property var pageModel: [
         {
-            listed: true,
+            listed: !!medialib,
             displayText: i18n.qtr("Video"),
             icon: VLCIcons.topbar_video,
             name: "video",
             url: "qrc:///medialibrary/VideoDisplay.qml"
         }, {
-            listed: true,
+            listed: !!medialib,
             displayText: i18n.qtr("Music"),
             icon: VLCIcons.topbar_music,
             name: "music",
             url: "qrc:///medialibrary/MusicDisplay.qml"
+        }, {
+            listed: !medialib,
+            displayText: i18n.qtr("Home"),
+            icon: VLCIcons.home,
+            name: "home",
+            url: "qrc:///main/NoMedialibHome.qml"
         }, {
             listed: true,
             displayText: i18n.qtr("Network"),
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 1bd998f2a3..946c4a2c04 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -178,6 +178,7 @@
     <qresource prefix="/main">
         <file alias="BannerSources.qml">maininterface/qml/BannerSources.qml</file>
         <file alias="MainInterface.qml">maininterface/qml/MainInterface.qml</file>
+        <file alias="NoMedialibHome.qml">maininterface/qml/NoMedialibHome.qml</file>
     </qresource>
     <qresource prefix="/widgets">
         <file alias="BannerTabButton.qml">widgets/qml/BannerTabButton.qml</file>
-- 
2.25.1



More information about the vlc-devel mailing list