vlc | branch: master | Pierre Lamot <pie...@videolabs.io> | Mon Feb 10 17:30:55 
2020 +0100| [f6bfc577f9e4139cbccb41a0db277b9dca2f3fdb] | committer: 
Jean-Baptiste Kempf

qml: factorise medialibrary empty label

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

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

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

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>

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to