[ui] "Import Images" dialog: Use opened project's images folder as the base folder

If a project has already been opened before the "Import Images" dialog
is opened for the first time, and if the opened project has imported
images, use the location of these images' folder as the base folder for
the "Import Images" dialog.

If the opened project has no imported images, the base folder will remain
identical to the other dialogs' until images are imported.
This commit is contained in:
Candice Bentéjac 2023-01-10 13:05:22 +01:00
parent 2dc0a678a1
commit 5638cf3a75
3 changed files with 5 additions and 0 deletions

View file

@ -23,6 +23,7 @@ Panel {
readonly property string currentItemSource: grid.currentItem ? grid.currentItem.source : "" readonly property string currentItemSource: grid.currentItem ? grid.currentItem.source : ""
readonly property var currentItemMetadata: grid.currentItem ? grid.currentItem.metadata : undefined readonly property var currentItemMetadata: grid.currentItem ? grid.currentItem.metadata : undefined
readonly property int centerViewId: (_reconstruction && _reconstruction.sfmTransform) ? parseInt(_reconstruction.sfmTransform.attribute("transformation").value) : 0 readonly property int centerViewId: (_reconstruction && _reconstruction.sfmTransform) ? parseInt(_reconstruction.sfmTransform.attribute("transformation").value) : 0
readonly property alias galleryGrid: grid
property int defaultCellSize: 160 property int defaultCellSize: 160
property bool readOnly: false property bool readOnly: false

View file

@ -24,6 +24,7 @@ Item {
property bool readOnly: false property bool readOnly: false
property alias panel3dViewer: panel3dViewerLoader.item property alias panel3dViewer: panel3dViewerLoader.item
readonly property Viewer2D viewer2D: viewer2D readonly property Viewer2D viewer2D: viewer2D
readonly property alias imageGallery: imageGallery
implicitWidth: 300 implicitWidth: 300
implicitHeight: 400 implicitHeight: 400

View file

@ -482,6 +482,9 @@ ApplicationWindow {
let folder = ""; let folder = "";
if (_reconstruction.graph && _reconstruction.graph.filepath) { if (_reconstruction.graph && _reconstruction.graph.filepath) {
folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath)); folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath));
if (imagesFolder.toString() === "" && workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
imagesFolder = Filepath.dirname(workspaceView.imageGallery.galleryGrid.itemAtIndex(0).source);
}
} else { } else {
var projects = MeshroomApp.recentProjectFiles; var projects = MeshroomApp.recentProjectFiles;
if (projects.length > 0 && Filepath.exists(projects[0])) { if (projects.length > 0 && Filepath.exists(projects[0])) {