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()
|
saveChangesDialog.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: EffectMakerBackend.effectMakerModel
|
||||||
|
function onIsEmptyChanged() {
|
||||||
|
if (EffectMakerBackend.effectMakerModel.isEmpty)
|
||||||
|
saveAsDialog.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SaveAsDialog {
|
SaveAsDialog {
|
||||||
id: saveDialog
|
id: saveAsDialog
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,8 +46,8 @@ Item {
|
|||||||
onSave: {
|
onSave: {
|
||||||
if (EffectMakerBackend.effectMakerModel.currentComposition === "") {
|
if (EffectMakerBackend.effectMakerModel.currentComposition === "") {
|
||||||
// if current composition is unsaved, show save as dialog and clear afterwards
|
// if current composition is unsaved, show save as dialog and clear afterwards
|
||||||
saveDialog.clearOnClose = true
|
saveAsDialog.clearOnClose = true
|
||||||
saveDialog.open()
|
saveAsDialog.open()
|
||||||
} else {
|
} else {
|
||||||
root.onSaveChangesCallback()
|
root.onSaveChangesCallback()
|
||||||
}
|
}
|
||||||
@@ -69,10 +77,12 @@ Item {
|
|||||||
let name = EffectMakerBackend.effectMakerModel.currentComposition
|
let name = EffectMakerBackend.effectMakerModel.currentComposition
|
||||||
|
|
||||||
if (name === "")
|
if (name === "")
|
||||||
saveDialog.open()
|
saveAsDialog.open()
|
||||||
else
|
else
|
||||||
EffectMakerBackend.effectMakerModel.saveComposition(name)
|
EffectMakerBackend.effectMakerModel.saveComposition(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSaveAsClicked: saveAsDialog.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectMakerPreview {
|
EffectMakerPreview {
|
||||||
|
@@ -84,17 +84,6 @@ Column {
|
|||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
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 {
|
HelperWidgets.AbstractButton {
|
||||||
enabled: sourceImage.scale < 2
|
enabled: sourceImage.scale < 2
|
||||||
style: StudioTheme.Values.viewBarButtonStyle
|
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 {
|
HelperWidgets.AbstractButton {
|
||||||
enabled: sourceImage.scale !== 1
|
enabled: sourceImage.scale !== 1
|
||||||
style: StudioTheme.Values.viewBarButtonStyle
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
|
@@ -17,30 +17,40 @@ Rectangle {
|
|||||||
|
|
||||||
signal addClicked
|
signal addClicked
|
||||||
signal saveClicked
|
signal saveClicked
|
||||||
|
signal saveAsClicked
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
Row {
|
||||||
id: addButton
|
spacing: 5
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
x: 5
|
|
||||||
style: StudioTheme.Values.viewBarButtonStyle
|
|
||||||
buttonIcon: StudioTheme.Constants.add_medium
|
|
||||||
tooltip: qsTr("Add new composition")
|
|
||||||
|
|
||||||
onClicked: root.addClicked()
|
HelperWidgets.AbstractButton {
|
||||||
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
|
buttonIcon: StudioTheme.Constants.add_medium
|
||||||
|
tooltip: qsTr("Add new composition")
|
||||||
|
|
||||||
|
onClicked: root.addClicked()
|
||||||
|
}
|
||||||
|
|
||||||
|
HelperWidgets.AbstractButton {
|
||||||
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
|
buttonIcon: StudioTheme.Constants.save_medium
|
||||||
|
tooltip: qsTr("Save current composition")
|
||||||
|
enabled: EffectMakerBackend.effectMakerModel.hasUnsavedChanges
|
||||||
|
|| EffectMakerBackend.effectMakerModel.currentComposition === ""
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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")
|
|
||||||
enabled: EffectMakerBackend.effectMakerModel.hasUnsavedChanges
|
|
||||||
|| EffectMakerBackend.effectMakerModel.currentComposition === ""
|
|
||||||
|
|
||||||
onClicked: root.saveClicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
readonly property string compName: EffectMakerBackend.effectMakerModel.currentComposition
|
readonly property string compName: EffectMakerBackend.effectMakerModel.currentComposition
|
||||||
|
@@ -21,10 +21,10 @@ StudioControls.Dialog {
|
|||||||
property bool clearOnClose: false // clear the effect maker after saving
|
property bool clearOnClose: false // clear the effect maker after saving
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
let model = EffectMakerBackend.effectMakerModel
|
nameText.text = EffectMakerBackend.effectMakerModel.getUniqueEffectName()
|
||||||
nameText.text = model.currentComposition === "" ? model.getUniqueEffectName() : model.currentComposition
|
nameText.selectAll()
|
||||||
emptyText.text = ""
|
|
||||||
nameText.forceActiveFocus()
|
nameText.forceActiveFocus()
|
||||||
|
emptyText.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
|
Reference in New Issue
Block a user