[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: fix ControlButtonPopup.qml
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Dec 8 15:09:10 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
d59aa616 by Fatih Uzunoglu at 2023-12-08T14:49:41+00:00
qml: fix ControlButtonPopup.qml
- Remove unnecessary placement logic.
- Correct unqualified access (root).
- Correctly override content item.
- - - - -
8ad3b32e by Fatih Uzunoglu at 2023-12-08T14:49:41+00:00
qml: rename ControlButtonPopup to PopupIconToolButton and move
- - - - -
5 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
- modules/gui/qt/player/qml/controlbarcontrols/TeletextButton.qml
- modules/gui/qt/vlc.qrc
- modules/gui/qt/player/qml/controlbarcontrols/ControlButtonPopup.qml → modules/gui/qt/widgets/qml/PopupIconToolButton.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -939,7 +939,6 @@ libqt_plugin_la_QML = \
gui/qt/player/qml/controlbarcontrols/BookmarkButton.qml \
gui/qt/player/qml/controlbarcontrols/ChapterNextButton.qml \
gui/qt/player/qml/controlbarcontrols/ChapterPreviousButton.qml \
- gui/qt/player/qml/controlbarcontrols/ControlButtonPopup.qml \
gui/qt/player/qml/controlbarcontrols/DvdMenuButton.qml \
gui/qt/player/qml/controlbarcontrols/ExpandingSpacerWidget.qml \
gui/qt/player/qml/controlbarcontrols/ExtendedSettingsButton.qml \
@@ -1069,7 +1068,8 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/DropShadowImage.qml \
gui/qt/widgets/qml/DoubleShadow.qml \
gui/qt/widgets/qml/FadingEdge.qml \
- gui/qt/widgets/qml/FadingEdgeForListView.qml
+ gui/qt/widgets/qml/FadingEdgeForListView.qml \
+ gui/qt/widgets/qml/PopupIconToolButton.qml
lib_qt_plugin_la_QRC = gui/qt/vlc.qrc
=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlaybackSpeedButton.qml
=====================================
@@ -23,15 +23,16 @@ import org.videolan.vlc 0.1
import "qrc:///style/"
import "qrc:///player/" as P
+import "qrc:///widgets/"
-ControlButtonPopup {
+PopupIconToolButton {
id: root
popup.width: VLCStyle.dp(256, VLCStyle.scale)
text: I18n.qtr("Playback Speed")
- popupContent: P.PlaybackSpeed {
+ popup.contentItem: P.PlaybackSpeed {
colorContext.palette: root.colorContext.palette
Navigation.parentItem: root
=====================================
modules/gui/qt/player/qml/controlbarcontrols/TeletextButton.qml
=====================================
@@ -24,8 +24,9 @@ import QtQuick.Controls 2.12
import org.videolan.vlc 0.1
import "qrc:///style/"
+import "qrc:///widgets/"
-ControlButtonPopup {
+PopupIconToolButton {
id: root
// Settings
@@ -36,7 +37,7 @@ ControlButtonPopup {
text: I18n.qtr("Teletext")
- popupContent: TeletextWidget {
+ popup.contentItem: TeletextWidget {
colorContext.palette: root.colorContext.palette
Navigation.parentItem: root
=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -228,6 +228,7 @@
<file alias="Slider.qml">widgets/qml/Slider.qml</file>
<file alias="FadingEdge.qml">widgets/qml/FadingEdge.qml</file>
<file alias="FadingEdgeForListView.qml">widgets/qml/FadingEdgeForListView.qml</file>
+ <file alias="PopupIconToolButton.qml">widgets/qml/PopupIconToolButton.qml</file>
</qresource>
<qresource prefix="/network">
<file alias="AddressbarButton.qml">network/qml/AddressbarButton.qml</file>
@@ -333,7 +334,6 @@
<file alias="BookmarkButton.qml">player/qml/controlbarcontrols/BookmarkButton.qml</file>
<file alias="ChapterNextButton.qml">player/qml/controlbarcontrols/ChapterNextButton.qml</file>
<file alias="ChapterPreviousButton.qml">player/qml/controlbarcontrols/ChapterPreviousButton.qml</file>
- <file alias="ControlButtonPopup.qml">player/qml/controlbarcontrols/ControlButtonPopup.qml</file>
<file alias="DvdMenuButton.qml">player/qml/controlbarcontrols/DvdMenuButton.qml</file>
<file alias="ExpandingSpacerWidget.qml">player/qml/controlbarcontrols/ExpandingSpacerWidget.qml</file>
<file alias="ExtendedSettingsButton.qml">player/qml/controlbarcontrols/ExtendedSettingsButton.qml</file>
=====================================
modules/gui/qt/player/qml/controlbarcontrols/ControlButtonPopup.qml → modules/gui/qt/widgets/qml/PopupIconToolButton.qml
=====================================
@@ -27,18 +27,11 @@ import "qrc:///style/"
import "qrc:///widgets/" as Widgets
import "qrc:///util/Helpers.js" as Helpers
-Widgets.IconControlButton {
+Widgets.IconToolButton {
id: control
- // Properties
-
- // Private
-
- readonly property bool _isCurrentViewPlayer: History.match(History.viewPath, ["player"])
// Aliases
- property alias popupContent: popup.contentItem
-
property alias popup: popup
// Signals
@@ -51,6 +44,8 @@ Widgets.IconControlButton {
color: (popup.visible) ? control.colorContext.accent : control.colorContext.fg.primary
+ size: VLCStyle.icon_toolbar
+
// FIXME: We can't use upItem because a Popup is not an Item.
Navigation.upAction: function() {
if (popup.visible) {
@@ -69,49 +64,22 @@ Widgets.IconControlButton {
onClicked: popup.open()
- // Connections
-
- Connections {
- target: (popup.visible) ? popup.parent : null
-
- onWidthChanged: _updatePosition()
- onHeightChanged: _updatePosition()
- }
-
- // Functions
-
- // Private
-
- // NOTE: coordinates are based on the popup parent view.
- function _updatePosition() {
- const parent = popup.parent
-
- const position = parent.mapFromItem(root, x, y)
-
- const popupX = Math.round(position.x - ((popup.width - width) / 2))
-
- const minimum = VLCStyle.applicationHorizontalMargin + VLCStyle.margin_xxsmall
-
- const maximum = parent.width - popup.width - minimum
-
- popup.x = Helpers.clamp(popupX, minimum, maximum)
-
- popup.y = position.y - popup.height - VLCStyle.margin_xxsmall
- }
-
// Children
Popup {
id: popup
- parent: (root._isCurrentViewPlayer) ? rootPlayer : g_mainInterface
+ x: (parent.width - width) / 2
+ y: -height - VLCStyle.margin_xxxsmall
padding: VLCStyle.margin_small
- z: 1
-
focus: true
+ // This popup should not exceed the boundaries of the scene.
+ // Setting margins to >=0 makes it sure that this is satisfied.
+ margins: 0
+
modal: true
// NOTE: Popup.CloseOnPressOutside doesn't work with non-model Popup on Qt < 5.15.
@@ -122,24 +90,19 @@ Widgets.IconControlButton {
// Events
onOpened: {
- root._updatePosition()
+ control.requestLockUnlockAutoHide(true)
- root.requestLockUnlockAutoHide(true)
-
- root.menuOpened(popup)
+ control.menuOpened(popup)
}
onClosed: {
- root.requestLockUnlockAutoHide(false)
+ control.requestLockUnlockAutoHide(false)
- root.forceActiveFocus()
+ control.forceActiveFocus()
- root.menuOpened(null)
+ control.menuOpened(null)
}
- onWidthChanged: if (visible) root._updatePosition()
- onHeightChanged: if (visible) root._updatePosition()
-
background: Rectangle {
ColorContext {
id: popupTheme
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3d1addbfefdab83ed4e8a7db7e7c54966e5fcaf5...8ad3b32ed1ca543c54a265f4ebe4ec36f67e9d43
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3d1addbfefdab83ed4e8a7db7e7c54966e5fcaf5...8ad3b32ed1ca543c54a265f4ebe4ec36f67e9d43
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