mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-04 11:51:58 +02:00
[ui] introduce first functional UI with a graph editor
First functional UI that allows to visualize, modify and execute a graph locally. * use QtQuick Controls 2 + Shapes (Qt >=5.10) * main menu to save/load a graph
This commit is contained in:
parent
e683238a8d
commit
00366cda00
8 changed files with 1004 additions and 117 deletions
138
meshroom/ui/qml/Node.qml
Executable file
138
meshroom/ui/qml/Node.qml
Executable file
|
@ -0,0 +1,138 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property variant node: object
|
||||
property color baseColor: "#607D8B"
|
||||
|
||||
signal pressed(var mouse)
|
||||
signal attributePinCreated(var attribute, var pin)
|
||||
|
||||
implicitHeight: body.height + 4
|
||||
|
||||
opacity: 0.9
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: parent
|
||||
drag.threshold: 0
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onPressed: {
|
||||
if(mouse.button == Qt.RightButton)
|
||||
nodeMenu.popup()
|
||||
root.pressed(mouse)
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: nodeMenu
|
||||
MenuItem {
|
||||
text: "Compute"
|
||||
onTriggered: _reconstruction.execute(node)
|
||||
}
|
||||
MenuItem {
|
||||
text: "Open Folder"
|
||||
onTriggered: Qt.openUrlExternally(node.internalFolder)
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: "Delete"
|
||||
onTriggered: _reconstruction.removeNode(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: body
|
||||
width: parent.width
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
padding: 2
|
||||
text: node.nodeType
|
||||
color: "#EEE"
|
||||
font.pointSize: 8
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width + 6
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Column {
|
||||
id: inputs
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Repeater {
|
||||
model: node.attributes
|
||||
delegate: Loader {
|
||||
active: !object.isOutput && object.type == "File" // TODO: review this
|
||||
|
||||
sourceComponent: AttributePin {
|
||||
id: inPin
|
||||
nodeItem: root
|
||||
attribute: object
|
||||
Component.onCompleted: attributePinCreated(object, inPin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: outputs
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
anchors.right: parent.right
|
||||
Repeater {
|
||||
model: node.attributes
|
||||
|
||||
delegate: Loader {
|
||||
active: object.isOutput
|
||||
anchors.right: parent.right
|
||||
|
||||
sourceComponent: AttributePin {
|
||||
id: outPin
|
||||
nodeItem: root
|
||||
attribute: object
|
||||
Component.onCompleted: attributePinCreated(object, outPin)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StateGroup {
|
||||
id: status
|
||||
|
||||
state: node.statusName
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "NONE"
|
||||
PropertyChanges { target: root; color: baseColor}
|
||||
},
|
||||
State {
|
||||
name: "SUBMITTED_EXTERN"
|
||||
PropertyChanges { target: root; color: "#2196F3"}
|
||||
},
|
||||
State {
|
||||
name: "SUBMITTED_LOCAL"
|
||||
PropertyChanges { target: root; color: "#009688"}
|
||||
},
|
||||
State {
|
||||
name: "RUNNING"
|
||||
PropertyChanges { target: root; color: "#FF9800"}
|
||||
},
|
||||
State {
|
||||
name: "ERROR"
|
||||
PropertyChanges { target: root; color: "#F44336"}
|
||||
},
|
||||
State {
|
||||
name: "SUCCESS"
|
||||
PropertyChanges { target: root; color: "#4CAF50"}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue