From eb4ec8318cf384dd8321555527e456ddf23a705e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Thu, 22 Dec 2022 19:44:57 +0100 Subject: [PATCH] [ui] Reorganize the "File" menu - Remove the "New" menu; the "Ctrl+N" shortcut remains valid to create new default pipelines - Move the "Save As Template" and "Import Project" actions into an "Advanced" menu; their behaviour and shortcuts remain unchanged - Add menu separators between the "Open" and "Save" functionalities, the "Save" and "Import Images" functionalities, the "Import Images" and "Advanced" functionalities, and the "Advanced" and "Quit" functionalities. --- meshroom/ui/qml/main.qml | 98 ++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 40 deletions(-) mode change 100755 => 100644 meshroom/ui/qml/main.qml diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml old mode 100755 new mode 100644 index 0c9f26d7e4..d05d45b08e --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -68,6 +68,13 @@ ApplicationWindow { settings_General.windowHeight = _window.height } + Shortcut { + // Ensures the Ctrl+N shortcut is always valid and creates a default pipeline + sequence: "Ctrl+N" + context: Qt.ApplicationShortcut + onActivated: ensureSaved(function() { _reconstruction.new() }) + } + MessageDialog { id: unsavedDialog @@ -483,11 +490,6 @@ ApplicationWindow { palette.window: Qt.darker(activePalette.window, 1.15) Menu { title: "File" - Action { - text: "New" - shortcut: "Ctrl+N" - onTriggered: ensureSaved(function() { _reconstruction.new() }) - } Menu { id: newPipelineMenu title: "New Pipeline" @@ -572,15 +574,33 @@ ApplicationWindow { } } } + MenuSeparator { } + Action { + id: saveAction + text: "Save" + shortcut: "Ctrl+S" + enabled: _reconstruction ? (_reconstruction.graph && !_reconstruction.graph.filepath) || !_reconstruction.undoStack.clean : false + onTriggered: { + if(_reconstruction.graph.filepath) { + _reconstruction.save(); + } + else + { + initFileDialogFolder(saveFileDialog); + saveFileDialog.open(); + } + } + } Action { - id: importProjectAction - text: "Import Project" - shortcut: "Ctrl+Shift+I" + id: saveAsAction + text: "Save As..." + shortcut: "Ctrl+Shift+S" onTriggered: { - initFileDialogFolder(importProjectDialog); - importProjectDialog.open(); + initFileDialogFolder(saveFileDialog); + saveFileDialog.open(); } } + MenuSeparator { } Action { id: importImagesAction text: "Import Images" @@ -613,39 +633,37 @@ ApplicationWindow { } } } - - Action { - id: saveAction - text: "Save" - shortcut: "Ctrl+S" - enabled: _reconstruction ? (_reconstruction.graph && !_reconstruction.graph.filepath) || !_reconstruction.undoStack.clean : false - onTriggered: { - if(_reconstruction.graph.filepath) { - _reconstruction.save() + MenuSeparator { } + Menu { + id: advancedMenu + title: "Advanced" + + Action { + id: saveAsTemplateAction + text: "Save As Template..." + shortcut: Shortcut { + sequence: "Ctrl+Shift+T" + context: Qt.ApplicationShortcut + onActivated: saveAsTemplateAction.triggered() } - else - { - initFileDialogFolder(saveFileDialog); - saveFileDialog.open(); + onTriggered: { + initFileDialogFolder(saveTemplateDialog); + saveTemplateDialog.open(); } } - } - Action { - id: saveAsAction - text: "Save As..." - shortcut: "Ctrl+Shift+S" - onTriggered: { - initFileDialogFolder(saveFileDialog); - saveFileDialog.open(); - } - } - Action { - id: saveAsTemplateAction - text: "Save As Template..." - shortcut: "Ctrl+Shift+T" - onTriggered: { - initFileDialogFolder(saveTemplateDialog); - saveTemplateDialog.open(); + + Action { + id: importProjectAction + text: "Import Project" + shortcut: Shortcut { + sequence: "Ctrl+Shift+I" + context: Qt.ApplicationShortcut + onActivated: importProjectAction.triggered() + } + onTriggered: { + initFileDialogFolder(importProjectDialog); + importProjectDialog.open(); + } } } MenuSeparator { }