Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Prompt a warning dialog when attempting to submit an unsaved project #1927

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,17 @@ ApplicationWindow {
}

function submit(node) {
try {
_reconstruction.submit(node)
}
catch (error) {
const data = ErrorHandler.analyseError(error)
if(data.context === "SUBMITTING")
computeSubmitErrorDialog.openError(data.type, data.msg, node)
if (!canSubmit) {
unsavedSubmitDialog.open()
} else {
try {
_reconstruction.submit(node)
}
catch (error) {
const data = ErrorHandler.analyseError(error)
if(data.context === "SUBMITTING")
computeSubmitErrorDialog.openError(data.type, data.msg, node)
}
}
}

Expand Down Expand Up @@ -319,6 +323,22 @@ ApplicationWindow {
onDiscarded: { close(); computeManager.compute(currentNode, true) }
onAccepted: saveAsAction.trigger()
}

MessageDialog {
id: unsavedSubmitDialog

canCopy: false
icon.text: MaterialIcons.warning
parent: Overlay.overlay
preset: "Warning"
title: "Unsaved Project"
text: "The project cannot be submitted if it remains unsaved."
helperText: "Save the project to be able to submit it?"
standardButtons: Dialog.Cancel | Dialog.Save

onDiscarded: close()
onAccepted: saveAsAction.trigger()
}
}

FileDialog {
Expand Down