forked from qt-creator/qt-creator
EffectMaker: Add 'save as' functunality
Also some tweaks Change-Id: Icc4767b816d1917cd674b20283d43e33ffb36219 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -26,8 +26,16 @@ Item {
|
||||
saveChangesDialog.open()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: EffectMakerBackend.effectMakerModel
|
||||
function onIsEmptyChanged() {
|
||||
if (EffectMakerBackend.effectMakerModel.isEmpty)
|
||||
saveAsDialog.close()
|
||||
}
|
||||
}
|
||||
|
||||
SaveAsDialog {
|
||||
id: saveDialog
|
||||
id: saveAsDialog
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
@@ -38,8 +46,8 @@ Item {
|
||||
onSave: {
|
||||
if (EffectMakerBackend.effectMakerModel.currentComposition === "") {
|
||||
// if current composition is unsaved, show save as dialog and clear afterwards
|
||||
saveDialog.clearOnClose = true
|
||||
saveDialog.open()
|
||||
saveAsDialog.clearOnClose = true
|
||||
saveAsDialog.open()
|
||||
} else {
|
||||
root.onSaveChangesCallback()
|
||||
}
|
||||
@@ -69,10 +77,12 @@ Item {
|
||||
let name = EffectMakerBackend.effectMakerModel.currentComposition
|
||||
|
||||
if (name === "")
|
||||
saveDialog.open()
|
||||
saveAsDialog.open()
|
||||
else
|
||||
EffectMakerBackend.effectMakerModel.saveComposition(name)
|
||||
}
|
||||
|
||||
onSaveAsClicked: saveAsDialog.open()
|
||||
}
|
||||
|
||||
EffectMakerPreview {
|
||||
|
@@ -84,17 +84,6 @@ Column {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: sourceImage.scale > .4
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.zoomOut_medium
|
||||
tooltip: qsTr("Zoom out")
|
||||
|
||||
onClicked: {
|
||||
sourceImage.scale -= .2
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: sourceImage.scale < 2
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
@@ -106,6 +95,17 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: sourceImage.scale > .4
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.zoomOut_medium
|
||||
tooltip: qsTr("Zoom out")
|
||||
|
||||
onClicked: {
|
||||
sourceImage.scale -= .2
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: sourceImage.scale !== 1
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
|
@@ -17,12 +17,13 @@ Rectangle {
|
||||
|
||||
signal addClicked
|
||||
signal saveClicked
|
||||
signal saveAsClicked
|
||||
|
||||
Row {
|
||||
spacing: 5
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
id: addButton
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: 5
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.add_medium
|
||||
tooltip: qsTr("Add new composition")
|
||||
@@ -31,8 +32,6 @@ Rectangle {
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: addButton.x + addButton.width + 5
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.save_medium
|
||||
tooltip: qsTr("Save current composition")
|
||||
@@ -42,6 +41,17 @@ Rectangle {
|
||||
onClicked: root.saveClicked()
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.saveAs_medium
|
||||
tooltip: qsTr("Save current composition with a new name")
|
||||
enabled: !EffectMakerBackend.effectMakerModel.isEmpty
|
||||
|
||||
onClicked: root.saveAsClicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
readonly property string compName: EffectMakerBackend.effectMakerModel.currentComposition
|
||||
|
||||
|
@@ -21,10 +21,10 @@ StudioControls.Dialog {
|
||||
property bool clearOnClose: false // clear the effect maker after saving
|
||||
|
||||
onOpened: {
|
||||
let model = EffectMakerBackend.effectMakerModel
|
||||
nameText.text = model.currentComposition === "" ? model.getUniqueEffectName() : model.currentComposition
|
||||
emptyText.text = ""
|
||||
nameText.text = EffectMakerBackend.effectMakerModel.getUniqueEffectName()
|
||||
nameText.selectAll()
|
||||
nameText.forceActiveFocus()
|
||||
emptyText.text = ""
|
||||
}
|
||||
|
||||
contentItem: Item {
|
||||
|
Reference in New Issue
Block a user