Skip to content

Commit 9c33c57

Browse files
authored
Merge pull request #2525 from alicevision/dev/homepageOpenProject
[ui] Open project from browser in homepage & quick adjustments
2 parents cd3c5b5 + ac5b02d commit 9c33c57

File tree

7 files changed

+164
-58
lines changed

7 files changed

+164
-58
lines changed

meshroom/ui/img/logo_CTU.png

4.12 KB
Loading

meshroom/ui/img/logo_IRIT.png

2.3 KB
Loading

meshroom/ui/img/logo_enpc.png

2.66 KB
Loading

meshroom/ui/img/logo_uio.png

5.91 KB
Loading

meshroom/ui/qml/Application.qml

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Page {
1919

2020
property alias computingAtExitDialog: computingAtExitDialog
2121
property alias unsavedDialog: unsavedDialog
22+
property alias workspaceView: workspaceView
2223

2324
Settings {
2425
id: settingsUILayout
@@ -30,30 +31,6 @@ Page {
3031
}
3132

3233
// Utility functions for elements in the menubar
33-
function initFileDialogFolder(dialog, importImages = false) {
34-
let folder = "";
35-
36-
if (imagesFolder.toString() === "" && workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
37-
imagesFolder = Filepath.stringToUrl(Filepath.dirname(workspaceView.imageGallery.galleryGrid.itemAtIndex(0).source))
38-
}
39-
40-
if (_reconstruction.graph && _reconstruction.graph.filepath) {
41-
folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath))
42-
} else {
43-
var projects = MeshroomApp.recentProjectFiles
44-
45-
if (projects.length > 0 && Filepath.exists(projects[0]["path"])) {
46-
folder = Filepath.stringToUrl(Filepath.dirname(projects[0]["path"]))
47-
}
48-
}
49-
50-
if (importImages && imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
51-
folder = imagesFolder
52-
}
53-
54-
dialog.folder = folder
55-
}
56-
5734
function getSelectedNodesName() {
5835
if (!_reconstruction)
5936
return ""
@@ -117,18 +94,6 @@ Page {
11794
onRejected: closed(Platform.Dialog.Rejected)
11895
}
11996

120-
Platform.FileDialog {
121-
id: openFileDialog
122-
options: Platform.FileDialog.DontUseNativeDialog
123-
title: "Open File"
124-
nameFilters: ["Meshroom Graphs (*.mg)"]
125-
onAccepted: {
126-
if (_reconstruction.loadUrl(currentFile)) {
127-
MeshroomApp.addRecentProjectFile(currentFile.toString())
128-
}
129-
}
130-
}
131-
13297
Platform.FileDialog {
13398
id: loadTemplateDialog
13499
options: Platform.FileDialog.DontUseNativeDialog
@@ -573,13 +538,17 @@ Page {
573538
border.color: Qt.darker(activePalette.window, 1.15)
574539
}
575540

576-
onClicked: ensureSaved(function() {
577-
_reconstruction.clear()
578-
if (mainStack.depth == 1)
579-
mainStack.replace("Homepage.qml")
580-
else
581-
mainStack.pop()
582-
})
541+
onClicked: {
542+
if (!ensureNotComputing())
543+
return
544+
ensureSaved(function() {
545+
_reconstruction.clear()
546+
if (mainStack.depth == 1)
547+
mainStack.replace("Homepage.qml")
548+
else
549+
mainStack.pop()
550+
})
551+
}
583552
}
584553
MenuBar {
585554
palette.window: Qt.darker(activePalette.window, 1.15)
@@ -887,7 +856,7 @@ Page {
887856

888857
text: !(_reconstruction.computingLocally) ? MaterialIcons.send : MaterialIcons.cancel_schedule_send
889858

890-
ToolTip.text: !(_reconstruction.computingLocally) ? "Start the computation" : "Stop the computation"
859+
ToolTip.text: !(_reconstruction.computingLocally) ? "Compute" : "Stop Computing"
891860
ToolTip.visible: hovered
892861

893862
background: Rectangle {
@@ -906,7 +875,7 @@ Page {
906875
visible: _reconstruction ? _reconstruction.canSubmit : false
907876
text: MaterialIcons.rocket_launch
908877

909-
ToolTip.text: "Submit"
878+
ToolTip.text: "Submit on Render Farm"
910879
ToolTip.visible: hovered
911880

912881
background: Rectangle {

meshroom/ui/qml/Homepage.qml

Lines changed: 106 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Page {
2626
height: parent.height
2727

2828
Layout.minimumWidth: 200
29-
Layout.maximumWidth: 400
29+
Layout.maximumWidth: 300
3030

3131
AnimatedImage {
3232
id: logo
@@ -36,6 +36,7 @@ Page {
3636
fillMode: Image.PreserveAspectFit
3737
// Enforce aspect ratio of the component, as the fillMode does not do the job
3838
Layout.preferredHeight: width / ratio
39+
smooth: true
3940

4041
source: "../img/meshroom-anim-once.gif"
4142
}
@@ -122,6 +123,10 @@ Page {
122123
anchors.fill: parent
123124
cursorShape: Qt.PointingHandCursor
124125
onClicked: Qt.openUrlExternally("https://www.technicolor.com/")
126+
127+
hoverEnabled: true
128+
ToolTip.visible: containsMouse
129+
ToolTip.text: "Technicolor Group"
125130
}
126131
}
127132

@@ -140,6 +145,10 @@ Page {
140145
anchors.fill: parent
141146
cursorShape: Qt.PointingHandCursor
142147
onClicked: Qt.openUrlExternally("https://www.mpcvfx.com/")
148+
149+
hoverEnabled: true
150+
ToolTip.visible: containsMouse
151+
ToolTip.text: "MPC - Moving Picture Company"
143152
}
144153
}
145154

@@ -150,6 +159,10 @@ Page {
150159
anchors.fill: parent
151160
cursorShape: Qt.PointingHandCursor
152161
onClicked: Qt.openUrlExternally("https://www.themill.com/")
162+
163+
hoverEnabled: true
164+
ToolTip.visible: containsMouse
165+
ToolTip.text: "The Mill"
153166
}
154167
}
155168

@@ -160,6 +173,10 @@ Page {
160173
anchors.fill: parent
161174
cursorShape: Qt.PointingHandCursor
162175
onClicked: Qt.openUrlExternally("https://www.mikrosanimation.com/")
176+
177+
hoverEnabled: true
178+
ToolTip.visible: containsMouse
179+
ToolTip.text: "Mikros Animation"
163180
}
164181
}
165182

@@ -170,6 +187,77 @@ Page {
170187
anchors.fill: parent
171188
cursorShape: Qt.PointingHandCursor
172189
onClicked: Qt.openUrlExternally("https://www.technicolorgames.com/")
190+
191+
hoverEnabled: true
192+
ToolTip.visible: containsMouse
193+
ToolTip.text: "Technicolor Games"
194+
}
195+
}
196+
}
197+
198+
RowLayout {
199+
id: academicRow
200+
201+
Layout.fillWidth: true
202+
Layout.leftMargin: leftColumn.width * 0.05
203+
Layout.rightMargin: leftColumn.width * 0.05
204+
Layout.alignment: Qt.AlignHCenter
205+
206+
spacing: 30
207+
208+
Image {
209+
source: "../img/logo_IRIT.png"
210+
211+
MouseArea {
212+
anchors.fill: parent
213+
cursorShape: Qt.PointingHandCursor
214+
onClicked: Qt.openUrlExternally("https://www.irit.fr/en/departement/dep-hpc-simulation-optimization/reva-team")
215+
216+
hoverEnabled: true
217+
ToolTip.visible: containsMouse
218+
ToolTip.text: "IRIT - Institut de Recherche en Informatique de Toulouse"
219+
}
220+
}
221+
222+
Image {
223+
source: "../img/logo_CTU.png"
224+
225+
MouseArea {
226+
anchors.fill: parent
227+
cursorShape: Qt.PointingHandCursor
228+
onClicked: Qt.openUrlExternally("http://aag.ciirc.cvut.cz")
229+
230+
hoverEnabled: true
231+
ToolTip.visible: containsMouse
232+
ToolTip.text: "CTU - Czech Technical University in Prague"
233+
}
234+
}
235+
236+
Image {
237+
source: "../img/logo_uio.png"
238+
239+
MouseArea {
240+
anchors.fill: parent
241+
cursorShape: Qt.PointingHandCursor
242+
onClicked: Qt.openUrlExternally("https://www.mn.uio.no/ifi/english/about/organisation/dis")
243+
244+
hoverEnabled: true
245+
ToolTip.visible: containsMouse
246+
ToolTip.text: "UiO - University of Oslo"
247+
}
248+
}
249+
250+
Image {
251+
source: "../img/logo_enpc.png"
252+
253+
MouseArea {
254+
anchors.fill: parent
255+
cursorShape: Qt.PointingHandCursor
256+
onClicked: Qt.openUrlExternally("https://imagine-lab.enpc.fr")
257+
258+
hoverEnabled: true
259+
ToolTip.visible: containsMouse
260+
ToolTip.text: "ENPC - Ecole des Ponts ParisTech"
173261
}
174262
}
175263
}
@@ -198,7 +286,7 @@ Page {
198286

199287
TabPanel {
200288
id: tabPanel
201-
tabs: ["Pipelines", "Recent Projects"]
289+
tabs: ["Pipelines", "Projects"]
202290

203291
Layout.fillWidth: true
204292
Layout.fillHeight: true
@@ -241,11 +329,11 @@ Page {
241329
anchors.fill: parent
242330
anchors.topMargin: cellHeight * 0.1
243331

244-
cellWidth: 200
332+
cellWidth: 195
245333
cellHeight: cellWidth
246334
anchors.margins: 10
247335

248-
model: MeshroomApp.recentProjectFiles
336+
model: [{ "path": null, "thumbnail": null}].concat(MeshroomApp.recentProjectFiles)
249337

250338
// Update grid item when corresponding thumbnail is computed
251339
Connections {
@@ -286,11 +374,11 @@ Page {
286374
width: gridView.cellWidth * 0.9
287375

288376
ToolTip.visible: hovered
289-
ToolTip.text: modelData["path"]
377+
ToolTip.text: modelData["path"] ? modelData["path"] : "Open browser to select a project file"
290378

291379
font.pointSize: 24
292380

293-
text: modelData["thumbnail"] ? "" : MaterialIcons.description
381+
text: modelData["path"] ? (modelData["thumbnail"] ? "" : MaterialIcons.description) : MaterialIcons.folder_open
294382

295383
Image {
296384
id: thumbnail
@@ -313,12 +401,17 @@ Page {
313401
Connections {
314402
target: projectDelegate
315403
function onClicked() {
316-
// Open project
317-
mainStack.push("Application.qml")
318-
if (_reconstruction.loadUrl(modelData["path"])) {
319-
MeshroomApp.addRecentProjectFile(modelData["path"])
320-
} else {
321-
MeshroomApp.removeRecentProjectFile(modelData["path"])
404+
if (!modelData["path"]){
405+
initFileDialogFolder(openFileDialog)
406+
openFileDialog.open()
407+
} else{
408+
// Open project
409+
mainStack.push("Application.qml")
410+
if (_reconstruction.loadUrl(modelData["path"])) {
411+
MeshroomApp.addRecentProjectFile(modelData["path"])
412+
} else {
413+
MeshroomApp.removeRecentProjectFile(modelData["path"])
414+
}
322415
}
323416
}
324417
}
@@ -329,7 +422,7 @@ Page {
329422
horizontalAlignment: Text.AlignHCenter
330423
width: projectDelegate.width
331424
elide: Text.ElideMiddle
332-
text: Filepath.basename(modelData["path"])
425+
text: modelData["path"] ? Filepath.basename(modelData["path"]) : "Open project"
333426
maximumLineCount: 1
334427
font.pointSize: 10
335428
}

meshroom/ui/qml/main.qml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import QtQuick.Controls 2.15
33
import QtQuick.Window 2.15
44
import QtQuick.Dialogs 1.3
55

6+
import Qt.labs.platform 1.0 as Platform
67
import Qt.labs.settings 1.0
78

89
ApplicationWindow {
@@ -77,6 +78,49 @@ ApplicationWindow {
7778
settingsGeneral.windowHeight = _window.height
7879
}
7980

81+
function initFileDialogFolder(dialog, importImages = false) {
82+
let folder = "";
83+
84+
if (mainStack.currentItem instanceof Homepage) {
85+
folder = Filepath.stringToUrl(Filepath.dirname(MeshroomApp.recentProjectFiles[0]["path"]))
86+
} else {
87+
if (mainStack.currentItem.imagesFolder.toString() === "" && mainStack.currentItem.workspaceView.imageGallery.galleryGrid.itemAtIndex(0) !== null) {
88+
imagesFolder = Filepath.stringToUrl(Filepath.dirname(mainStack.currentItem.workspaceView.imageGallery.galleryGrid.itemAtIndex(0).source))
89+
}
90+
91+
if (_reconstruction.graph && _reconstruction.graph.filepath) {
92+
folder = Filepath.stringToUrl(Filepath.dirname(_reconstruction.graph.filepath))
93+
} else {
94+
var projects = MeshroomApp.recentProjectFiles
95+
96+
if (projects.length > 0 && Filepath.exists(projects[0]["path"])) {
97+
folder = Filepath.stringToUrl(Filepath.dirname(projects[0]["path"]))
98+
}
99+
}
100+
101+
if (importImages && mainStack.currentItem.imagesFolder.toString() !== "" && Filepath.exists(imagesFolder)) {
102+
folder = mainStack.currentItem.imagesFolder
103+
}
104+
}
105+
106+
dialog.folder = folder
107+
}
108+
109+
Platform.FileDialog {
110+
id: openFileDialog
111+
options: Platform.FileDialog.DontUseNativeDialog
112+
title: "Open File"
113+
nameFilters: ["Meshroom Graphs (*.mg)"]
114+
onAccepted: {
115+
if (_reconstruction.loadUrl(currentFile)) {
116+
MeshroomApp.addRecentProjectFile(currentFile.toString())
117+
}
118+
if (mainStack.currentItem instanceof Homepage) {
119+
mainStack.push("Application.qml")
120+
}
121+
}
122+
}
123+
80124
// Check if document has been saved
81125
function ensureSaved(callback)
82126
{

0 commit comments

Comments
 (0)