[vlc-commits] [Git][videolan/vlc][master] 13 commits: qml: show pined controls in audio mode too
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Thu Jun 30 04:57:34 UTC 2022
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
01e39935 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: show pined controls in audio mode too
- - - - -
dc0c888d by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: folow theme colors in pined mode
- - - - -
b1a269bb by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: never focus on CSD buttons
these buttons aren't meant to be navigable
- - - - -
1edd1177 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: CSDWindowButton are not TabButtons
- - - - -
2874c36d by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: don't show the global menu button when the menubar is visible
- - - - -
3c3645c4 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: properly align components in the player topbar
components are positioned manually due to the high number of layout
configurations
- - - - -
358d96a4 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: don't show CSD when the application is fullscreen
- - - - -
847f20c3 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: don't show the menubar when the player is fullscreen
- - - - -
ef8c20fa by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: tidy up DrawerExt
reorganize a bit and fix unqualified access
no functional changes
- - - - -
f6852065 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: don't intercept mouse events in DrawerExt
using a Flickable prevents mouse event to propagate, the Flickable was mainly
used to provide the clipping of the inner surface, but as our drawer are always
on the applications edges, clipping is counter productive
- - - - -
585c3001 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: expose hovered property in CSDWindowButtonSet
- - - - -
c9b841ea by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: expose whether menubar is opened or hovered
- - - - -
d747ad50 by Pierre Lamot at 2022-06-30T04:39:06+00:00
qml: reduce the area which locks the player autohide in the topbar
this notably avoid issues where the player was autohiding when overing the CSD
buttons
- - - - -
7 changed files:
- modules/gui/qt/maininterface/qml/BannerSources.qml
- modules/gui/qt/menus/qml/Menubar.qml
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/player/qml/TopBar.qml
- modules/gui/qt/widgets/qml/CSDWindowButton.qml
- modules/gui/qt/widgets/qml/CSDWindowButtonSet.qml
- modules/gui/qt/widgets/qml/DrawerExt.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/BannerSources.qml
=====================================
@@ -22,6 +22,7 @@ import QtQuick.Templates 2.4 as T
import QtQuick.Layouts 1.11
import QtGraphicalEffects 1.0
import QtQml.Models 2.11
+import QtQuick.Window 2.11
import org.videolan.vlc 0.1
import org.videolan.compat 0.1
@@ -41,19 +42,20 @@ FocusScope {
property int selectedIndex: 0
property int subSelectedIndex: 0
-
- signal itemClicked(int index)
-
property alias sortMenu: sortControl.menu
property alias sortModel: sortControl.model
property var contentModel
property alias isViewMultiView: list_grid_btn.visible
property alias model: pLBannerSources.model
- signal toogleMenu()
-
property var extraLocalActions: undefined
property alias localMenuDelegate: localMenuGroup.sourceComponent
+ property bool _showCSD: MainCtx.clientSideDecoration && !(MainCtx.intfMainWindow.visibility === Window.FullScreen)
+
+ signal itemClicked(int index)
+ signal toogleMenu()
+
+
// Triggered when the toogleView button is selected
function toggleView () {
MainCtx.gridView = !MainCtx.gridView
@@ -117,7 +119,7 @@ FocusScope {
//drag and dbl click the titlebar in CSD mode
Loader {
anchors.fill: parent
- active: MainCtx.clientSideDecoration
+ active: root._showCSD
source: "qrc:///widgets/CSDTitlebarTapNDrapHandler.qml"
}
@@ -207,7 +209,7 @@ FocusScope {
rightMargin: VLCStyle.applicationHorizontalMargin
}
height: VLCStyle.globalToolbar_height
- active: MainCtx.clientSideDecoration
+ active: root._showCSD
source: "qrc:///widgets/CSDWindowButtonSet.qml"
}
}
@@ -428,6 +430,7 @@ FocusScope {
Widgets.IconToolButton {
id: menu_selector
+ visible: !MainCtx.hasToolbarMenu
size: VLCStyle.banner_icon_size
iconText: VLCIcons.ellipsis
text: I18n.qtr("Menu")
=====================================
modules/gui/qt/menus/qml/Menubar.qml
=====================================
@@ -35,6 +35,9 @@ Item {
property color textColor: VLCStyle.colors.text
property color highlightedBgColor: VLCStyle.colors.bgHover
property color highlightedTextColor: VLCStyle.colors.bgHoverText
+ property bool hovered: _countHovered !== 0
+ property bool menuOpened: _menuIndex !== -1
+
Action{ id: mediaMenu; text: I18n.qtr("&Media") ; onTriggered: menubar.popupMediaMenu(source); }
Action{ id: playbackMenu; text: I18n.qtr("&Playback") ; onTriggered: menubar.popupPlaybackMenu(source);}
@@ -57,6 +60,8 @@ Item {
]
property int _menuIndex: -1
+ property int _countHovered: 0
+
function openMenu(obj, cb, index) {
cb.trigger(obj)
@@ -64,6 +69,8 @@ Item {
}
function updateHover(obj, cb, index, hovered ) {
+ root._countHovered += hovered ? 1 : -1
+
if (hovered && menubar.openMenuOnHover) {
cb.trigger(obj)
root._menuIndex = index
=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -39,7 +39,7 @@ FocusScope {
&& Player.hasVideoOutput
&& playlistpopup.state !== "visible"
- property bool pinVideoControls: rootPlayer.hasEmbededVideo && MainCtx.pinVideoControls && ((MainCtx.intfMainWindow.visibility !== Window.FullScreen))
+ property bool pinVideoControls: MainCtx.pinVideoControls && (MainCtx.intfMainWindow.visibility !== Window.FullScreen)
property bool hasEmbededVideo: MainCtx.hasEmbededVideo
readonly property int positionSliderY: controlBarView.y + controlBarView.sliderY
readonly property string coverSource: {
@@ -53,7 +53,7 @@ FocusScope {
}
// NOTE: We force the night theme when playing a video.
- readonly property VLCColors colors: (MainCtx.hasEmbededVideo) ? VLCStyle.nightColors
+ readonly property VLCColors colors: (MainCtx.hasEmbededVideo && !MainCtx.pinVideoControls) ? VLCStyle.nightColors
: VLCStyle.colors
property bool _keyPressed: false
@@ -388,7 +388,11 @@ FocusScope {
visible: !resumeDialog.visible
title: mainPlaylistController.currentItem.title
colors: rootPlayer.colors
- groupAlignment: rootPlayer.pinVideoControls ? TopBar.GroupAlignment.Horizontal : TopBar.GroupAlignment.Vertical
+
+ pinControls: rootPlayer.pinVideoControls
+ showCSD: MainCtx.clientSideDecoration && (MainCtx.intfMainWindow.visibility !== Window.FullScreen)
+ showToolbar: MainCtx.hasToolbarMenu && (MainCtx.intfMainWindow.visibility !== Window.FullScreen)
+
Navigation.parentItem: rootPlayer
Navigation.downItem: playlistpopup.showPlaylist ? playlistpopup : (audioControls.visible ? audioControls : controlBarView)
@@ -397,6 +401,13 @@ FocusScope {
onRequestLockUnlockAutoHide: {
rootPlayer.lockUnlockAutoHide(lock, source)
}
+
+ onBackRequested: {
+ if (MainCtx.hasEmbededVideo && !MainCtx.canShowVideoPIP) {
+ mainPlaylistController.stop()
+ }
+ History.previous()
+ }
}
ResumeDialog {
=====================================
modules/gui/qt/player/qml/TopBar.qml
=====================================
@@ -20,6 +20,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Templates 2.4 as T
import QtQuick.Layouts 1.11
+import QtQuick.Window 2.11
import org.videolan.vlc 0.1
@@ -28,111 +29,151 @@ import "qrc:///widgets/" as Widgets
import "qrc:///menus/" as Menus
FocusScope{
- id: topFocusScope
-
- enum GroupAlignment {
- Horizontal,
- Vertical
- }
+ id: root
/* required */ property int textWidth
property string title
property VLCColors colors: VLCStyle.nightColors
- property int groupAlignment: TopBar.GroupAlignment.Vertical
- property Item _currentTitleText: null
- property alias reservedHeight: rightColumn.height
+ property bool showCSD: false
+ property bool showToolbar: false
+ property bool pinControls: false
+
+ property int reservedHeight: 0
signal togglePlaylistVisibility()
signal requestLockUnlockAutoHide(bool lock, var source)
+ signal backRequested()
- implicitHeight: topcontrollerMouseArea.implicitHeight
+ Component.onCompleted: root._layout()
- Component.onCompleted: {
- // if groupAlignment == Horizontal, then onGroupAlignment isn't called when Component is created
- if (groupAlignment === TopBar.GroupAlignment.Horizontal)
- _layout()
- }
+ onShowCSDChanged: root._layout()
+ onPinControlsChanged: root._layout()
+ onShowToolbarChanged: root._layout()
- onGroupAlignmentChanged: _layout()
+ function _layoutLine(c1, c2, offset)
+ {
+ var lineHeight = Math.max(c1 !== undefined ? c1.implicitHeight : 0, c2 !== undefined ? c2.implicitHeight : 0)
- function _layout() {
- if (topFocusScope._currentTitleText)
- topFocusScope._currentTitleText.destroy()
-
- switch (groupAlignment) {
- case TopBar.GroupAlignment.Horizontal:
- leftColumn.children = [menubar, logoGroup]
-
- _currentTitleText = centerTitleTextComponent.createObject(topcontrollerMouseArea)
-
- var rightRow = Qt.createQmlObject("import QtQuick 2.11; Row {}", rightColumn, "TopBar")
- rightRow.children = [playlistGroup, csdDecorations]
- playlistGroup.anchors.verticalCenter = rightRow.verticalCenter
- break;
-
- case TopBar.GroupAlignment.Vertical:
- _currentTitleText = leftTitleTextComponent.createObject()
- leftColumn.children = [menubar, logoGroup, _currentTitleText]
- playlistGroup.anchors.verticalCenter = undefined
- rightColumn.children = [csdDecorations, playlistGroup]
- playlistGroup.Layout.alignment = Qt.AlignRight
+ if (c1) {
+ c1.height = lineHeight
+ c1.anchors.leftMargin = 0
+ c1.anchors.topMargin = offset
+ }
+
+ if (c2) {
+ c2.height = lineHeight
+ c2.anchors.topMargin = offset
+ c2.anchors.rightMargin = 0
}
+ return lineHeight
}
- // Main Content Container
- MouseArea {
- id: topcontrollerMouseArea
+ function _layout() {
+ var offset = 0
- hoverEnabled: true
- anchors.fill: parent
- implicitHeight: rowLayout.implicitHeight
+ if (root.pinControls && !root.showToolbar && root.showCSD) {
+ //place everything on one line
+ var lineHeight = Math.max(logoGroup.implicitHeight, playlistGroup.implicitHeight, csdDecorations.implicitHeight)
- onContainsMouseChanged: topFocusScope.requestLockUnlockAutoHide(containsMouse, topFocusScope)
+ centerTitleText.y = 0
+ centerTitleText.height = lineHeight
- //drag and dbl click the titlebar in CSD mode
- Loader {
- anchors.fill: parent
- active: MainCtx.clientSideDecoration
- source: "qrc:///widgets/CSDTitlebarTapNDrapHandler.qml"
- }
+ csdDecorations.height = lineHeight
+
+ logoGroup.height = lineHeight
+
+ playlistGroup.height = lineHeight
+ playlistGroup.anchors.topMargin = 0
+ playlistGroup.anchors.right = csdDecorations.left
+ playlistGroup.anchors.rightMargin = VLCStyle.margin_xsmall
+
+
+ root.implicitHeight = lineHeight
+ offset += lineHeight
+
+ } else {
+ playlistGroup.anchors.right = root.right
+ playlistGroup.anchors.rightMargin = VLCStyle.margin_xsmall
- RowLayout {
- id: rowLayout
+ var left = undefined
+ var right = undefined
+ var logoPlaced = false
- anchors.fill: parent
+ if (root.showToolbar) {
+ left = menubar
+ }
+
+ if (root.showCSD) {
+ right = csdDecorations
+ if (!left) {
+ left = logoGroup
+ logoPlaced = true
+ }
+ }
- ColumnLayout {
- id: leftColumn
+ if (!!left || !!right) {
+ offset += root._layoutLine(left, right, offset)
+
+ if (root.showCSD) {
+ tapNDrag.height = offset
+ }
+ }
- spacing: 0
- Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
- Layout.leftMargin: VLCStyle.margin_xxsmall
- Layout.topMargin: VLCStyle.margin_xxsmall
- Layout.bottomMargin: VLCStyle.margin_xxsmall
+ if (!logoPlaced) {
+ left = logoGroup
+ } else {
+ left = undefined
}
- ColumnLayout {
- id: rightColumn
+ right = playlistGroup
- spacing: 0
- Layout.alignment: Qt.AlignTop | Qt.AlignRight
- // this column may contain CSD, don't apply margins directly
+ var secondLineOffset = offset
+ var secondLineHeight = root._layoutLine(left, right, offset)
+
+ offset += secondLineHeight
+
+ if (root.pinControls) {
+ centerTitleText.y = secondLineOffset
+ centerTitleText.height = secondLineHeight
}
+
}
+
+ root.implicitHeight = offset
+ reservedHeight = offset
+ }
+
+ //drag and dbl click the titlebar in CSD mode
+ Loader {
+ id: tapNDrag
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+
+ active: root.showCSD
+ source: "qrc:///widgets/CSDTitlebarTapNDrapHandler.qml"
}
// Components -
Menus.Menubar {
id: menubar
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.leftMargin: VLCStyle.margin_small
+
width: implicitWidth
- height: VLCStyle.icon_normal
- visible: MainCtx.hasToolbarMenu
- textColor: topFocusScope.colors.text
- highlightedBgColor: topFocusScope.colors.bgHover
- highlightedTextColor: topFocusScope.colors.bgHoverText
+
+ visible: root.showToolbar
+ textColor: root.colors.text
+ highlightedBgColor: root.colors.bgHover
+ highlightedTextColor: root.colors.bgHoverText
+
+ onHoveredChanged: root.requestLockUnlockAutoHide(hovered, root)
+ onMenuOpenedChanged: root.requestLockUnlockAutoHide(menuOpened, root)
}
RowLayout {
@@ -140,6 +181,10 @@ FocusScope{
spacing: VLCStyle.margin_xxsmall
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.leftMargin: VLCStyle.margin_small
+
Widgets.IconControlButton {
id: backBtn
@@ -150,22 +195,20 @@ FocusScope{
iconText: VLCIcons.topbar_previous
text: I18n.qtr("Back")
focus: true
- colors: topFocusScope.colors
+ colors: root.colors
- Navigation.parentItem: topFocusScope
+ Navigation.parentItem: root
Navigation.rightItem: menuSelector
- onClicked: {
- if (MainCtx.hasEmbededVideo && !MainCtx.canShowVideoPIP) {
- mainPlaylistController.stop()
- }
- History.previous()
- }
+ onClicked: root.backRequested()
+
+ onHoveredChanged: root.requestLockUnlockAutoHide(hovered, root)
}
Image {
id: logo
Layout.alignment: Qt.AlignVCenter
+
sourceSize.width: VLCStyle.icon_small
sourceSize.height: VLCStyle.icon_small
source: "qrc:///logo/cone.svg"
@@ -173,74 +216,88 @@ FocusScope{
}
}
- Component {
- id: centerTitleTextComponent
-
- T.Label {
- id: centerTitleText
-
- readonly property int _availableWidth: rightColumn.x - (leftColumn.x + leftColumn.width)
- readonly property int _centerX: ((topcontrollerMouseArea.width - centerTitleText.implicitWidth) / 2)
- readonly property bool _alignHCenter: _centerX > leftColumn.x + leftColumn.width
- && _centerX + centerTitleText.implicitWidth < rightColumn.x
-
- y: leftColumn.y
- topPadding: VLCStyle.margin_xxsmall
- leftPadding: VLCStyle.margin_small
- rightPadding: VLCStyle.margin_small
- text: topFocusScope.title
- color: topFocusScope.colors.playerFg
- font.pixelSize: VLCStyle.dp(13, VLCStyle.scale)
- font.weight: Font.DemiBold
- elide: Text.ElideRight
- width: Math.min(centerTitleText._availableWidth, centerTitleText.implicitWidth)
-
- on_AlignHCenterChanged: _layout()
- Component.onCompleted: _layout()
-
- function _layout() {
- if (_alignHCenter) {
- centerTitleText.x = 0
- centerTitleText.anchors.horizontalCenter = topcontrollerMouseArea.horizontalCenter
- } else {
- centerTitleText.anchors.horizontalCenter = undefined
- centerTitleText.x = Qt.binding(function() { return leftColumn.x + leftColumn.width; })
- }
+ //FIXME use the the right class
+ T.Label {
+ id: centerTitleText
+
+ readonly property int _leftLimit: logoGroup.x + logoGroup.width
+ readonly property int _rightLimit: playlistGroup.x
+ readonly property int _availableWidth: _rightLimit - _leftLimit
+ readonly property int _centerX: ((topcontrollerMouseArea.width - centerTitleText.implicitWidth) / 2)
+ readonly property bool _alignHCenter: _centerX > _leftLimit
+ && _centerX + centerTitleText.implicitWidth < _rightLimit
+
+ visible: root.pinControls
+
+ width: Math.min(centerTitleText._availableWidth, centerTitleText.implicitWidth)
+
+ leftPadding: VLCStyle.margin_small
+ rightPadding: VLCStyle.margin_small
+
+ text: root.title
+ color: root.colors.playerFg
+ font.pixelSize: VLCStyle.dp(13, VLCStyle.scale)
+ font.weight: Font.DemiBold
+ elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
+
+ on_AlignHCenterChanged: _layout()
+ Component.onCompleted: _layout()
+
+ function _layout() {
+ if (_alignHCenter) {
+ centerTitleText.x = 0
+ centerTitleText.anchors.horizontalCenter = topcontrollerMouseArea.horizontalCenter
+ } else {
+ centerTitleText.anchors.horizontalCenter = undefined
+ centerTitleText.x = Qt.binding(function() { return centerTitleText._leftLimit })
}
}
}
- Component {
- id: leftTitleTextComponent
-
- //FIXME use the the right class
- T.Label {
- Layout.fillWidth: true
- Layout.maximumWidth: topFocusScope.textWidth - VLCStyle.margin_normal
-
- text: topFocusScope.title
- horizontalAlignment: Text.AlignLeft
- topPadding: VLCStyle.margin_large
- leftPadding: logo.x
- color: topFocusScope.colors.playerFg
- font.weight: Font.DemiBold
- font.pixelSize: VLCStyle.dp(18, VLCStyle.scale)
- elide: Text.ElideRight
- }
+ //FIXME use the the right class
+ T.Label {
+ id: leftTitleText
+
+ anchors.left: parent.left
+ anchors.top: logoGroup.bottom
+
+ width: root.textWidth - VLCStyle.margin_normal
+
+ visible: !root.pinControls
+
+ topPadding: VLCStyle.margin_large
+ leftPadding: logo.x
+
+ text: root.title
+ horizontalAlignment: Text.AlignLeft
+ color: root.colors.playerFg
+ font.weight: Font.DemiBold
+ font.pixelSize: VLCStyle.dp(18, VLCStyle.scale)
+ elide: Text.ElideRight
}
Loader {
id: csdDecorations
+ anchors.top: parent.top
+ anchors.right: parent.right
+
focus: false
height: VLCStyle.icon_normal
- active: MainCtx.clientSideDecoration
- enabled: MainCtx.clientSideDecoration
- visible: MainCtx.clientSideDecoration
+ active: root.showCSD
+ enabled: root.showCSD
+ visible: root.showCSD
source: "qrc:///widgets/CSDWindowButtonSet.qml"
onLoaded: {
- item.color = Qt.binding(function() { return topFocusScope.colors.playerFg })
- item.hoverColor = Qt.binding(function() { return topFocusScope.colors.windowCSDButtonDarkBg })
+ item.color = Qt.binding(function() { return root.colors.playerFg })
+ item.hoverColor = Qt.binding(function() { return root.colors.windowCSDButtonDarkBg })
+ }
+
+ Connections {
+ target: csdDecorations.item
+ enabled: csdDecorations.loaded
+ onHoveredChanged: root.requestLockUnlockAutoHide(csdDecorations.item.hovered, root)
}
}
@@ -252,28 +309,38 @@ FocusScope{
topPadding: VLCStyle.margin_xxsmall
rightPadding: VLCStyle.margin_xxsmall
+ anchors.top: parent.top
+
Widgets.IconControlButton {
id: menuSelector
- focus: true
+ visible: !root.showToolbar
+ enabled: visible
+ focus: visible
size: VLCStyle.banner_icon_size
+
+ width: VLCStyle.bannerButton_width
+ height: VLCStyle.bannerButton_height
+
iconText: VLCIcons.ellipsis
text: I18n.qtr("Menu")
- colors: topFocusScope.colors
+ colors: root.colors
- Navigation.parentItem: topFocusScope
+ Navigation.parentItem: root
Navigation.leftItem: backBtn
Navigation.rightItem: playlistButton
onClicked: contextMenu.popup(this.mapToGlobal(0, height))
+ onHoveredChanged: root.requestLockUnlockAutoHide(hovered, root)
+
QmlGlobalMenu {
id: contextMenu
ctx: MainCtx
- onAboutToShow: topFocusScope.requestLockUnlockAutoHide(true, contextMenu)
- onAboutToHide: topFocusScope.requestLockUnlockAutoHide(false, contextMenu)
+ onAboutToShow: root.requestLockUnlockAutoHide(true, contextMenu)
+ onAboutToHide: root.requestLockUnlockAutoHide(false, contextMenu)
}
}
@@ -284,12 +351,17 @@ FocusScope{
size: VLCStyle.banner_icon_size
iconText: VLCIcons.playlist
text: I18n.qtr("Playlist")
- colors: topFocusScope.colors
- focus: false
+ colors: root.colors
+ focus: root.showToolbar
+
+ width: VLCStyle.bannerButton_width
+ height: VLCStyle.bannerButton_height
- Navigation.parentItem: topFocusScope
- Navigation.leftItem: menuSelector
+ Navigation.parentItem: root
+ Navigation.leftItem: menuSelector.visible ? menuSelector : backBtn
onClicked: togglePlaylistVisibility()
+
+ onHoveredChanged: root.requestLockUnlockAutoHide(hovered, root)
}
}
}
=====================================
modules/gui/qt/widgets/qml/CSDWindowButton.qml
=====================================
@@ -23,7 +23,7 @@ import QtQuick.Layouts 1.11
import "qrc:///style/"
-T.TabButton {
+T.Button {
id: control
property color color: VLCStyle.colors.text
@@ -34,6 +34,7 @@ T.TabButton {
width: VLCStyle.dp(40, VLCStyle.scale)
implicitWidth: contentItem.implicitWidth
implicitHeight: contentItem.implicitHeight
+ focusPolicy: Qt.NoFocus
background: Rectangle {
height: control.height
=====================================
modules/gui/qt/widgets/qml/CSDWindowButtonSet.qml
=====================================
@@ -31,7 +31,10 @@ Row {
property color color: VLCStyle.colors.text
property color hoverColor: VLCStyle.colors.windowCSDButtonBg
+ property bool hovered: minimizeButton.hovered || maximizeButton.hovered || closeButton.hovered
+
CSDWindowButton {
+ id: minimizeButton
iconTxt: VLCIcons.window_minimize
onClicked: MainCtx.requestInterfaceMinimized()
height: windowButtonGroup.height
@@ -40,6 +43,7 @@ Row {
}
CSDWindowButton {
+ id: maximizeButton
iconTxt: (MainCtx.intfMainWindow.visibility === Window.Maximized) ? VLCIcons.window_restore :VLCIcons.window_maximize
onClicked: {
if (MainCtx.intfMainWindow.visibility === Window.Maximized) {
=====================================
modules/gui/qt/widgets/qml/DrawerExt.qml
=====================================
@@ -23,8 +23,6 @@ import "qrc:///style/"
FocusScope {
id: root
- property Component component: Item {}
-
enum Edges {
Top,
Bottom,
@@ -33,24 +31,26 @@ FocusScope {
}
property int edge: DrawerExt.Edges.Bottom
- property bool expandHorizontally: edge === DrawerExt.Edges.Left || edge === DrawerExt.Edges.Right
-
property alias contentItem: content.item
+ property alias component: content.sourceComponent
- width: (root.expandHorizontally) ? root._size : undefined
- height: (!root.expandHorizontally) ? root._size : undefined
+ property bool _expandHorizontally: edge === DrawerExt.Edges.Left || edge === DrawerExt.Edges.Right
+ property int _size: _expandHorizontally ? content.item.width : content.item.height
+ property string _toChange: _expandHorizontally ? "x" : "y"
- property int _size: (root.expandHorizontally) ? content.item.width : content.item.height
- property string toChange: expandHorizontally ? "contentX" : "contentY"
+ width: _expandHorizontally ? root._size : undefined
+ height: !_expandHorizontally ? root._size : undefined
- Flickable {
- id: container
- anchors.fill: parent
- Loader {
- focus: true
- id: content
- sourceComponent: root.component
- }
+
+ Loader {
+ id: content
+
+ anchors.left: !_expandHorizontally ? parent.left : undefined
+ anchors.right: !_expandHorizontally ? parent.right : undefined
+ anchors.top: _expandHorizontally ? parent.top : undefined
+ anchors.bottom: _expandHorizontally ? parent.bottom : undefined
+
+ focus: true
}
state: "hidden"
@@ -58,36 +58,43 @@ FocusScope {
State {
name: "visible"
PropertyChanges {
- target: container
- contentY: 0
- contentX: 0
+ target: content
+ y: 0
+ x: 0
visible: true
}
},
State {
name: "hidden"
PropertyChanges {
- target: container
- contentY: edgeToOffset(edge)
- contentX: edgeToOffset(edge)
- visible:false
+ target: content
+ y: root.edgeToOffset(root.edge)
+ x: root.edgeToOffset(root.edge)
+ visible: false
}
}
]
function edgeToOffset(edge){
- if(expandHorizontally)
- switch(edge){
- case DrawerExt.Edges.Left: return _size
- case DrawerExt.Edges.Right: return -_size
- default: return 0
+ if (root._expandHorizontally) {
+ switch (edge) {
+ case DrawerExt.Edges.Left:
+ return -root._size
+ case DrawerExt.Edges.Right:
+ return root._size
+ default:
+ return 0
}
- else
- switch(edge){
- case DrawerExt.Edges.Top: return _size
- case DrawerExt.Edges.Bottom: return -_size
- default: return 0
+ } else {
+ switch (edge) {
+ case DrawerExt.Edges.Top:
+ return -root._size
+ case DrawerExt.Edges.Bottom:
+ return root._size
+ default:
+ return 0
}
+ }
}
transitions: [
@@ -95,23 +102,33 @@ FocusScope {
to: "hidden"
SequentialAnimation {
NumberAnimation {
- target: container; property: toChange
+ target: content
+ property: root._toChange
- duration: VLCStyle.duration_short; easing.type: Easing.InSine
+ duration: VLCStyle.duration_short
+ easing.type: Easing.InSine
}
- PropertyAction{ target: container; property: "visible" }
+ PropertyAction{
+ target: content
+ property: "visible"
+ }
}
},
Transition {
to: "visible"
SequentialAnimation {
- PropertyAction { target: container; property: "visible" }
+ PropertyAction {
+ target: content
+ property: "visible"
+ }
NumberAnimation {
- target: container; property: toChange
+ target: content
+ property: root._toChange
- duration: VLCStyle.duration_short; easing.type: Easing.OutSine
+ duration: VLCStyle.duration_short
+ easing.type: Easing.OutSine
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0886e801c70bd6c9528581fb5341150ec3f14074...d747ad5097060d96c8726b4f315f6f6374d2725e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0886e801c70bd6c9528581fb5341150ec3f14074...d747ad5097060d96c8726b4f315f6f6374d2725e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list