[vlc-commits] [Git][videolan/vlc][master] qml: remove unnecessary or ambiguous properties from AnimatedBackground
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Dec 3 18:39:30 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
15c8ab6e by Fatih Uzunoglu at 2023-12-03T18:22:44+00:00
qml: remove unnecessary or ambiguous properties from AnimatedBackground
- - - - -
19 changed files:
- modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/network/qml/AddressbarButton.qml
- modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
- modules/gui/qt/player/qml/controlbarcontrols/Fallback.qml
- modules/gui/qt/player/qml/controlbarcontrols/HighResolutionTimeWidget.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- modules/gui/qt/widgets/qml/AnimatedBackground.qml
- modules/gui/qt/widgets/qml/BannerTabButton.qml
- modules/gui/qt/widgets/qml/ButtonExt.qml
- modules/gui/qt/widgets/qml/CheckButton.qml
- modules/gui/qt/widgets/qml/CheckedDelegate.qml
- modules/gui/qt/widgets/qml/ComboBoxExt.qml
- modules/gui/qt/widgets/qml/GridItem.qml
- modules/gui/qt/widgets/qml/IconToolButton.qml
- modules/gui/qt/widgets/qml/ImageToolButton.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml
- modules/gui/qt/widgets/qml/TextToolButton.qml
Changes:
=====================================
modules/gui/qt/dialogs/dialogs/qml/WindowDialog.qml
=====================================
@@ -109,11 +109,9 @@ Window {
// NOTE: We specify a dedicated background with borders to improve clarity.
background: Widgets.AnimatedBackground {
- animate: button.colorContext.initialized
- backgroundColor: button.colorContext.bg.primary
- activeBorderColor: button.colorContext.visualFocus
+ enabled: button.colorContext.initialized
+ color: button.colorContext.bg.primary
border.width: VLCStyle.border
-
border.color: button.colorContext.border
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -76,11 +76,9 @@ T.ItemDelegate {
}
background: Widgets.AnimatedBackground {
- active: visualFocus
-
- animate: theme.initialized
- backgroundColor: root.isCurrent ? theme.bg.highlight : theme.bg.primary
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ color: root.isCurrent ? theme.bg.highlight : theme.bg.primary
+ border.color: visualFocus ? theme.visualFocus : "transparent"
Widgets.CurrentIndicator {
length: parent.height - (margin * 2)
=====================================
modules/gui/qt/network/qml/AddressbarButton.qml
=====================================
@@ -65,12 +65,9 @@ T.AbstractButton {
background: Widgets.AnimatedBackground {
- active: visualFocus
-
- animate: theme.initialized
- backgroundColor: button.backgroundColor
- foregroundColor: button.foregroundColor
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ color: button.backgroundColor
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: contentLoader.item
@@ -95,6 +92,13 @@ T.AbstractButton {
color: button.foregroundColor
font.pixelSize: button.font.pixelSize
+
+ Behavior on color {
+ enabled: theme.initialized
+ ColorAnimation {
+ duration: VLCStyle.duration_long
+ }
+ }
}
}
=====================================
modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
=====================================
@@ -86,9 +86,8 @@ AbstractButton {
onClicked: History.push(["player"])
background: Widgets.AnimatedBackground {
- active: visualFocus
- animate: theme.initialized
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
// Children
=====================================
modules/gui/qt/player/qml/controlbarcontrols/Fallback.qml
=====================================
@@ -42,9 +42,8 @@ Control {
}
background: Widgets.AnimatedBackground {
- active: visualFocus
- animate: theme.initialized
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: Widgets.MenuLabel {
=====================================
modules/gui/qt/player/qml/controlbarcontrols/HighResolutionTimeWidget.qml
=====================================
@@ -65,9 +65,8 @@ Control {
}
background: Widgets.AnimatedBackground {
- active: visualFocus
- animate: theme.initialized
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: Item {
=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
=====================================
@@ -50,7 +50,6 @@ ControlButtonPopup {
text: !root.paintOnly ? I18n.qtr("%1x").arg(+Player.rate.toFixed(2))
: I18n.qtr("1x")
- // IconToolButton.background is a AnimatedBackground
- color: root.background.foregroundColor
+ color: root.color
}
}
=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -109,12 +109,11 @@ T.ItemDelegate {
}
background: Widgets.AnimatedBackground {
- backgroundColor: selected ? theme.bg.highlight : theme.bg.primary
+ color: selected ? theme.bg.highlight : theme.bg.primary
- active: delegate.visualFocus
- animate: theme.initialized
+ enabled: theme.initialized
- activeBorderColor: theme.visualFocus
+ border.color: delegate.visualFocus ? theme.visualFocus : "transparent"
Widgets.CurrentIndicator {
id: currentIndicator
=====================================
modules/gui/qt/widgets/qml/AnimatedBackground.qml
=====================================
@@ -29,41 +29,24 @@ Rectangle {
// Settings
//---------------------------------------------------------------------------------------------
- property bool active: activeFocus
-
- // background of this component changes, set it in binding, the changes will be animated
- property color backgroundColor: "transparent"
-
- // `foregroundColor` property is not used in this component but is
- // provided as a convenience as it gets animated with color property
- property color foregroundColor
-
- property color activeBorderColor
-
property int animationDuration: VLCStyle.duration_long
- property bool animationRunning: borderAnimation.running || bgAnimation.running
-
- property bool animate: true
+ readonly property bool animationRunning: borderAnimation.running || bgAnimation.running
//---------------------------------------------------------------------------------------------
// Implementation
//---------------------------------------------------------------------------------------------
- color: backgroundColor
-
- border.color: root.active
- ? root.activeBorderColor
- : VLCStyle.setColorAlpha(root.activeBorderColor, 0)
+ color: "transparent"
- border.width: root.active ? VLCStyle.focus_border : 0
+ border.width: VLCStyle.focus_border
//---------------------------------------------------------------------------------------------
// Animations
//---------------------------------------------------------------------------------------------
Behavior on border.color {
- enabled: root.animate
+ enabled: root.enabled
ColorAnimation {
id: borderAnimation
@@ -73,18 +56,12 @@ Rectangle {
}
Behavior on color {
- enabled: root.animate
+ enabled: root.enabled
+
ColorAnimation {
id: bgAnimation
duration: root.animationDuration
}
}
-
- Behavior on foregroundColor {
- enabled: root.animate
- ColorAnimation {
- duration: root.animationDuration
- }
- }
}
=====================================
modules/gui/qt/widgets/qml/BannerTabButton.qml
=====================================
@@ -87,14 +87,12 @@ T.TabButton {
height: control.height
width: control.width
- active: visualFocus
- animate: theme.initialized
+ enabled: theme.initialized
animationDuration: VLCStyle.duration_short
- backgroundColor: theme.bg.primary
- foregroundColor: control.selected ? theme.fg.secondary : theme.fg.primary
- activeBorderColor: theme.visualFocus
+ color: theme.bg.primary
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: Item {
@@ -125,7 +123,15 @@ T.TabButton {
text: control.text
- color: control.background.foregroundColor
+ color: control.selected ? theme.fg.secondary : theme.fg.primary
+
+ Behavior on color {
+ enabled: theme.initialized
+
+ ColorAnimation {
+ duration: VLCStyle.duration_long
+ }
+ }
font.pixelSize: VLCStyle.fontSize_normal
=====================================
modules/gui/qt/widgets/qml/ButtonExt.qml
=====================================
@@ -92,12 +92,10 @@ T.Button {
height: control.height
width: control.width
- active: control.visualFocus
- animate: theme.initialized && !control.extBackgroundAnimation
+ enabled: theme.initialized && !control.extBackgroundAnimation
- backgroundColor: theme.bg.primary
- foregroundColor: control.color
- activeBorderColor: control.colorFocus
+ color: theme.bg.primary
+ border.color: control.visualFocus ? control.colorFocus : "transparent"
}
contentItem: Item {
=====================================
modules/gui/qt/widgets/qml/CheckButton.qml
=====================================
@@ -156,9 +156,8 @@ T.Switch {
}
background: AnimatedBackground {
- active: root.visualFocus
- animate: theme.initialized
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ border.color: root.visualFocus ? theme.visualFocus : "transparent"
}
indicator: Rectangle {
=====================================
modules/gui/qt/widgets/qml/CheckedDelegate.qml
=====================================
@@ -49,11 +49,9 @@ T.ItemDelegate {
}
background: AnimatedBackground {
- active: visualFocus
-
- animate: theme.initialized
- backgroundColor: control.checked ? theme.bg.highlight : theme.bg.primary
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ color: control.checked ? theme.bg.highlight : theme.bg.primary
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: Item { // don't use a row, it will move text when control is unchecked
=====================================
modules/gui/qt/widgets/qml/ComboBoxExt.qml
=====================================
@@ -124,10 +124,9 @@ ComboBox {
currentIndex: control.highlightedIndex
highlight: Widgets.AnimatedBackground {
- active: visualFocus
- animate: theme.initialized
- activeBorderColor: theme.visualFocus
- backgroundColor: theme.bg.secondary
+ enabled: theme.initialized
+ border.color: visualFocus ? theme.visualFocus : "transparent"
+ color: theme.bg.secondary
}
ScrollIndicator.vertical: ScrollIndicator { }
=====================================
modules/gui/qt/widgets/qml/GridItem.qml
=====================================
@@ -169,13 +169,11 @@ T.ItemDelegate {
x: - selectedBorderWidth
y: - selectedBorderWidth
- active: visualFocus
- animate: theme.initialized
+ enabled: theme.initialized
//don't show the backgroud unless selected
- backgroundColor: root.selected ? theme.bg.highlight : theme.bg.primary
- activeBorderColor: theme.visualFocus
- visible: animationRunning || active || root.selected || root.hovered
+ color: root.selected ? theme.bg.highlight : theme.bg.primary
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: MouseArea {
=====================================
modules/gui/qt/widgets/qml/IconToolButton.qml
=====================================
@@ -90,14 +90,11 @@ T.ToolButton {
implicitWidth: size
implicitHeight: size
- animate: theme.initialized
+ enabled: theme.initialized
- active: control.visualFocus
+ color: control.backgroundColor
- backgroundColor: control.backgroundColor
- foregroundColor: control.color
-
- activeBorderColor: theme.visualFocus
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
contentItem: T.Label {
@@ -108,7 +105,14 @@ T.ToolButton {
text: control.iconText
- color: control.background.foregroundColor
+ color: control.color
+
+ Behavior on color {
+ enabled: theme.initialized
+ ColorAnimation {
+ duration: VLCStyle.duration_long
+ }
+ }
font.pixelSize: control.size
font.family: VLCIcons.fontFamily
=====================================
modules/gui/qt/widgets/qml/ImageToolButton.qml
=====================================
@@ -62,12 +62,10 @@ T.ToolButton {
width: control.sourceSize.width
height: control.sourceSize.height
- active: control.visualFocus
- animate: theme.initialized
+ enabled: theme.initialized
- backgroundColor: theme.bg.primary
- foregroundColor: theme.fg.primary
- activeBorderColor: theme.visualFocus
+ color: theme.bg.primary
+ border.color: control.visualFocus ? theme.visualFocus : "transparent"
}
contentItem: Image {
=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -103,12 +103,10 @@ T.Control {
}
background: AnimatedBackground {
- active: visualFocus
-
animationDuration: VLCStyle.duration_short
- animate: theme.initialized
- backgroundColor: delegate.selected ? theme.bg.highlight : theme.bg.primary
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ color: delegate.selected ? theme.bg.highlight : theme.bg.primary
+ border.color: visualFocus ? theme.visualFocus : "transparent"
MouseArea {
id: hoverArea
=====================================
modules/gui/qt/widgets/qml/TextToolButton.qml
=====================================
@@ -66,9 +66,8 @@ T.ToolButton {
}
background: AnimatedBackground {
- animate: theme.initialized
- active: visualFocus
- backgroundColor: theme.bg.primary
- activeBorderColor: theme.visualFocus
+ enabled: theme.initialized
+ color: theme.bg.primary
+ border.color: visualFocus ? theme.visualFocus : "transparent"
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/15c8ab6ed010b8d551f1149574e44d1e95d12d9c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/15c8ab6ed010b8d551f1149574e44d1e95d12d9c
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