mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 00:38:41 +02:00
[ui] Open project from browser in homepage & quick adjustments
Modification of tooltips, ensure computing is false before going back to homepage...
This commit is contained in:
parent
4502e98a4c
commit
f78efe69fb
3 changed files with 77 additions and 58 deletions
|
@ -3,6 +3,7 @@ import QtQuick.Controls 2.15
|
|||
import QtQuick.Window 2.15
|
||||
import QtQuick.Dialogs 1.3
|
||||
|
||||
import Qt.labs.platform 1.0 as Platform
|
||||
import Qt.labs.settings 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
|
@ -77,6 +78,49 @@ ApplicationWindow {
|
|||
settingsGeneral.windowHeight = _window.height
|
||||
}
|
||||
|
||||
function initFileDialogFolder(dialog, importImages = false) {
|
||||
let folder = "";
|
||||
|
||||
if (mainStack.currentItem instanceof Homepage) {
|
||||
folder = Filepath.stringToUrl(Filepath.dirname(MeshroomApp.recentProjectFiles[0]["path"]))
|
||||
} else {
|
||||
if (mainStack.currentItem.imagesFolder.toString() === "" && mainStack.currentItem.workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
|
||||
imagesFolder = Filepath.stringToUrl(Filepath.dirname(mainStack.currentItem.workspaceView.imageGallery.galleryGrid.itemAtIndex(0).source))
|
||||
}
|
||||
|
||||
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]["path"])) {
|
||||
folder = Filepath.stringToUrl(Filepath.dirname(projects[0]["path"]))
|
||||
}
|
||||
}
|
||||
|
||||
if (importImages && mainStack.currentItem.imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
|
||||
folder = mainStack.currentItem.imagesFolder
|
||||
}
|
||||
}
|
||||
|
||||
dialog.folder = folder
|
||||
}
|
||||
|
||||
Platform.FileDialog {
|
||||
id: openFileDialog
|
||||
options: Platform.FileDialog.DontUseNativeDialog
|
||||
title: "Open File"
|
||||
nameFilters: ["Meshroom Graphs (*.mg)"]
|
||||
onAccepted: {
|
||||
if (_reconstruction.loadUrl(currentFile)) {
|
||||
MeshroomApp.addRecentProjectFile(currentFile.toString())
|
||||
}
|
||||
if (mainStack.currentItem instanceof Homepage) {
|
||||
mainStack.push("Application.qml")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if document has been saved
|
||||
function ensureSaved(callback)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue