mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-04 09:11:33 +02:00
qml/controlbarcontrols: Create NavigationWidget
This commit is contained in:
parent
02b7d2491e
commit
76942f710e
@ -836,6 +836,7 @@ libqt_plugin_la_QML = \
|
|||||||
gui/qt/player/qml/controlbarcontrols/LangButton.qml \
|
gui/qt/player/qml/controlbarcontrols/LangButton.qml \
|
||||||
gui/qt/player/qml/controlbarcontrols/LoopButton.qml \
|
gui/qt/player/qml/controlbarcontrols/LoopButton.qml \
|
||||||
gui/qt/player/qml/controlbarcontrols/MenuButton.qml \
|
gui/qt/player/qml/controlbarcontrols/MenuButton.qml \
|
||||||
|
gui/qt/player/qml/controlbarcontrols/NavigationWidget.qml \
|
||||||
gui/qt/player/qml/controlbarcontrols/NextButton.qml \
|
gui/qt/player/qml/controlbarcontrols/NextButton.qml \
|
||||||
gui/qt/player/qml/controlbarcontrols/OpenButton.qml \
|
gui/qt/player/qml/controlbarcontrols/OpenButton.qml \
|
||||||
gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml \
|
gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml \
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
REVERSE_BUTTON,
|
REVERSE_BUTTON,
|
||||||
BOOKMARK_BUTTON,
|
BOOKMARK_BUTTON,
|
||||||
RENDERER_BUTTON,
|
RENDERER_BUTTON,
|
||||||
|
NAVIGATION_BUTTONS,
|
||||||
SPECIAL_MAX,
|
SPECIAL_MAX,
|
||||||
|
|
||||||
WIDGET_SPACER = 0x40,
|
WIDGET_SPACER = 0x40,
|
||||||
|
@ -0,0 +1,114 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Copyright (C) 2022 VLC authors and VideoLAN
|
||||||
|
*
|
||||||
|
* Authors: Benjamin Arnaud <bunjee@omega.gg>
|
||||||
|
*
|
||||||
|
* 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.Templates 2.4 as Templates
|
||||||
|
|
||||||
|
import org.videolan.vlc 0.1
|
||||||
|
|
||||||
|
import "qrc:///widgets/" as Widgets
|
||||||
|
import "qrc:///style/"
|
||||||
|
|
||||||
|
Templates.Pane {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
// Properties
|
||||||
|
|
||||||
|
property int size: VLCStyle.icon_medium
|
||||||
|
|
||||||
|
property VLCColors colors: VLCStyle.colors
|
||||||
|
|
||||||
|
property bool paintOnly: false
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
readonly property string _controlPath : "qrc:///player/controlbarcontrols/"
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
|
||||||
|
implicitWidth: contentWidth + leftPadding + rightPadding
|
||||||
|
implicitHeight: contentHeight + topPadding + bottomPadding
|
||||||
|
|
||||||
|
contentWidth: row.implicitWidth
|
||||||
|
contentHeight: row.implicitHeight
|
||||||
|
|
||||||
|
// Keys
|
||||||
|
|
||||||
|
Keys.priority: Keys.AfterItem
|
||||||
|
Keys.onPressed: Navigation.defaultKeyAction(event)
|
||||||
|
|
||||||
|
// Functions private
|
||||||
|
|
||||||
|
function _applyItem(loader, item) {
|
||||||
|
item.focus = true
|
||||||
|
|
||||||
|
item.colors = Qt.binding(function() { return colors })
|
||||||
|
item.paintOnly = Qt.binding(function() { return paintOnly })
|
||||||
|
|
||||||
|
item.Navigation.parentItem = Qt.binding(function() { return loader })
|
||||||
|
}
|
||||||
|
|
||||||
|
// Children
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: row
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: loaderA
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
focus: (item && item.enabled)
|
||||||
|
|
||||||
|
// NOTE: We display the 'menu button' as a placeholder for the customize dialog.
|
||||||
|
source: (Player.hasMenu || root.paintOnly) ? _controlPath + "DvdMenuButton.qml" : ""
|
||||||
|
|
||||||
|
Navigation.parentItem: root
|
||||||
|
Navigation.rightItem: loaderB.item
|
||||||
|
|
||||||
|
onLoaded: {
|
||||||
|
if (item === null) return
|
||||||
|
|
||||||
|
_applyItem(loaderA, item)
|
||||||
|
|
||||||
|
item.size = Qt.binding(function() { return root.size })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: loaderB
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
focus: (item && item.enabled && loaderA.focus === false)
|
||||||
|
|
||||||
|
source: (Player.isTeletextAvailable
|
||||||
|
&&
|
||||||
|
root.paintOnly == false) ? _controlPath + "TeletextWidget.qml" : ""
|
||||||
|
|
||||||
|
Navigation.parentItem: root
|
||||||
|
Navigation.leftItem: loaderA.item
|
||||||
|
|
||||||
|
onLoaded: if (item) _applyItem(loaderB, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -373,6 +373,7 @@
|
|||||||
<file alias="LangButton.qml">player/qml/controlbarcontrols/LangButton.qml</file>
|
<file alias="LangButton.qml">player/qml/controlbarcontrols/LangButton.qml</file>
|
||||||
<file alias="LoopButton.qml">player/qml/controlbarcontrols/LoopButton.qml</file>
|
<file alias="LoopButton.qml">player/qml/controlbarcontrols/LoopButton.qml</file>
|
||||||
<file alias="MenuButton.qml">player/qml/controlbarcontrols/MenuButton.qml</file>
|
<file alias="MenuButton.qml">player/qml/controlbarcontrols/MenuButton.qml</file>
|
||||||
|
<file alias="NavigationWidget.qml">player/qml/controlbarcontrols/NavigationWidget.qml</file>
|
||||||
<file alias="NextButton.qml">player/qml/controlbarcontrols/NextButton.qml</file>
|
<file alias="NextButton.qml">player/qml/controlbarcontrols/NextButton.qml</file>
|
||||||
<file alias="OpenButton.qml">player/qml/controlbarcontrols/OpenButton.qml</file>
|
<file alias="OpenButton.qml">player/qml/controlbarcontrols/OpenButton.qml</file>
|
||||||
<file alias="PlaybackSpeedButton.qml">player/qml/controlbarcontrols/PlaybackSpeedButton.qml</file>
|
<file alias="PlaybackSpeedButton.qml">player/qml/controlbarcontrols/PlaybackSpeedButton.qml</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user