[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: fix modality of dialogs
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Feb 4 06:35:24 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1a65e334 by Pierre Lamot at 2024-02-04T06:18:32+00:00
qml: fix modality of dialogs
- - - - -
e980c6fd by Pierre Lamot at 2024-02-04T06:18:32+00:00
qml: fix dialog positioning
- - - - -
88081fbf by Pierre Lamot at 2024-02-04T06:18:32+00:00
qml: provide progress dialog
- - - - -
2 changed files:
- modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
- modules/gui/qt/dialogs/dialogs/qml/ModalDialog.qml
Changes:
=====================================
modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
=====================================
@@ -76,14 +76,14 @@ Item {
{
target: dialogModel
- onLogin: {
+ onLogin: (dialogId, title, text, defaultUsername, askStore) => {
loginDialog.dialogId = dialogId
loginDialog.title = title
loginDialog.defaultUsername = defaultUsername
loginDialog.open()
}
- onQuestion: {
+ onQuestion: (dialogId, title, text, type, cancel, action1, action2) => {
questionDialog.dialogId = dialogId
questionDialog.title = title
questionDialog.text = text
@@ -93,15 +93,26 @@ Item {
questionDialog.open()
}
- onProgress: {
- console.warn("onProgressUpdated is not implemented")
+ onProgress: (dialogId, title, text, indeterminate, position, cancel) => {
+ progressDialog.dialogId = dialogId
+ progressDialog.title = title
+ progressDialog.text = text
+ progressDialog.cancelTxt = cancel
+ progressDialog.position = position
+ progressDialog.interderminate = indeterminate
+ progressDialog.open()
}
- onProgressUpdated: {
- console.warn("onProgressUpdated is not implemented")
+ onProgressUpdated: (dialogId, position, text) => {
+ if (progressDialog.dialogId !== dialogId) {
+ console.warn("progress event on an inexisting dialog")
+ return
+ }
+ progressDialog.text = text
+ progressDialog.position = position
}
- onCancelled: {
+ onCancelled: (dialogId) => {
if (questionDialog.dialogId === dialogId) {
questionDialog.close()
questionDialog.dialogId = null
@@ -110,6 +121,10 @@ Item {
loginDialog.close()
loginDialog.dialogId = null
dialogModel.dismiss(dialogId)
+ } else if (progressDialog.dialogId === dialogId) {
+ progressDialog.close()
+ progressDialog.dialogId = null
+ dialogModel.dismiss(dialogId)
} else {
dialogModel.dismiss(dialogId)
}
@@ -387,6 +402,78 @@ Item {
}
}
+ ModalDialog {
+ id: progressDialog
+
+ property var dialogId: null
+
+ property string text : ""
+ property string cancelTxt: ""
+ property bool interderminate: false
+ property real position: 0.0
+
+ onAboutToHide: restoreFocus()
+ rootWindow: root.bgContent
+
+ contentItem: ColumnLayout {
+
+ readonly property ColorContext colorContext: ColorContext {
+ id: progressContentTheme
+ palette: VLCStyle.palette
+ colorSet: ColorContext.Window
+ }
+
+ Text {
+ focus: false
+ font.pixelSize: VLCStyle.fontSize_normal
+ color: progressContentTheme.fg.primary
+ text: progressDialog.text
+ wrapMode: Text.WordWrap
+ }
+
+ ProgressBar {
+ Layout.fillWidth:true
+
+ from: 0.0
+ to: 1.0
+
+ indeterminate: progressDialog.interderminate
+ value: progressDialog.position
+ }
+ }
+
+
+ footer: FocusScope {
+ focus: true
+ implicitHeight: VLCStyle.icon_normal
+
+ readonly property ColorContext colorContext: ColorContext {
+ palette: VLCStyle.palette
+ colorSet: ColorContext.Window
+ }
+
+ Rectangle {
+ color: questionDialog.colorContext.bg.primary
+ anchors.fill: parent
+ anchors.leftMargin: VLCStyle.margin_xxsmall
+ anchors.rightMargin: VLCStyle.margin_xxsmall
+
+ Widgets.TextToolButton {
+ anchors.right: parent.right
+ focus: true
+ visible: text !== ""
+ text: progressDialog.cancelTxt
+
+ onClicked: {
+ dialogModel.dismiss(progressDialog.dialogId)
+ progressDialog.dialogId = null
+ progressDialog.close()
+ }
+ }
+ }
+ }
+ }
+
ModalDialog {
id: questionDialog
=====================================
modules/gui/qt/dialogs/dialogs/qml/ModalDialog.qml
=====================================
@@ -34,8 +34,9 @@ Dialog {
focus: true
modal: true
- x: (rootWindow.x + rootWindow.width - width) / 2
- y: (rootWindow.y + rootWindow.height - height) / 2
+
+ anchors.centerIn: Overlay.overlay
+
padding: VLCStyle.margin_normal
margins: VLCStyle.margin_large
@@ -44,6 +45,8 @@ Dialog {
+ (footer && footer.visible ? footer.implicitHeight + spacing : 0)
+ (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
+ closePolicy: Popup.CloseOnEscape
+
readonly property ColorContext colorContext: ColorContext {
id: theme
palette: VLCStyle.palette
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a2e804702885d668fcfeefabcd0f6aecdff7fb27...88081fbfbd3c88c10430961aab73df0222447ca9
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a2e804702885d668fcfeefabcd0f6aecdff7fb27...88081fbfbd3c88c10430961aab73df0222447ca9
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