mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +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
|
@ -19,6 +19,7 @@ Page {
|
|||
|
||||
property alias computingAtExitDialog: computingAtExitDialog
|
||||
property alias unsavedDialog: unsavedDialog
|
||||
property alias workspaceView: workspaceView
|
||||
|
||||
Settings {
|
||||
id: settingsUILayout
|
||||
|
@ -30,30 +31,6 @@ Page {
|
|||
}
|
||||
|
||||
// Utility functions for elements in the menubar
|
||||
function initFileDialogFolder(dialog, importImages = false) {
|
||||
let folder = "";
|
||||
|
||||
if (imagesFolder.toString() === "" && workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
|
||||
imagesFolder = Filepath.stringToUrl(Filepath.dirname(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 && imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
|
||||
folder = imagesFolder
|
||||
}
|
||||
|
||||
dialog.folder = folder
|
||||
}
|
||||
|
||||
function getSelectedNodesName() {
|
||||
if (!_reconstruction)
|
||||
return ""
|
||||
|
@ -117,18 +94,6 @@ Page {
|
|||
onRejected: closed(Platform.Dialog.Rejected)
|
||||
}
|
||||
|
||||
Platform.FileDialog {
|
||||
id: openFileDialog
|
||||
options: Platform.FileDialog.DontUseNativeDialog
|
||||
title: "Open File"
|
||||
nameFilters: ["Meshroom Graphs (*.mg)"]
|
||||
onAccepted: {
|
||||
if (_reconstruction.loadUrl(currentFile)) {
|
||||
MeshroomApp.addRecentProjectFile(currentFile.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Platform.FileDialog {
|
||||
id: loadTemplateDialog
|
||||
options: Platform.FileDialog.DontUseNativeDialog
|
||||
|
@ -573,13 +538,17 @@ Page {
|
|||
border.color: Qt.darker(activePalette.window, 1.15)
|
||||
}
|
||||
|
||||
onClicked: ensureSaved(function() {
|
||||
_reconstruction.clear()
|
||||
if (mainStack.depth == 1)
|
||||
mainStack.replace("Homepage.qml")
|
||||
else
|
||||
mainStack.pop()
|
||||
})
|
||||
onClicked: {
|
||||
if (!ensureNotComputing())
|
||||
return
|
||||
ensureSaved(function() {
|
||||
_reconstruction.clear()
|
||||
if (mainStack.depth == 1)
|
||||
mainStack.replace("Homepage.qml")
|
||||
else
|
||||
mainStack.pop()
|
||||
})
|
||||
}
|
||||
}
|
||||
MenuBar {
|
||||
palette.window: Qt.darker(activePalette.window, 1.15)
|
||||
|
@ -887,7 +856,7 @@ Page {
|
|||
|
||||
text: !(_reconstruction.computingLocally) ? MaterialIcons.send : MaterialIcons.cancel_schedule_send
|
||||
|
||||
ToolTip.text: !(_reconstruction.computingLocally) ? "Start the computation" : "Stop the computation"
|
||||
ToolTip.text: !(_reconstruction.computingLocally) ? "Compute" : "Stop Computing"
|
||||
ToolTip.visible: hovered
|
||||
|
||||
background: Rectangle {
|
||||
|
@ -906,7 +875,7 @@ Page {
|
|||
visible: _reconstruction ? _reconstruction.canSubmit : false
|
||||
text: MaterialIcons.rocket_launch
|
||||
|
||||
ToolTip.text: "Submit"
|
||||
ToolTip.text: "Submit on Render Farm"
|
||||
ToolTip.visible: hovered
|
||||
|
||||
background: Rectangle {
|
||||
|
|
|
@ -26,7 +26,7 @@ Page {
|
|||
height: parent.height
|
||||
|
||||
Layout.minimumWidth: 200
|
||||
Layout.maximumWidth: 400
|
||||
Layout.maximumWidth: 300
|
||||
|
||||
AnimatedImage {
|
||||
id: logo
|
||||
|
@ -36,6 +36,7 @@ Page {
|
|||
fillMode: Image.PreserveAspectFit
|
||||
// Enforce aspect ratio of the component, as the fillMode does not do the job
|
||||
Layout.preferredHeight: width / ratio
|
||||
smooth: true
|
||||
|
||||
source: "../img/meshroom-anim-once.gif"
|
||||
}
|
||||
|
@ -198,7 +199,7 @@ Page {
|
|||
|
||||
TabPanel {
|
||||
id: tabPanel
|
||||
tabs: ["Pipelines", "Recent Projects"]
|
||||
tabs: ["Pipelines", "Projects"]
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
@ -241,11 +242,11 @@ Page {
|
|||
anchors.fill: parent
|
||||
anchors.topMargin: cellHeight * 0.1
|
||||
|
||||
cellWidth: 200
|
||||
cellWidth: 195
|
||||
cellHeight: cellWidth
|
||||
anchors.margins: 10
|
||||
|
||||
model: MeshroomApp.recentProjectFiles
|
||||
model: [{ "path": null, "thumbnail": null}].concat(MeshroomApp.recentProjectFiles)
|
||||
|
||||
// Update grid item when corresponding thumbnail is computed
|
||||
Connections {
|
||||
|
@ -286,11 +287,11 @@ Page {
|
|||
width: gridView.cellWidth * 0.9
|
||||
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: modelData["path"]
|
||||
ToolTip.text: modelData["path"] ? modelData["path"] : "Open browser to select a project file"
|
||||
|
||||
font.pointSize: 24
|
||||
|
||||
text: modelData["thumbnail"] ? "" : MaterialIcons.description
|
||||
text: modelData["path"] ? (modelData["thumbnail"] ? "" : MaterialIcons.description) : MaterialIcons.folder_open
|
||||
|
||||
Image {
|
||||
id: thumbnail
|
||||
|
@ -313,12 +314,17 @@ Page {
|
|||
Connections {
|
||||
target: projectDelegate
|
||||
function onClicked() {
|
||||
// Open project
|
||||
mainStack.push("Application.qml")
|
||||
if (_reconstruction.loadUrl(modelData["path"])) {
|
||||
MeshroomApp.addRecentProjectFile(modelData["path"])
|
||||
} else {
|
||||
MeshroomApp.removeRecentProjectFile(modelData["path"])
|
||||
if (!modelData["path"]){
|
||||
initFileDialogFolder(openFileDialog)
|
||||
openFileDialog.open()
|
||||
} else{
|
||||
// Open project
|
||||
mainStack.push("Application.qml")
|
||||
if (_reconstruction.loadUrl(modelData["path"])) {
|
||||
MeshroomApp.addRecentProjectFile(modelData["path"])
|
||||
} else {
|
||||
MeshroomApp.removeRecentProjectFile(modelData["path"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +335,7 @@ Page {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
width: projectDelegate.width
|
||||
elide: Text.ElideMiddle
|
||||
text: Filepath.basename(modelData["path"])
|
||||
text: modelData["path"] ? Filepath.basename(modelData["path"]) : "Open project"
|
||||
maximumLineCount: 1
|
||||
font.pointSize: 10
|
||||
}
|
||||
|
|
|
@ -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