[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.
This commit is contained in:
Candice Bentéjac 2022-12-22 19:44:57 +01:00
parent 9ac21d5423
commit eb4ec8318c

96
meshroom/ui/qml/main.qml Executable file → Normal file
View file

@ -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: importProjectAction
text: "Import Project"
shortcut: "Ctrl+Shift+I"
id: saveAction
text: "Save"
shortcut: "Ctrl+S"
enabled: _reconstruction ? (_reconstruction.graph && !_reconstruction.graph.filepath) || !_reconstruction.undoStack.clean : false
onTriggered: {
initFileDialogFolder(importProjectDialog);
importProjectDialog.open();
if(_reconstruction.graph.filepath) {
_reconstruction.save();
}
else
{
initFileDialogFolder(saveFileDialog);
saveFileDialog.open();
}
}
}
Action {
id: saveAsAction
text: "Save As..."
shortcut: "Ctrl+Shift+S"
onTriggered: {
initFileDialogFolder(saveFileDialog);
saveFileDialog.open();
}
}
MenuSeparator { }
Action {
id: importImagesAction
text: "Import Images"
@ -613,39 +633,37 @@ ApplicationWindow {
}
}
}
MenuSeparator { }
Menu {
id: advancedMenu
title: "Advanced"
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()
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 { }