[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: remove mouse area in ArtworkInfoWidget
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Mon Oct 11 10:08:33 UTC 2021
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
9875420a by Fatih Uzunoglu at 2021-10-11T09:53:07+00:00
qml: remove mouse area in ArtworkInfoWidget
- - - - -
1a007b0f by Fatih Uzunoglu at 2021-10-11T09:53:07+00:00
qml: make fallback widget a Control
- - - - -
5f674bc6 by Fatih Uzunoglu at 2021-10-11T09:53:07+00:00
qml: refactor PointingTooltip
- - - - -
b518467b by Fatih Uzunoglu at 2021-10-11T09:53:07+00:00
qml: make tooltip colors theme aware
- - - - -
8 changed files:
- modules/gui/qt/player/qml/ControlBar.qml
- modules/gui/qt/player/qml/PlayerButtonsLayout.qml
- modules/gui/qt/player/qml/SliderBar.qml
- modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
- modules/gui/qt/player/qml/controlbarcontrols/Fallback.qml
- modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
- modules/gui/qt/style/VLCColors.qml
- modules/gui/qt/widgets/qml/PointingTooltip.qml
Changes:
=====================================
modules/gui/qt/player/qml/ControlBar.qml
=====================================
@@ -179,7 +179,6 @@ Control {
progressBarColor: activeFocus ? colors.accent : colors.playerControlBarFg
barHeight: VLCStyle.heightBar_xxsmall
enabled: player.playingState == PlayerController.PLAYING_STATE_PLAYING || player.playingState == PlayerController.PLAYING_STATE_PAUSED
- parentWindow: g_root
colors: root.colors
Navigation.parentItem: root
=====================================
modules/gui/qt/player/qml/PlayerButtonsLayout.qml
=====================================
@@ -28,8 +28,6 @@ FocusScope {
implicitHeight: VLCStyle.maxControlbarControlHeight
- property var parentWindow: g_root
-
property var colors: undefined
property var defaultSize: VLCStyle.icon_normal // default size for IconToolButton based controls
=====================================
modules/gui/qt/player/qml/SliderBar.qml
=====================================
@@ -30,7 +30,6 @@ Slider {
property bool _isHold: false
property bool _isSeekPointsShown: true
- property alias parentWindow: timeTooltip.parentWindow
property alias backgroundColor: sliderRect.color
property alias progressBarColor: progressRect.color
@@ -56,11 +55,11 @@ Slider {
visible: control.hovered
- text: player.length.scale(timeTooltip.position).toString() +
+ text: player.length.scale(pos.x / control.width).toString() +
(player.hasChapters ?
" - " + player.chapters.getNameAtPosition(timeTooltip.position) : "")
- mouseArea: sliderRectMouseArea
+ pos: Qt.point(sliderRectMouseArea.mouseX, 0)
colors: control.colors
}
=====================================
modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
=====================================
@@ -25,7 +25,7 @@ import "qrc:///widgets/" as Widgets
import "qrc:///style/"
-Control {
+AbstractButton {
id: artworkInfoItem
property bool paintOnly: false
@@ -51,12 +51,8 @@ Control {
}
}
- MouseArea {
- id: artworkInfoMouseArea
- anchors.fill: parent
- visible: !paintOnly
- onClicked: g_mainDisplay.showPlayer()
- hoverEnabled: true
+ onClicked: {
+ g_mainDisplay.showPlayer()
}
background: Widgets.AnimatedBackground {
@@ -114,7 +110,7 @@ Control {
visible: artworkInfoItem.visible
&& infoColumn.width < infoColumn.preferredWidth
- && (artworkInfoMouseArea.containsMouse || artworkInfoItem.visualFocus)
+ && (artworkInfoItem.hovered || artworkInfoItem.visualFocus)
delay: 500
contentItem: Text {
=====================================
modules/gui/qt/player/qml/controlbarcontrols/Fallback.qml
=====================================
@@ -28,23 +28,23 @@ import "qrc:///style/"
import "qrc:///util/Helpers.js" as Helpers
-Widgets.AnimatedBackground {
- implicitWidth: fbLabel.width + VLCStyle.focus_border * 2
- implicitHeight: fbLabel.height + VLCStyle.focus_border * 2
+Control {
+ padding: VLCStyle.focus_border
- activeBorderColor: colors.bgFocus
+ Keys.priority: Keys.AfterItem
+ Keys.onPressed: Navigation.defaultKeyAction(event)
property bool paintOnly: false
property VLCColors colors: VLCStyle.colors
- Widgets.MenuLabel {
- id: fbLabel
-
- anchors.centerIn: parent
+ background: Widgets.AnimatedBackground {
+ active: visualFocus
+ activeBorderColor: colors.bgFocus
+ }
+ contentItem: Widgets.MenuLabel {
text: i18n.qtr("WIDGET\nNOT\nFOUND")
horizontalAlignment: Text.AlignHCenter
-
color: colors.text
}
}
=====================================
modules/gui/qt/player/qml/controlbarcontrols/VolumeWidget.qml
=====================================
@@ -33,9 +33,6 @@ FocusScope{
property bool paintOnly: false
property color color: colors.buttonText
-
- property alias parentWindow: volumeTooltip.parentWindow
-
property VLCColors colors: VLCStyle.colors
readonly property var _player: paintOnly ? ({ muted: false, volume: .5 }) : player
@@ -173,20 +170,14 @@ FocusScope{
id: volumeTooltip
active: !paintOnly
- property var parentWindow: (typeof playerButtonsLayout === "undefined") ? g_root : playerButtonsLayout.parentWindow
-
sourceComponent: Widgets.PointingTooltip {
- visible: sliderMouseArea.containsMouse
+ visible: sliderMouseArea.pressed || sliderMouseArea.containsMouse
text: Math.round(volControl.value * 100) + "%"
- mouseArea: sliderMouseArea
-
- xPos: (handle.x + handle.width / 2)
+ pos: Qt.point(handle.x + handle.width / 2, 0)
colors: widgetfscope.colors
-
- parentWindow: volumeTooltip.parentWindow
}
}
=====================================
modules/gui/qt/style/VLCColors.qml
=====================================
@@ -166,8 +166,8 @@ Item {
property color sliderBarMiniplayerBgColor: isThemeDark ? "#FF929292" : "#FFEEEEEE"
- property color tooltipTextColor: systemPalette.tooltipText
- property color tooltipColor: systemPalette.tooltip
+ property color tooltipTextColor: isThemeDark ? white : black
+ property color tooltipColor: isThemeDark ? black : white
//vlc orange
property color accent: (isThemeDark) ? "#ff8800" : "#ff610a"
@@ -312,6 +312,9 @@ Item {
expandDelegate: bg
isThemeDark: systemPalette.isDark
+
+ tooltipColor: systemPalette.tooltip
+ tooltipTextColor: systemPalette.tooltipText
}
}
]
=====================================
modules/gui/qt/widgets/qml/PointingTooltip.qml
=====================================
@@ -17,131 +17,63 @@
*****************************************************************************/
import QtQuick 2.11
import QtQuick.Controls 2.4
-import QtGraphicalEffects 1.0
import "qrc:///style/"
-Item {
+ToolTip {
id: pointingTooltip
- // set parentWindow if you want to let tooltip not exceed window boundaries
- // if it is not set, tooltip will use mouseArea as the bounding rect..
- // Note that for now it only works with x axis.
- property var parentWindow: g_root
+ margins: 0
+ padding: VLCStyle.margin_xxsmall
- property var mouseArea: undefined
+ x: _x
+ y: pos.y - (implicitHeight + arrowArea.implicitHeight + VLCStyle.dp(7.5))
- property alias text: timeMetrics.text
-
- // set fixedY if you want to fix y position of the tooltip
- property bool fixedY: true
-
- readonly property real position: xPos / mouseArea.width
- property real xPos: Math.max(Math.min(mouseArea.mouseX, mouseArea.width), 0.0)
- property real yPos: Math.max(Math.min(mouseArea.mouseY, mouseArea.height), 0.0)
+ font.pixelSize: VLCStyle.fontSize_normal
property VLCColors colors: VLCStyle.colors
- width: childrenRect.width
- height: childrenRect.height
-
- function getX() {
- var x = xPos - (pointingTooltip.width / 2)
- var diff = (x + pointingTooltip.width)
- var windowMappedX = !!parentWindow ? parentWindow.mapFromItem(mouseArea, mouseArea.x, mouseArea.y).x : undefined
-
- var sliderRealX = 0
-
- if (!!parentWindow) {
- diff -= parentWindow.width - windowMappedX
- sliderRealX = windowMappedX
- } else {
- diff -= mouseArea.width
- }
+ readonly property real _x: pos.x - (width / 2)
+ property point pos
- if (x < -sliderRealX) {
- if (!!parentWindow)
- arrow.diff = x + windowMappedX
- else
- arrow.diff = x
- x = -sliderRealX
- } else if (diff > 0) {
- arrow.diff = diff
- x -= (diff)
- } else {
- arrow.diff = 0
- }
-
- return x
+ contentItem: Label {
+ text: pointingTooltip.text
+ font: pointingTooltip.font
+ color: colors.tooltipTextColor
}
- y: fixedY ? -(childrenRect.height) : yPos - childrenRect.height
- x: getX()
-
- Item {
- height: arrow.height * Math.sqrt(2)
- width: timeIndicatorRect.width
-
- anchors.horizontalCenter: timeIndicatorRect.horizontalCenter
- anchors.verticalCenter: timeIndicatorRect.bottom
- anchors.verticalCenterOffset: height / 2
-
- clip: true
-
- Rectangle {
- id: arrow
- width: VLCStyle.dp(10, VLCStyle.scale)
- height: VLCStyle.dp(10, VLCStyle.scale)
-
- anchors.centerIn: parent
- anchors.verticalCenterOffset: -(parent.height / 2)
- anchors.horizontalCenterOffset: diff
+ background: Rectangle {
+ border.color: colors.border
+ color: colors.tooltipColor
+ radius: VLCStyle.dp(6, VLCStyle.scale)
- property int diff: 0
+ Item {
+ id: arrowArea
- color: colors.bgAlt
+ z: 1
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.bottom
+ anchors.topMargin: -(parent.border.width)
- rotation: 45
+ implicitHeight: arrow.implicitHeight * Math.sqrt(2) / 2
- RectangularGlow {
- anchors.fill: parent
- glowRadius: VLCStyle.dp(2, VLCStyle.scale)
- spread: 0.2
- color: colors.glowColor
- }
- }
- }
+ clip: true
- Rectangle {
- id: timeIndicatorRect
- width: timeMetrics.width + VLCStyle.dp(10, VLCStyle.scale)
- height: timeMetrics.height + VLCStyle.dp(5, VLCStyle.scale)
+ Rectangle {
+ id: arrow
- color: colors.bgAlt
- radius: VLCStyle.dp(6, VLCStyle.scale)
-
- RectangularGlow {
- anchors.fill: parent
-
- glowRadius: VLCStyle.dp(2, VLCStyle.scale)
- cornerRadius: parent.radius
- spread: 0.2
-
- color: colors.glowColor
- }
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.horizontalCenterOffset: _x - pointingTooltip.x
+ anchors.verticalCenter: parent.top
- Label {
- anchors.fill: parent
- text: timeMetrics.text
- color: colors.text
- font: timeMetrics.font
+ implicitWidth: VLCStyle.dp(10, VLCStyle.scale)
+ implicitHeight: VLCStyle.dp(10, VLCStyle.scale)
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
+ rotation: 45
- TextMetrics {
- id: timeMetrics
- font.pixelSize: VLCStyle.fontSize_normal
+ color: background.color
+ border.color: background.border.color
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/45d3d2bde4b6ca17f359d5748a864976b1bc00bc...b518467b5fd7604b580f48b7ac59a4da8463e140
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/45d3d2bde4b6ca17f359d5748a864976b1bc00bc...b518467b5fd7604b580f48b7ac59a4da8463e140
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list