Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
54480f14 by Benjamin Arnaud at 2022-06-26T11:10:51+00:00
qml: Create EmptyLabelButton

We also update the EmptyLabel implementation to make it generic.

- - - - -
11e72d64 by Benjamin Arnaud at 2022-06-26T11:10:51+00:00
qml: Create EmptyLabelHint

- - - - -
47b03903 by Benjamin Arnaud at 2022-06-26T11:10:51+00:00
qml/PlaylistMediaList: Update to EmpyLabelHint

fix #26282

- - - - -


14 changed files:

- modules/gui/qt/Makefile.am
- modules/gui/qt/medialibrary/qml/EmptyLabel.qml
- + modules/gui/qt/medialibrary/qml/EmptyLabelButton.qml
- + modules/gui/qt/medialibrary/qml/EmptyLabelHint.qml
- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/vlc.qrc
- po/POTFILES.in


Changes:

=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -762,6 +762,8 @@ libqt_plugin_la_QML = \
        gui/qt/medialibrary/qml/ArtistTopBanner.qml \
        gui/qt/medialibrary/qml/AudioGridItem.qml \
        gui/qt/medialibrary/qml/EmptyLabel.qml \
+       gui/qt/medialibrary/qml/EmptyLabelButton.qml \
+       gui/qt/medialibrary/qml/EmptyLabelHint.qml \
        gui/qt/medialibrary/qml/MediaGroupDisplay.qml \
        gui/qt/medialibrary/qml/MusicAlbums.qml \
        gui/qt/medialibrary/qml/MusicAlbumsDisplay.qml \


=====================================
modules/gui/qt/medialibrary/qml/EmptyLabel.qml
=====================================
@@ -26,85 +26,82 @@ import "qrc:///widgets/" as Widgets
 FocusScope {
     id: root
 
-    property alias text: label.text
-    property alias showBrowseButton: browseButton.visible
+    // Aliases
+
+    default property alias contents: column.data
+
+    property alias spacing: column.spacing
+
     property alias cover: cover.source
+
     property alias coverWidth: coverContainer.width
     property alias coverHeight: coverContainer.height
 
-    property bool _keyPressed: false
+    property alias text: label.text
+
+    property alias column: column
+
+    // Children
 
     Column {
+        id: column
+
         anchors.verticalCenter: parent.verticalCenter
+
         width: root.width
-        spacing: VLCStyle.margin_large
+
+        spacing: VLCStyle.margin_small
 
         Item {
-            id: coverContainer
+            width: parent.width
+            height: label.y + label.height
 
-            anchors.horizontalCenter: parent.horizontalCenter
-            width: VLCStyle.colWidth(1)
-            height: VLCStyle.colWidth(1)
+            Item {
+                id: coverContainer
 
-            Image {
-                id: cover
+                anchors.horizontalCenter: parent.horizontalCenter
 
-                asynchronous: true
-                anchors.fill: parent
-                fillMode: Image.PreserveAspectFit
-            }
+                width: VLCStyle.colWidth(1)
+                height: VLCStyle.colWidth(1)
 
-            Widgets.ListCoverShadow {
-                anchors.fill: cover
-                source: cover
-            }
-        }
+                Image {
+                    id: cover
 
-        T.Label {
-            id: label
+                    anchors.fill: parent
 
-            width: parent.width
-            horizontalAlignment: Text.AlignHCenter
-            verticalAlignment: Text.AlignVCenter
-            font.pixelSize: VLCStyle.fontSize_xxlarge
-            font.weight: Font.DemiBold
-            color:  VLCStyle.colors.text
-            wrapMode: Text.WordWrap
-            focus: false
-        }
+                    asynchronous: true
 
-        Widgets.TabButtonExt {
-            id: browseButton
+                    fillMode: Image.PreserveAspectFit
+                }
 
-            text: I18n.qtr("Browse")
-            focus: true
-            iconTxt: VLCIcons.topbar_network
-            anchors.horizontalCenter: parent.horizontalCenter
-            onClicked: History.push(["mc", "network"])
-            width: VLCStyle.dp(84, VLCStyle.scale)
+                Widgets.ListCoverShadow {
+                    anchors.fill: cover
 
-            Navigation.parentItem: root
-        }
-    }
+                    source: cover
+                }
+            }
 
-    Keys.priority: Keys.AfterItem
+            T.Label {
+                id: label
 
-    Keys.onPressed: {
-        _keyPressed = true
+                anchors.top: coverContainer.bottom
 
-        Navigation.defaultKeyAction(event)
-    }
+                anchors.topMargin: VLCStyle.margin_large
 
-    Keys.onReleased: {
-        if (_keyPressed === false)
-            return
+                width: parent.width
 
-        _keyPressed = false
+                horizontalAlignment: Text.AlignHCenter
+                verticalAlignment: Text.AlignVCenter
 
-        if (KeyHelper.matchOk(event)) {
-            History.push(["mc", "network"])
-        }
+                focus: false
+
+                wrapMode: Text.WordWrap
 
-        Navigation.defaultKeyReleaseAction(event)
+                color: VLCStyle.colors.text
+
+                font.pixelSize: VLCStyle.fontSize_xxlarge
+                font.weight: Font.DemiBold
+            }
+        }
     }
 }


