[vlc-devel] [PATCH 05/29] qml: add Network Drive and File Grid Items
Abel Tesfaye
abeltesfaye45 at gmail.com
Tue Aug 20 12:42:22 CEST 2019
From: Abel Tesfaye <Abeltesfaye45 at gmail.com>
---
modules/gui/qt/Makefile.am | 2 +
.../mediacenter/NetworkDriveDisplayGrid.qml | 60 ++++++++++++++++++
.../mediacenter/NetworkFileDisplayGrid.qml | 63 +++++++++++++++++++
modules/gui/qt/qml/style/VLCStyle.qml | 2 +
modules/gui/qt/vlc.qrc | 2 +
5 files changed, 129 insertions(+)
create mode 100644 modules/gui/qt/qml/mediacenter/NetworkDriveDisplayGrid.qml
create mode 100644 modules/gui/qt/qml/mediacenter/NetworkFileDisplayGrid.qml
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index a24e6f6b16..4631705d7a 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -617,6 +617,8 @@ libqt_plugin_la_QML = \
gui/qt/qml/mediacenter/MusicTrackListDisplay.qml \
gui/qt/qml/mediacenter/NetworkDriveDisplay.qml \
gui/qt/qml/mediacenter/NetworkFileDisplay.qml \
+ gui/qt/qml/mediacenter/NetworkFileDisplayGrid.qml \
+ gui/qt/qml/mediacenter/NetworkDriveDisplayGrid.qml \
gui/qt/qml/mediacenter/NetworkListItem.qml \
gui/qt/qml/mediacenter/VideoExpandableGrid.qml \
gui/qt/qml/playlist/PlaylistListView.qml \
diff --git a/modules/gui/qt/qml/mediacenter/NetworkDriveDisplayGrid.qml b/modules/gui/qt/qml/mediacenter/NetworkDriveDisplayGrid.qml
new file mode 100644
index 0000000000..807cc7daa4
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/NetworkDriveDisplayGrid.qml
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * 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.vlc 0.1
+import org.videolan.medialib 0.1
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+Utils.GridItem {
+ id: item
+
+ pictureWidth: VLCStyle.network_normal
+ pictureHeight: VLCStyle.network_normal
+ image: "qrc:///type/directory_black.svg"
+ subtitle: model.mrl
+ title: model.name || qsTr("Unknown share")
+ focus: true
+ selected: parent.activeFocus && element.DelegateModel.inSelected
+ shiftX: view.currentItem.shiftX(model.index)
+ onItemClicked : {
+ if (key == Qt.RightButton){
+ contextMenu.model = model
+ contextMenu.popup(menuParent)
+ }
+ delegateModel.updateSelection( modifier , view.currentIndex, index)
+ view.currentItem.currentIndex = index
+ item.forceActiveFocus()
+ }
+ noActionButtons: true
+ showContextButton: true
+
+ onAddToPlaylistClicked: model.indexed = !model.indexed
+ onContextMenuButtonClicked: {
+ contextMenu.model = model
+ contextMenu.popup(menuParent)
+ }
+
+ onItemDoubleClicked: {
+ history.push( ["mc", "network", { tree: model.tree } ], History.Go)
+ }
+}
diff --git a/modules/gui/qt/qml/mediacenter/NetworkFileDisplayGrid.qml b/modules/gui/qt/qml/mediacenter/NetworkFileDisplayGrid.qml
new file mode 100644
index 0000000000..6c19bda892
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/NetworkFileDisplayGrid.qml
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * 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.GridItem {
+ id: item
+
+ pictureWidth: VLCStyle.network_normal
+ pictureHeight: VLCStyle.network_normal
+ image: "qrc:///type/file_black.svg"
+ subtitle: model.name || qsTr("Unknown share")
+ title: model.mrl
+ focus: true
+
+ selected: element.DelegateModel.inSelected
+ shiftX: view.currentItem.shiftX(model.index)
+ onItemClicked : {
+ if (key == Qt.RightButton){
+ contextMenu.model = model
+ contextMenu.popup(menuParent)
+ }
+ delegateModel.updateSelection( modifier , view.currentIndex, index)
+ view.currentItem.currentIndex = index
+ item.forceActiveFocus()
+ }
+ showContextButton: true
+
+ onItemDoubleClicked: {
+ medialib.addAndPlay( model.mrl )
+ }
+ onPlayClicked: {
+ medialib.addAndPlay( model.mrl )
+ }
+ onAddToPlaylistClicked: {
+ medialib.addToPlaylist( model.mrl );
+ }
+ onContextMenuButtonClicked: {
+ contextMenu.model = model
+ contextMenu.popup(menuParent)
+ }
+}
diff --git a/modules/gui/qt/qml/style/VLCStyle.qml b/modules/gui/qt/qml/style/VLCStyle.qml
index 2aeaa3ff4d..f21edc5477 100644
--- a/modules/gui/qt/qml/style/VLCStyle.qml
+++ b/modules/gui/qt/qml/style/VLCStyle.qml
@@ -109,6 +109,8 @@ Item {
property real video_large_width: video_large_height * (16/10);
property real video_small_width: video_small_height * (16/10);
+ property real network_normal: 100 * scale;
+
property int miniPlayerHeight: 60 * scale;
//combobox
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index c425aa6a27..778c0159ad 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -222,6 +222,8 @@
<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>
+ <file alias="NetworkFileDisplayGrid.qml">qml/mediacenter/NetworkFileDisplayGrid.qml</file>
+ <file alias="NetworkDriveDisplayGrid.qml">qml/mediacenter/NetworkDriveDisplayGrid.qml</file>
</qresource>
<qresource prefix="/style">
<file alias="qmldir">qml/style/qmldir</file>
--
2.21.0
More information about the vlc-devel
mailing list