mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +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 computingAtExitDialog: computingAtExitDialog
|
||||||
property alias unsavedDialog: unsavedDialog
|
property alias unsavedDialog: unsavedDialog
|
||||||
|
property alias workspaceView: workspaceView
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
id: settingsUILayout
|
id: settingsUILayout
|
||||||
|
@ -30,30 +31,6 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility functions for elements in the menubar
|
// 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() {
|
function getSelectedNodesName() {
|
||||||
if (!_reconstruction)
|
if (!_reconstruction)
|
||||||
return ""
|
return ""
|
||||||
|
@ -117,18 +94,6 @@ Page {
|
||||||
onRejected: closed(Platform.Dialog.Rejected)
|
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 {
|
Platform.FileDialog {
|
||||||
id: loadTemplateDialog
|
id: loadTemplateDialog
|
||||||
options: Platform.FileDialog.DontUseNativeDialog
|
options: Platform.FileDialog.DontUseNativeDialog
|
||||||
|
@ -573,7 +538,10 @@ Page {
|
||||||
border.color: Qt.darker(activePalette.window, 1.15)
|
border.color: Qt.darker(activePalette.window, 1.15)
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: ensureSaved(function() {
|
onClicked: {
|
||||||
|
if (!ensureNotComputing())
|
||||||
|
return
|
||||||
|
ensureSaved(function() {
|
||||||
_reconstruction.clear()
|
_reconstruction.clear()
|
||||||
if (mainStack.depth == 1)
|
if (mainStack.depth == 1)
|
||||||
mainStack.replace("Homepage.qml")
|
mainStack.replace("Homepage.qml")
|
||||||
|
@ -581,6 +549,7 @@ Page {
|
||||||
mainStack.pop()
|
mainStack.pop()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
MenuBar {
|
MenuBar {
|
||||||
palette.window: Qt.darker(activePalette.window, 1.15)
|
palette.window: Qt.darker(activePalette.window, 1.15)
|
||||||
Menu {
|
Menu {
|
||||||
|
@ -887,7 +856,7 @@ Page {
|
||||||
|
|
||||||
text: !(_reconstruction.computingLocally) ? MaterialIcons.send : MaterialIcons.cancel_schedule_send
|
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
|
ToolTip.visible: hovered
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
@ -906,7 +875,7 @@ Page {
|
||||||
visible: _reconstruction ? _reconstruction.canSubmit : false
|
visible: _reconstruction ? _reconstruction.canSubmit : false
|
||||||
text: MaterialIcons.rocket_launch
|
text: MaterialIcons.rocket_launch
|
||||||
|
|
||||||
ToolTip.text: "Submit"
|
ToolTip.text: "Submit on Render Farm"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
@ -26,7 +26,7 @@ Page {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
Layout.minimumWidth: 200
|
Layout.minimumWidth: 200
|
||||||
Layout.maximumWidth: 400
|
Layout.maximumWidth: 300
|
||||||
|
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
id: logo
|
id: logo
|
||||||
|
@ -36,6 +36,7 @@ Page {
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
// Enforce aspect ratio of the component, as the fillMode does not do the job
|
// Enforce aspect ratio of the component, as the fillMode does not do the job
|
||||||
Layout.preferredHeight: width / ratio
|
Layout.preferredHeight: width / ratio
|
||||||
|
smooth: true
|
||||||
|
|
||||||
source: "../img/meshroom-anim-once.gif"
|
source: "../img/meshroom-anim-once.gif"
|
||||||
}
|
}
|
||||||
|
@ -198,7 +199,7 @@ Page {
|
||||||
|
|
||||||
TabPanel {
|
TabPanel {
|
||||||
id: tabPanel
|
id: tabPanel
|
||||||
tabs: ["Pipelines", "Recent Projects"]
|
tabs: ["Pipelines", "Projects"]
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
@ -241,11 +242,11 @@ Page {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: cellHeight * 0.1
|
anchors.topMargin: cellHeight * 0.1
|
||||||
|
|
||||||
cellWidth: 200
|
cellWidth: 195
|
||||||
cellHeight: cellWidth
|
cellHeight: cellWidth
|
||||||
anchors.margins: 10
|
anchors.margins: 10
|
||||||
|
|
||||||
model: MeshroomApp.recentProjectFiles
|
model: [{ "path": null, "thumbnail": null}].concat(MeshroomApp.recentProjectFiles)
|
||||||
|
|
||||||
// Update grid item when corresponding thumbnail is computed
|
// Update grid item when corresponding thumbnail is computed
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -286,11 +287,11 @@ Page {
|
||||||
width: gridView.cellWidth * 0.9
|
width: gridView.cellWidth * 0.9
|
||||||
|
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: modelData["path"]
|
ToolTip.text: modelData["path"] ? modelData["path"] : "Open browser to select a project file"
|
||||||
|
|
||||||
font.pointSize: 24
|
font.pointSize: 24
|
||||||
|
|
||||||
text: modelData["thumbnail"] ? "" : MaterialIcons.description
|
text: modelData["path"] ? (modelData["thumbnail"] ? "" : MaterialIcons.description) : MaterialIcons.folder_open
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: thumbnail
|
id: thumbnail
|
||||||
|
@ -313,6 +314,10 @@ Page {
|
||||||
Connections {
|
Connections {
|
||||||
target: projectDelegate
|
target: projectDelegate
|
||||||
function onClicked() {
|
function onClicked() {
|
||||||
|
if (!modelData["path"]){
|
||||||
|
initFileDialogFolder(openFileDialog)
|
||||||
|
openFileDialog.open()
|
||||||
|
} else{
|
||||||
// Open project
|
// Open project
|
||||||
mainStack.push("Application.qml")
|
mainStack.push("Application.qml")
|
||||||
if (_reconstruction.loadUrl(modelData["path"])) {
|
if (_reconstruction.loadUrl(modelData["path"])) {
|
||||||
|
@ -323,13 +328,14 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Label {
|
Label {
|
||||||
id: project
|
id: project
|
||||||
anchors.horizontalCenter: projectDelegate.horizontalCenter
|
anchors.horizontalCenter: projectDelegate.horizontalCenter
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
width: projectDelegate.width
|
width: projectDelegate.width
|
||||||
elide: Text.ElideMiddle
|
elide: Text.ElideMiddle
|
||||||
text: Filepath.basename(modelData["path"])
|
text: modelData["path"] ? Filepath.basename(modelData["path"]) : "Open project"
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
font.pointSize: 10
|
font.pointSize: 10
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import QtQuick.Controls 2.15
|
||||||
import QtQuick.Window 2.15
|
import QtQuick.Window 2.15
|
||||||
import QtQuick.Dialogs 1.3
|
import QtQuick.Dialogs 1.3
|
||||||
|
|
||||||
|
import Qt.labs.platform 1.0 as Platform
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
@ -77,6 +78,49 @@ ApplicationWindow {
|
||||||
settingsGeneral.windowHeight = _window.height
|
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
|
// Check if document has been saved
|
||||||
function ensureSaved(callback)
|
function ensureSaved(callback)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue