[vlc-devel] [PATCH 08/16] qml: add MCvideoListDisplay

Abel Tesfaye abeltesfaye45 at gmail.com
Fri Aug 9 17:23:45 CEST 2019


From: Abel Tesfaye <Abeltesfaye45 at gmail.com>

---
 modules/gui/qt/Makefile.am                    |  1 +
 .../qt/qml/mediacenter/MCVideoListDisplay.qml | 53 +++++++++++++++++++
 modules/gui/qt/qml/style/VLCStyle.qml         |  2 +
 modules/gui/qt/vlc.qrc                        |  1 +
 4 files changed, 57 insertions(+)
 create mode 100644 modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index ab8cdfb11c..a24e6f6b16 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -607,6 +607,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/mediacenter/MCMainDisplay.qml \
 	gui/qt/qml/mediacenter/MCMusicDisplay.qml \
 	gui/qt/qml/mediacenter/MCVideoDisplay.qml \
+	gui/qt/qml/mediacenter/MCVideoListDisplay.qml \
 	gui/qt/qml/mediacenter/MCNetworkDisplay.qml \
 	gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml \
 	gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml \
diff --git a/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml b/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
new file mode 100644
index 0000000000..887b088f25
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (C) 2019 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 QtQml.Models 2.2
+
+import org.videolan.medialib 0.1
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+Utils.KeyNavigableTableView {
+    id: listView_id
+    model: MLVideoModel {
+        ml: medialib
+    }
+    sortModel: ListModel {
+        ListElement{ type: "image"; criteria: "thumbnail";   width:0.2; text: qsTr("Thumbnail"); showSection: "" }
+        ListElement{ criteria: "duration";    width:0.1; text: qsTr("Duration"); showSection: "" }
+        ListElement{ isPrimary: true; criteria: "title";       width:0.6; text: qsTr("Title");    showSection: "title" }
+        ListElement{ type: "contextButton";   width:0.1; }
+    }
+    section.property: "title_first_symbol"
+
+    rowHeight: VLCStyle.video_small_height
+
+    headerColor: VLCStyle.colors.bg
+    spacing: VLCStyle.margin_small
+
+    onActionForSelection: {
+        var list = []
+        for (var i = 0; i < selection.count; i++ ) {
+            list.push(selection.get(i).model.id)
+        }
+        medialib.addAndPlay(list)
+    }
+
+}
diff --git a/modules/gui/qt/qml/style/VLCStyle.qml b/modules/gui/qt/qml/style/VLCStyle.qml
index 0a33aa89dc..2aeaa3ff4d 100644
--- a/modules/gui/qt/qml/style/VLCStyle.qml
+++ b/modules/gui/qt/qml/style/VLCStyle.qml
@@ -104,8 +104,10 @@ Item {
     property int selectedBorder: 2
     property real video_normal_height: 160 * scale;
     property real video_large_height: 200 * scale;
+    property real video_small_height: 80 * scale;
     property real video_normal_width: video_normal_height * (16/10);
     property real video_large_width: video_large_height * (16/10);
+    property real video_small_width: video_small_height * (16/10);
 
     property int miniPlayerHeight: 60 * scale;
 
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index ca4aa48c6d..c425aa6a27 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -221,6 +221,7 @@
         <file alias="NetworkFileDisplay.qml">qml/mediacenter/NetworkFileDisplay.qml</file>
         <file alias="NetworkListItem.qml">qml/mediacenter/NetworkListItem.qml</file>
         <file alias="VideoExpandableGrid.qml">qml/mediacenter/VideoExpandableGrid.qml</file>
+        <file alias="MCVideoListDisplay.qml">qml/mediacenter/MCVideoListDisplay.qml</file>
     </qresource>
     <qresource prefix="/style">
         <file alias="qmldir">qml/style/qmldir</file>
-- 
2.21.0



More information about the vlc-devel mailing list