EffectComposer: Add confirmation dialog to clear all effect nodes

Fixes: QDS-11445
Change-Id: Iedd41e2799148c6d8f4eb3bca77dd5f1b7b053e6
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-02-12 17:06:34 +02:00
parent 93993c322e
commit e66b19d4c4
2 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,47 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Controls
import HelperWidgets as HelperWidgets
import StudioControls as StudioControls
import StudioTheme as StudioTheme
import EffectComposerBackend
StudioControls.Dialog {
id: root
title: qsTr("Confirm clear list")
closePolicy: Popup.CloseOnEscape
modal: true
implicitWidth: 270
implicitHeight: 150
contentItem: Item {
Text {
text: qsTr("You are about to clear the list of effect nodes.\n\nThis can not be undone.")
color: StudioTheme.Values.themeTextColor
}
Row {
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: 2
HelperWidgets.Button {
text: qsTr("Clear")
onClicked: {
EffectComposerBackend.effectComposerModel.clear()
root.accept()
}
}
HelperWidgets.Button {
anchors.bottom: parent.bottom
text: qsTr("Cancel")
onClicked: root.reject()
}
}
}
}

View File

@@ -65,6 +65,11 @@ ColumnLayout {
} }
} }
ConfirmClearAllDialog {
id: confirmClearAllDialog
anchors.centerIn: parent
}
EffectComposerTopBar { EffectComposerTopBar {
Layout.fillWidth: true Layout.fillWidth: true
@@ -157,7 +162,12 @@ ColumnLayout {
tooltip: qsTr("Remove all effect nodes.") tooltip: qsTr("Remove all effect nodes.")
enabled: !root.backendModel.isEmpty enabled: !root.backendModel.isEmpty
onClicked: root.backendModel.clear() onClicked: {
if (root.backendModel.hasUnsavedChanges)
confirmClearAllDialog.open()
else
root.backendModel.clear()
}
} }
HelperWidgets.AbstractButton { HelperWidgets.AbstractButton {