From 16dfe960c625e116693e325ccf242127a6bfc95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 9 Mar 2023 18:24:38 +0100 Subject: [PATCH] [ui] Open a warning dialog when attempting to submit an unsaved project A project needs to be saved in order to be submitted to the renderfarm. Prior to this commit, attempting to submit an unsaved project would not prompt any dialog in the UI despite the exception that was thrown on the Python side. A warning dialog is now opened to let the user know that the project cannot be submitted until it is saved. --- meshroom/ui/qml/main.qml | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index 664243fce2..2e856fb848 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -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) + } } } @@ -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 {