Files
qt-creator/share/qtcreator/qmldesigner/effectMakerQmlSources/SaveChangesDialog.qml
Mahmoud Badri 9d8aa76b4c EffectMaker: Show save popup when adding a new effect
when there is an untitled effect composition in the effect maker.

Change-Id: I3d905202e52b1242949d72f1870d4cc06efe080b
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2023-12-12 12:16:04 +00:00

66 lines
1.6 KiB
QML

// Copyright (C) 2023 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 EffectMakerBackend
StudioControls.Dialog {
id: root
title: qsTr("Save Changes")
closePolicy: Popup.CloseOnEscape
modal: true
implicitWidth: 300
implicitHeight: 130
signal save()
signal discard()
contentItem: Item {
Text {
text: qsTr("Current composition has unsaved changes.")
color: StudioTheme.Values.themeTextColor
}
HelperWidgets.Button {
width: 60
anchors.bottom: parent.bottom
text: qsTr("Cancel")
onClicked: root.reject()
}
Row {
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: 2
HelperWidgets.Button {
width: 50
text: qsTr("Save")
onClicked: {
let name = EffectMakerBackend.effectMakerModel.currentComposition
if (name !== "")
EffectMakerBackend.effectMakerModel.saveComposition(name)
root.save()
root.accept()
}
}
HelperWidgets.Button {
width: 110
text: qsTr("Discard Changes")
onClicked: {
root.discard()
root.accept()
}
}
}
}
}