[vlc-devel] [PATCH 09/16] qml: Add Editor button list

Rohan Rajpal rohan17089 at iiitd.ac.in
Wed Jul 31 14:30:49 CEST 2019


Add the view that has all widgets and
buttons for the editor
---
 modules/gui/qt/Makefile.am                    |  1 +
 .../qml/dialogs/ToolbarEditorButtonList.qml   | 93 +++++++++++++++++++
 modules/gui/qt/qml/player/ControlButtons.qml  | 30 ++++++
 modules/gui/qt/qml/style/VLCStyle.qml         |  4 +
 modules/gui/qt/vlc.qrc                        |  1 +
 5 files changed, 129 insertions(+)
 create mode 100644 modules/gui/qt/qml/dialogs/ToolbarEditorButtonList.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 427c7533fc..b3f777c134 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -561,6 +561,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/dialogs/ModalDialog.qml \
 	gui/qt/qml/dialogs/EditorDummyButton.qml \
 	gui/qt/qml/dialogs/EditorDNDDelegate.qml \
+	gui/qt/qml/dialogs/ToolbarEditorButtonList.qml \
 	gui/qt/qml/utils/DNDLabel.qml \
 	gui/qt/qml/utils/ToolTipArea.qml \
 	gui/qt/qml/utils/DrawerExt.qml \
