Skip to content

Commit 37264bc

Browse files
authored
Merge pull request #2724 from alicevision/feature/project-remove
[ui] Homepage: Project can be removed with right click
2 parents 702e78f + d5bcada commit 37264bc

1 file changed

Lines changed: 58 additions & 17 deletions

File tree

meshroom/ui/qml/Homepage.qml

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,64 @@ Page {
361361
font.pointSize: 24
362362

363363
text: modelData["path"] ? (modelData["thumbnail"] ? "" : MaterialIcons.description) : MaterialIcons.folder_open
364+
365+
MouseArea {
366+
anchors.fill: parent
367+
acceptedButtons: Qt.LeftButton | Qt.RightButton
368+
hoverEnabled: true
369+
370+
onClicked: function(mouse) {
371+
372+
if (mouse.button === Qt.RightButton) {
373+
374+
if (!modelData["path"]) { return }
375+
376+
projectContextMenu.x = mouse.x
377+
projectContextMenu.y = mouse.y
378+
projectContextMenu.open()
379+
return
380+
381+
}
382+
383+
if (!modelData["path"]) {
384+
initFileDialogFolder(openFileDialog)
385+
openFileDialog.open()
386+
}
387+
388+
else {
389+
// Open project
390+
mainStack.push("Application.qml")
391+
if (_reconstruction.load(modelData["path"])) {
392+
MeshroomApp.addRecentProjectFile(modelData["path"])
393+
} else {
394+
MeshroomApp.removeRecentProjectFile(modelData["path"])
395+
}
396+
}
397+
398+
}
399+
400+
}
401+
402+
Menu {
403+
id: projectContextMenu
404+
405+
MenuItem {
406+
text: "Open"
407+
onTriggered: {
408+
if (_reconstruction.load(modelData["path"])) {
409+
mainStack.push("Application.qml")
410+
MeshroomApp.addRecentProjectFile(modelData["path"])
411+
}
412+
}
413+
}
414+
415+
MenuItem {
416+
text: "Delete"
417+
onTriggered: {
418+
MeshroomApp.removeRecentProjectFile(modelData["path"])
419+
}
420+
}
421+
}
364422

365423
Image {
366424
id: thumbnail
@@ -380,23 +438,6 @@ Page {
380438
visible: running
381439
}
382440

383-
Connections {
384-
target: projectDelegate
385-
function onClicked() {
386-
if (!modelData["path"]) {
387-
initFileDialogFolder(openFileDialog)
388-
openFileDialog.open()
389-
} else {
390-
// Open project
391-
mainStack.push("Application.qml")
392-
if (_reconstruction.load(modelData["path"])) {
393-
MeshroomApp.addRecentProjectFile(modelData["path"])
394-
} else {
395-
MeshroomApp.removeRecentProjectFile(modelData["path"])
396-
}
397-
}
398-
}
399-
}
400441
}
401442
Label {
402443
id: project

0 commit comments

Comments
 (0)