[vlc-commits] qml: link to NetworkView when ml is empty

Pierre Lamot git at videolan.org
Fri Feb 14 12:00:10 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Feb 11 12:50:40 2020 +0100| [48343649beb9d4bbb0200ffac24934e82f4f22f3] | committer: Jean-Baptiste Kempf

qml: link to NetworkView when ml is empty

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

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

 modules/gui/qt/medialibrary/qml/MusicAlbums.qml    | 11 +++-----
 .../qt/medialibrary/qml/MusicArtistsDisplay.qml    | 19 ++++++++------
 modules/gui/qt/medialibrary/qml/MusicGenres.qml    | 11 +++-----
 .../qt/medialibrary/qml/MusicTrackListDisplay.qml  | 11 --------
 .../gui/qt/medialibrary/qml/MusicTracksDisplay.qml | 29 ++++++++++++++++------
 modules/gui/qt/medialibrary/qml/VideoDisplay.qml   | 12 ++++-----
 6 files changed, 46 insertions(+), 47 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
index 4375e406ab..cee4bdf1fb 100644
--- a/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicAlbums.qml
@@ -211,7 +211,7 @@ Widgets.NavigableFocusScope {
         id: view
 
         anchors.fill: parent
-        focus: true
+        focus: delegateModel.items.count !== 0
 
         initialItem: medialib.gridView ? gridComponent : listComponent
 
@@ -235,14 +235,11 @@ Widgets.NavigableFocusScope {
         }
     }
 
-    Label {
+    EmptyLabel {
         anchors.fill: parent
-        horizontalAlignment: Text.AlignHCenter
-        verticalAlignment: Text.AlignVCenter
         visible: delegateModel.items.count === 0
-        font.pixelSize: VLCStyle.fontHeight_xxlarge
-        color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
-        wrapMode: Text.WordWrap
+        focus: visible
         text: i18n.qtr("No albums found\nPlease try adding sources, by going to the Network tab")
+        navigationParent: root
     }
 }
diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
index 5d59eb5e0f..d4e35e4286 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
@@ -112,9 +112,14 @@ Widgets.NavigableFocusScope {
             view.forceActiveFocus()
         }
     }
+
+    FocusScope {
+        visible: delegateModel.count > 0
+        focus: visible
+        anchors.fill: parent
+
     Row {
         anchors.fill: parent
-        visible: delegateModel.items.count > 0
 
         Widgets.KeyNavigableListView {
             id: artistList
@@ -191,15 +196,13 @@ Widgets.NavigableFocusScope {
 
         }
     }
+    }
 
-    Label {
+    EmptyLabel {
         anchors.fill: parent
-        horizontalAlignment: Text.AlignHCenter
-        verticalAlignment: Text.AlignVCenter
-        visible: delegateModel.items.count === 0
-        font.pixelSize: VLCStyle.fontHeight_xxlarge
-        color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
-        wrapMode: Text.WordWrap
+        visible: delegateModel.count === 0
+        focus: visible
         text: i18n.qtr("No artists found\nPlease try adding sources, by going to the Network tab")
+        navigationParent: root
     }
 }
diff --git a/modules/gui/qt/medialibrary/qml/MusicGenres.qml b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
index d0a8c3840f..d87dfa901d 100644
--- a/modules/gui/qt/medialibrary/qml/MusicGenres.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
@@ -228,17 +228,14 @@ Widgets.NavigableFocusScope {
         initialItem: medialib.gridView ? gridComponent : listComponent
 
         anchors.fill: parent
-        focus: true
+        focus: delegateModel.items.count !== 0
     }
 
-    Label {
+    EmptyLabel {
         anchors.fill: parent
-        horizontalAlignment: Text.AlignHCenter
-        verticalAlignment: Text.AlignVCenter
         visible: delegateModel.items.count === 0
-        font.pixelSize: VLCStyle.fontHeight_xxlarge
-        color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
-        wrapMode: Text.WordWrap
+        focus: visible
         text: i18n.qtr("No genres found\nPlease try adding sources, by going to the Network tab")
+        navigationParent: root
     }
 }
diff --git a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
index 137d4043f0..1c28ef9e87 100644
--- a/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
@@ -90,15 +90,4 @@ Widgets.KeyNavigableTableView {
         }
         medialib.addAndPlay(list)
     }
-
-    Label {
-        anchors.fill: parent
-        horizontalAlignment: Text.AlignHCenter
-        verticalAlignment: Text.AlignVCenter
-        visible: delegateModel.items.count === 0
-        font.pixelSize: VLCStyle.fontHeight_xxlarge
-        color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
-        wrapMode: Text.WordWrap
-        text: i18n.qtr("No tracks found\nPlease try adding sources, by going to the Network tab")
-    }
 }
diff --git a/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml b/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
index bcd71a8f92..5d9b02c3a1 100644
--- a/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
@@ -20,15 +20,30 @@ import QtQuick.Controls 2.4
 import org.videolan.medialib 0.1
 
 import "qrc:///style/"
+import "qrc:///widgets/" as Widgets
 
+Widgets.NavigableFocusScope {
+    id: root
 
-MusicTrackListDisplay {
-    id: tracklistdisplay_id
+    MusicTrackListDisplay {
+        id: tracklistdisplay_id
+        anchors.fill: parent
+        visible: tracklistdisplay_id.delegateModel.count > 0
+        focus: visible
+        navigationParent: root
+        navigationCancel: function() {
+            if (tracklistdisplay_id.currentIndex <= 0)
+                defaultNavigationCancel()
+            else
+                tracklistdisplay_id.currentIndex = 0;
+        }
+    }
 
-    navigationCancel: function() {
-        if (tracklistdisplay_id.currentIndex <= 0)
-            defaultNavigationCancel()
-        else
-            tracklistdisplay_id.currentIndex = 0;
+    EmptyLabel {
+        anchors.fill: parent
+        visible: tracklistdisplay_id.delegateModel.count === 0
+        focus: visible
+        text: i18n.qtr("No tracks found\nPlease try adding sources, by going to the Network tab")
+        navigationParent: root
     }
 }
diff --git a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
index 8cac270b2e..459cb884c4 100644
--- a/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoDisplay.qml
@@ -238,7 +238,7 @@ Widgets.NavigableFocusScope {
         id: view
         anchors.fill:parent
         clip: true
-        focus: true
+        focus: videosDelegate.items.count !== 0
         initialItem: medialib.gridView ? gridComponent : listComponent
         Connections {
             target: medialib
@@ -251,14 +251,12 @@ Widgets.NavigableFocusScope {
         }
 
     }
-    Label {
+
+    EmptyLabel {
         anchors.fill: parent
-        horizontalAlignment: Text.AlignHCenter
-        verticalAlignment: Text.AlignVCenter
         visible: videosDelegate.items.count === 0
-        font.pixelSize: VLCStyle.fontHeight_xxlarge
-        color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
-        wrapMode: Text.WordWrap
+        focus: visible
         text: i18n.qtr("No video found\nPlease try adding sources, by going to the Network tab")
+        navigationParent: root
     }
 }



More information about the vlc-commits mailing list