diff --git a/modules/gui/qt/qml/dialogs/ToolbarEditorButtonList.qml b/modules/gui/qt/qml/dialogs/ToolbarEditorButtonList.qml
new file mode 100644
index 0000000000..28594a5698
--- /dev/null
+++ b/modules/gui/qt/qml/dialogs/ToolbarEditorButtonList.qml
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * 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.11
+import QtQuick.Layouts 1.3
+
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+
+GridView{
+    id: allButtonsView
+    clip: true
+
+    highlight: Rectangle{
+        color: VLCStyle.colors.accent
+    }
+    ScrollBar.vertical: ScrollBar {}
+    model: controlButtons.buttonL.length
+
+    delegate:MouseArea{
+        id:dragArea
+        objectName: "buttonsList"
+        hoverEnabled: true
+        width: VLCStyle.cover_small
+        height: width
+
+        property bool held: false
+        property int mIndex: controlButtons.buttonL[model.index].id
+        drag.target: held ? buttonDragItem : undefined
+        cursorShape: Qt.OpenHandCursor
+
+        onPressed: {
+            buttonDragItem.visible = true
+            buttonDragItem.text = controlButtons.buttonL[model.index].label
+            buttonDragItem.Drag.source = dragArea
+            held = true
+            var pos = this.mapToGlobal( mouseX, mouseY)
+            buttonDragItem.updatePos(pos.x, pos.y)
+            playerBtnDND.addBtn = true
+        }
+
+        onReleased: {
+            drag.target.Drag.drop()
+            buttonDragItem.visible = false
+            held = false
+            playerBtnDND.addBtn = false
+        }
+        onEntered: allButtonsView.currentIndex = index
+
+        ColumnLayout{
+            id: listelemlayout
+            anchors.fill: parent
+            anchors.margins: 10
+
+            EditorDummyButton {
+                Layout.preferredWidth: VLCStyle.icon_medium
+                Layout.preferredHeight: VLCStyle.icon_medium
+                Layout.alignment: Qt.AlignHCenter
+                text: controlButtons.buttonL[model.index].label
+            }
+            Text {
+                id: buttonName
+                Layout.fillWidth: true
+                Layout.fillHeight: true
+                text: controlButtons.buttonL[model.index].text
+                font.pointSize: VLCStyle.fontHeight_xsmall
+                color: VLCStyle.colors.buttonText
+                wrapMode: Text.WordWrap
+                verticalAlignment: Text.AlignVCenter
+                horizontalAlignment: Text.AlignHCenter
+            }
+        }
+    }
+}
+
+
diff --git a/modules/gui/qt/qml/player/ControlButtons.qml b/modules/gui/qt/qml/player/ControlButtons.qml
index 2020da1fef..bd7a62513e 100644
--- a/modules/gui/qt/qml/player/ControlButtons.qml
+++ b/modules/gui/qt/qml/player/ControlButtons.qml
@@ -27,6 +27,36 @@ import "qrc:///menus/" as Menus
 import "qrc:///style/"
 
 Item{
+    property var buttonL: [
+        { id:  PlayerControlBarModel.PLAY_BUTTON, label: VLCIcons.play, text: qsTr("Play")},
+        { id:  PlayerControlBarModel.STOP_BUTTON, label: VLCIcons.stop, text: qsTr("Stop")},
+        { id:  PlayerControlBarModel.OPEN_BUTTON, label: VLCIcons.eject, text: qsTr("Open")},
+        { id:  PlayerControlBarModel.PREVIOUS_BUTTON, label: VLCIcons.previous, text: qsTr("Previous")},
+        { id:  PlayerControlBarModel.NEXT_BUTTON, label: VLCIcons.next, text: qsTr("Next")},
+        { id:  PlayerControlBarModel.SLOWER_BUTTON, label: VLCIcons.slower, text: qsTr("Slower")},
+        { id:  PlayerControlBarModel.FASTER_BUTTON, label: VLCIcons.faster, text: qsTr("Faster")},
+        { id:  PlayerControlBarModel.FULLSCREEN_BUTTON, label: VLCIcons.fullscreen, text: qsTr("Fullscreen")},
+        { id:  PlayerControlBarModel.EXTENDED_BUTTON, label: VLCIcons.extended, text: qsTr("Extended panel")},
+        { id:  PlayerControlBarModel.PLAYLIST_BUTTON, label: VLCIcons.playlist, text: qsTr("Playlist")},
+        { id:  PlayerControlBarModel.SNAPSHOT_BUTTON, label: VLCIcons.snapshot, text: qsTr("Snapshot")},
+        { id:  PlayerControlBarModel.RECORD_BUTTON, label: VLCIcons.record, text: qsTr("Record")},
+        { id:  PlayerControlBarModel.ATOB_BUTTON, label: VLCIcons.atob, text: qsTr("A-B Loop")},
+        { id:  PlayerControlBarModel.FRAME_BUTTON, label: VLCIcons.frame_by_frame, text: qsTr("Frame By Frame")},
+        { id:  PlayerControlBarModel.SKIP_BACK_BUTTON, label: VLCIcons.skip_back, text: qsTr("Step backward")},
+        { id:  PlayerControlBarModel.SKIP_FW_BUTTON, label: VLCIcons.skip_for, text: qsTr("Step forward")},
+        { id:  PlayerControlBarModel.QUIT_BUTTON, label: VLCIcons.clear, text: qsTr("Quit")},
+        { id:  PlayerControlBarModel.RANDOM_BUTTON, label: VLCIcons.shuffle_on, text: qsTr("Random")},
+        { id:  PlayerControlBarModel.LOOP_BUTTON, label: VLCIcons.repeat_all, text: qsTr("Loop")},
+        { id:  PlayerControlBarModel.INFO_BUTTON, label: VLCIcons.info, text: qsTr("Information")},
+        { id:  PlayerControlBarModel.LANG_BUTTON, label: VLCIcons.audiosub, text: qsTr("Open subtitles")},
+        { id:  PlayerControlBarModel.MENU_BUTTON, label: VLCIcons.menu, text: qsTr("Menu Button")},
+        { id:  PlayerControlBarModel.BACK_BUTTON, label: VLCIcons.exit, text: qsTr("Back Button")},
+        { id:  PlayerControlBarModel.VOLUME, label: VLCIcons.volume_high, text: qsTr("Volume Widget")},
+        { id:  PlayerControlBarModel.TELETEXT_BUTTONS, label: VLCIcons.tvtelx, text: qsTr("Teletext")},
+        { id:  PlayerControlBarModel.ASPECT_RATIO_COMBOBOX, label: VLCIcons.aspect_ratio, text: qsTr("Aspect Ratio")},
+        { id:  PlayerControlBarModel.WIDGET_SPACER, label: VLCIcons.space, text: qsTr("Spacer")},
+        { id:  PlayerControlBarModel.WIDGET_SPACER_EXTEND, label: VLCIcons.space, text: qsTr("Expanding Spacer")}
+    ]
 
     function returnbuttondelegate(inpID){
         switch (inpID){
diff --git a/modules/gui/qt/qml/style/VLCStyle.qml b/modules/gui/qt/qml/style/VLCStyle.qml
index 76d32ed569..8c08c3c0f9 100644
--- a/modules/gui/qt/qml/style/VLCStyle.qml
+++ b/modules/gui/qt/qml/style/VLCStyle.qml
@@ -87,6 +87,7 @@ Item {
     property int heightBar_xsmall: 8 * scale;
     property int heightBar_small: 16 * scale;
     property int heightBar_normal: 32 * scale;
+    property int heightBar_medium: 48 * scale;
     property int heightBar_large: 64 * scale;
     property int heightBar_xlarge: 128 * scale;
     property int heightBar_xxlarge: 256 * scale;
@@ -102,6 +103,9 @@ Item {
     property int widthExtendedSpacer: 128 * scale;
     property int heightInput: 22 * scale;
 
+    property int scrollbarWidth: 8 * scale;
+    property int scrollbarHeight: 100 * scale;
+
     property int selectedBorder: 2
     property real video_normal_height: 160 * scale;
     property real video_large_height: 200 * scale;
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 734a340459..69fea91154 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -266,5 +266,6 @@
         <file alias="ModalDialog.qml">qml/dialogs/ModalDialog.qml</file>
         <file alias="EditorDummyButton.qml">qml/dialogs/EditorDummyButton.qml</file>
         <file alias="EditorDNDDelegate.qml">qml/dialogs/EditorDNDDelegate.qml</file>
+        <file alias="ToolbarEditorButtonList.qml">qml/dialogs/ToolbarEditorButtonList.qml</file>
     </qresource>
 </RCC>
-- 
2.17.1



More information about the vlc-devel mailing list