[vlc-devel] [PATCH 4/5] qml: Create Topbar component

Rohan Rajpal rohan17089 at iiitd.ac.in
Sun Jul 28 20:56:22 CEST 2019


Create a component for player topbar.
---
 modules/gui/qt/Makefile.am           |  1 +
 modules/gui/qt/qml/player/TopBar.qml | 80 ++++++++++++++++++++++++++++
 modules/gui/qt/vlc.qrc               |  1 +
 3 files changed, 82 insertions(+)
 create mode 100644 modules/gui/qt/qml/player/TopBar.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index eee22d92e9..36ccbb6ae2 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -550,6 +550,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/player/SliderBar.qml \
 	gui/qt/qml/player/TeletextWidget.qml \
 	gui/qt/qml/player/MiniPlayer.qml \
+	gui/qt/qml/player/TopBar.qml \
 	gui/qt/qml/dialogs/Dialogs.qml \
 	gui/qt/qml/dialogs/ModalDialog.qml \
 	gui/qt/qml/utils/DNDLabel.qml \
diff --git a/modules/gui/qt/qml/player/TopBar.qml b/modules/gui/qt/qml/player/TopBar.qml
new file mode 100644
index 0000000000..ddbfe40e6d
--- /dev/null
+++ b/modules/gui/qt/qml/player/TopBar.qml
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * 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.Layouts 1.3
+
+import org.videolan.vlc 0.1
+
+import "qrc:///style/"
+import "qrc:///utils/" as Utils
+
+Utils.NavigableFocusScope{
+    id: topFocusScope
+    height: VLCStyle.icon_topbar
+    property bool noAutoHide: false
+
+    property bool noAutoHideInt: !player.hasVideoOutput
+                              || !rootWindow.hasEmbededVideo
+                              || topcontrollerMouseArea.containsMouse || lockAutoHide
+    property bool lockAutoHide: false
+
+    Keys.priority: Keys.AfterItem
+    Keys.onPressed: defaultKeyAction(event, 0)
+
+    Rectangle{
+        id : topcontrolContent
+        color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.banner, 0.8)
+        anchors.fill: parent
+
+        MouseArea {
+            id: topcontrollerMouseArea
+            hoverEnabled: true
+            anchors.fill: parent
+
+            RowLayout{
+                anchors.fill: parent
+                anchors.leftMargin:  VLCStyle.margin_xsmall
+                anchors.rightMargin: VLCStyle.margin_xsmall
+
+                Utils.IconToolButton {
+                    id: backBtn
+                    objectName: "IconToolButton"
+                    size: VLCStyle.icon_normal
+                    text: VLCIcons.exit
+                    onClicked: history.previous(History.Go)
+                    KeyNavigation.right: playlistBtn
+                    focus: true
+                }
+
+                Item{
+                    Layout.fillWidth: true
+                }
+
+                Utils.IconToolButton {
+                    id: playlistBtn
+                    objectName: PlayerControlBarModel.PLAYLIST_BUTTON
+                    size: VLCStyle.icon_normal
+                    text: VLCIcons.playlist
+                    onClicked: rootWindow.playlistVisible = !rootWindow.playlistVisible
+                    property bool acceptFocus: true
+                }
+            }
+        }
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index c9574d3639..9e53652d20 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -253,6 +253,7 @@
         <file alias="VolumeWidget.qml">qml/player/VolumeWidget.qml</file>
         <file alias="TeletextWidget.qml">qml/player/TeletextWidget.qml</file>
         <file alias="MiniPlayer.qml">qml/player/MiniPlayer.qml</file>
+        <file alias="TopBar.qml">qml/player/TopBar.qml</file>
     </qresource>
     <qresource prefix="/about">
         <file alias="About.qml">qml/about/About.qml</file>
-- 
2.17.1



More information about the vlc-devel mailing list