=====================================
modules/gui/qt/medialibrary/qml/EmptyLabelButton.qml
=====================================
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (C) 2020 VLC authors and VideoLAN
+ *
+ * Authors: Benjamin Arnaud <bun...@omega.gg>
+ *
+ * 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 "qrc:///style/"
+import "qrc:///widgets/" as Widgets
+
+EmptyLabel {
+    // Properties
+
+    property bool _keyPressed: false
+
+    // Aliases
+
+    property alias button: button
+
+    // Functions
+
+    function onNavigate() {
+        History.push(["mc", "network"])
+    }
+
+    // Keys
+
+    Keys.priority: Keys.AfterItem
+
+    Keys.onPressed: {
+        _keyPressed = true
+
+        Navigation.defaultKeyAction(event)
+    }
+
+    Keys.onReleased: {
+        if (_keyPressed === false)
+            return
+
+        _keyPressed = false
+
+        if (KeyHelper.matchOk(event))
+            onNavigate()
+
+        Navigation.defaultKeyReleaseAction(event)
+    }
+
+    // Children
+
+    Widgets.TabButtonExt {
+        id: button
+
+        anchors.horizontalCenter: parent.horizontalCenter
+
+        width: VLCStyle.dp(84, VLCStyle.scale)
+
+        focus: true
+
+        text: I18n.qtr("Browse")
+        iconTxt: VLCIcons.topbar_network
+
+        Navigation.parentItem: root
+
+        onClicked: onNavigate()
+    }
+}


=====================================
modules/gui/qt/medialibrary/qml/EmptyLabelHint.qml
=====================================
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (C) 2020 VLC authors and VideoLAN
+ *
+ * Authors: Benjamin Arnaud <bun...@omega.gg>
+ *
+ * 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 "qrc:///style/"
+import "qrc:///widgets/" as Widgets
+
+EmptyLabel {
+    // Aliases
+
+    property alias hint: labelHint.text
+
+    property alias labelHint: labelHint
+
+    // Settings
+
+    spacing: VLCStyle.margin_normal
+
+    // Children
+
+    Widgets.CaptionLabel {
+        id: labelHint
+
+        width: parent.width
+
+        horizontalAlignment: Text.AlignHCenter
+        verticalAlignment: Text.AlignVCenter
+
+        wrapMode: Text.WordWrap
+    }
+}


=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -278,7 +278,7 @@ FocusScope {
         }
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
         visible: albumModelId.count === 0
         focus: visible


=====================================
modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
=====================================
@@ -232,7 +232,7 @@ FocusScope {
         }
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
         visible: artistModel.count === 0
         focus: artistModel.count === 0


=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=====================================
@@ -214,7 +214,7 @@ FocusScope {
         }
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
         visible: artistModel.count === 0
         focus: visible


=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -302,7 +302,7 @@ FocusScope {
         }
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
         visible: genreModel.count === 0
         focus: genreModel.count === 0


=====================================
modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
=====================================
@@ -53,7 +53,7 @@ FocusScope {
         displayMarginEnd: miniPlayer.height // to get blur effect while 
scrolling in mainview
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
         visible: tracklistdisplay_id.model.count === 0
         focus: tracklistdisplay_id.model.count === 0


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
=====================================
@@ -210,7 +210,7 @@ FocusScope {
         Keys.onDeletePressed: onDelete()
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
 
         visible: (model.count === 0)


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -419,7 +419,7 @@ FocusScope {
         }
     }
 
-    EmptyLabel {
+    EmptyLabelHint {
         anchors.fill: parent
 
         visible: (model.count === 0)
@@ -427,9 +427,8 @@ FocusScope {
         focus: visible
 
         text: I18n.qtr("No playlists found")
+        hint: I18n.qtr("Right click on a media to add it to a playlist")
 
         cover: VLCStyle.noArtAlbumCover
-
-        Navigation.parentItem: root
     }
 }


=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -364,7 +364,7 @@ FocusScope {
         }
     }
 
-    EmptyLabel {
+    EmptyLabelButton {
         anchors.fill: parent
 
         coverWidth : VLCStyle.dp(182, VLCStyle.scale)


=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -290,6 +290,8 @@
     </qresource>
     <qresource prefix="/medialibrary">
         <file alias="EmptyLabel.qml">medialibrary/qml/EmptyLabel.qml</file>
+        <file 
alias="EmptyLabelButton.qml">medialibrary/qml/EmptyLabelButton.qml</file>
+        <file 
alias="EmptyLabelHint.qml">medialibrary/qml/EmptyLabelHint.qml</file>
         <file 
alias="MediaGroupDisplay.qml">medialibrary/qml/MediaGroupDisplay.qml</file>
         <file alias="MusicAlbums.qml">medialibrary/qml/MusicAlbums.qml</file>
         <file alias="MusicDisplay.qml">medialibrary/qml/MusicDisplay.qml</file>


=====================================
po/POTFILES.in
=====================================
@@ -795,7 +795,7 @@ modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp
 modules/gui/qt/medialibrary/mlvideogroupsmodel.hpp
 modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
 modules/gui/qt/medialibrary/qml/AudioGridItem.qml
-modules/gui/qt/medialibrary/qml/EmptyLabel.qml
+modules/gui/qt/medialibrary/qml/EmptyLabelButton.qml
 modules/gui/qt/medialibrary/qml/MediaGroupDisplay.qml
 modules/gui/qt/medialibrary/qml/MusicAlbums.qml
 modules/gui/qt/medialibrary/qml/MusicAlbumsDisplay.qml



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/22590583f4ff444ffe83a74945b18344de30af9e...47b039033d66d16b69e11b53cea82017417f766e

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/22590583f4ff444ffe83a74945b18344de30af9e...47b039033d66d16b69e11b53cea82017417f766e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to