mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[ui] Save folder location of the last imported images
This commit changes the folder in which the "Import Images" dialog opens: it used to be opened in the folder in which the last .mg file had been opened, and it now opens in the folder from which the last images were imported. The location of the last imported images is saved, and used specifically when opening the "Import Images" dialog, as opposed to all the other dialogs which open in the folder of the last opened .mg file.
This commit is contained in:
parent
27ce3df5cb
commit
2dc0a678a1
1 changed files with 15 additions and 5 deletions
|
@ -46,6 +46,8 @@ ApplicationWindow {
|
|||
SystemPalette { id: activePalette }
|
||||
SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled }
|
||||
|
||||
property url imagesFolder: ""
|
||||
|
||||
Settings {
|
||||
id: settings_General
|
||||
category: 'General'
|
||||
|
@ -328,6 +330,7 @@ ApplicationWindow {
|
|||
nameFilters: []
|
||||
onAccepted: {
|
||||
_reconstruction.importImagesUrls(importImagesDialog.fileUrls)
|
||||
imagesFolder = Filepath.dirname(importImagesDialog.fileUrls[0])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,15 +478,22 @@ ApplicationWindow {
|
|||
|
||||
// Utility functions for elements in the menubar
|
||||
|
||||
function initFileDialogFolder(dialog) {
|
||||
if(_reconstruction.graph && _reconstruction.graph.filepath) {
|
||||
dialog.folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath));
|
||||
function initFileDialogFolder(dialog, importImages = false) {
|
||||
let folder = "";
|
||||
if (_reconstruction.graph && _reconstruction.graph.filepath) {
|
||||
folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath));
|
||||
} else {
|
||||
var projects = MeshroomApp.recentProjectFiles;
|
||||
if (projects.length > 0 && Filepath.exists(projects[0])) {
|
||||
dialog.folder = Filepath.stringToUrl(Filepath.dirname(projects[0]));
|
||||
folder = Filepath.stringToUrl(Filepath.dirname(projects[0]));
|
||||
}
|
||||
}
|
||||
|
||||
if (importImages && imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
|
||||
folder = imagesFolder;
|
||||
}
|
||||
|
||||
dialog.folder = folder;
|
||||
}
|
||||
|
||||
header: MenuBar {
|
||||
|
@ -606,7 +616,7 @@ ApplicationWindow {
|
|||
text: "Import Images"
|
||||
shortcut: "Ctrl+I"
|
||||
onTriggered: {
|
||||
initFileDialogFolder(importImagesDialog);
|
||||
initFileDialogFolder(importImagesDialog, true);
|
||||
importImagesDialog.open();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue