[ui] bind start/submit button 'enabled' property to graph computability

This commit is contained in:
Yann Lanthony 2018-07-18 22:51:40 +02:00
parent 7dfb750407
commit 5ddf138554

View file

@ -339,6 +339,16 @@ ApplicationWindow {
implicitHeight: Math.round(parent.height * 0.7) implicitHeight: Math.round(parent.height * 0.7)
spacing: 4 spacing: 4
Row { Row {
// evaluate if global reconstruction computation can be started
property bool canStartComputation: _reconstruction.viewpoints.count >= 2 // at least 2 images
&& !_reconstruction.computing // computation is not started
&& _reconstruction.graph.canComputeLeaves // graph has no uncomputable nodes
// evalute if graph computation can be submitted externally
property bool canSubmit: canStartComputation // can be computed
&& _reconstruction.graph.filepath // graph is saved on disk
// disable controls if graph is executed externally
enabled: !_reconstruction.computingExternally enabled: !_reconstruction.computingExternally
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -348,7 +358,7 @@ ApplicationWindow {
palette.button: enabled ? buttonColor : disabledPalette.button palette.button: enabled ? buttonColor : disabledPalette.button
palette.window: enabled ? buttonColor : disabledPalette.window palette.window: enabled ? buttonColor : disabledPalette.window
palette.buttonText: enabled ? "white" : disabledPalette.buttonText palette.buttonText: enabled ? "white" : disabledPalette.buttonText
enabled: _reconstruction.viewpoints.count > 2 && !_reconstruction.computing enabled: parent.canStartComputation
onClicked: _reconstruction.execute(null) onClicked: _reconstruction.execute(null)
} }
Button { Button {
@ -358,7 +368,7 @@ ApplicationWindow {
} }
Item { width: 20; height: 1 } Item { width: 20; height: 1 }
Button { Button {
enabled: _reconstruction.viewpoints.count > 2 && !_reconstruction.computing && _reconstruction.graph.filepath != "" enabled: parent.canSubmit
text: "Submit" text: "Submit"
onClicked: _reconstruction.submit(null) onClicked: _reconstruction.submit(null)
} }