[vlc-devel] [PATCH 19/22] qml: factorise medialibrary empty label

Pierre Lamot pierre at videolabs.io
Fri Feb 14 11:23:54 CET 2020


---
 modules/gui/qt/Makefile.am                    |  1 +
 .../gui/qt/medialibrary/qml/EmptyLabel.qml    | 53 +++++++++++++++++++
 modules/gui/qt/vlc.qrc                        |  1 +
 3 files changed, 55 insertions(+)
 create mode 100644 modules/gui/qt/medialibrary/qml/EmptyLabel.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index b116030404..896545ea3c 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -555,6 +555,7 @@ libqt_plugin_la_QML = \
 	gui/qt/maininterface/qml/MainInterface.qml \
 	gui/qt/medialibrary/qml/ArtistTopBanner.qml \
 	gui/qt/medialibrary/qml/AudioGridItem.qml \
+	gui/qt/medialibrary/qml/EmptyLabel.qml \
 	gui/qt/medialibrary/qml/MainDisplay.qml \
 	gui/qt/medialibrary/qml/MusicAlbums.qml \
 	gui/qt/medialibrary/qml/MusicAlbumsDisplay.qml \
diff --git a/modules/gui/qt/medialibrary/qml/EmptyLabel.qml b/modules/gui/qt/medialibrary/qml/EmptyLabel.qml
new file mode 100644
index 0000000000..156168eac4
--- /dev/null
+++ b/modules/gui/qt/medialibrary/qml/EmptyLabel.qml
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * 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 QtQuick.Controls 2.4
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///widgets/" as Widgets
+import "qrc:///util/KeyHelper.js" as KeyHelper
+
+Widgets.NavigableFocusScope {
+    property alias text: label.text
+
+    Label {
+        id: label
+        anchors.fill: parent
+        horizontalAlignment: Text.AlignHCenter
+        verticalAlignment: Text.AlignVCenter
+        font.pixelSize: VLCStyle.fontSize_xxxlarge
+        color: root.activeFocus ? VLCStyle.colors.accent : VLCStyle.colors.text
+        wrapMode: Text.WordWrap
+
+        MouseArea {
+            anchors.fill: parent
+            onClicked: history.push(["mc", "network"])
+        }
+    }
+
+    Keys.priority: Keys.AfterItem
+    Keys.onPressed: defaultKeyAction(event, 0)
+    Keys.onReleased: {
+        if (KeyHelper.matchOk(event)) {
+            history.push(["mc", "network"])
+        }
+        defaultKeyReleaseAction(event, 0)
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index faf8f8ba74..f0401c5240 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -223,6 +223,7 @@
         <file alias="NetworkListItem.qml">network/qml/NetworkListItem.qml</file>
     </qresource>
     <qresource prefix="/medialibrary">
+        <file alias="EmptyLabel.qml">medialibrary/qml/EmptyLabel.qml</file>
         <file alias="MusicAlbums.qml">medialibrary/qml/MusicAlbums.qml</file>
         <file alias="MusicDisplay.qml">medialibrary/qml/MusicDisplay.qml</file>
         <file alias="MusicGenres.qml">medialibrary/qml/MusicGenres.qml</file>
-- 
2.17.1



More information about the vlc-devel mailing list