Skip to content

Commit

Permalink
Merge pull request #1856 from alicevision/dev/reorgFileMenu
Browse files Browse the repository at this point in the history
[ui] Reorganize the "File" menu
  • Loading branch information
fabiencastan authored Dec 22, 2022
2 parents 9ac21d5 + eb4ec83 commit bd792bf
Showing 1 changed file with 58 additions and 40 deletions.
98 changes: 58 additions & 40 deletions meshroom/ui/qml/main.qml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 { }
Expand Down

0 comments on commit bd792bf

Please sign in to comment.