Commit 66c2a33f authored by Gus Grubba's avatar Gus Grubba

Wrap up

parent 2bb5aad4
...@@ -605,12 +605,11 @@ Item { ...@@ -605,12 +605,11 @@ Item {
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Object Avoidance //-- Object Avoidance
Rectangle { Item {
visible: activeVehicle && activeVehicle.objectAvoidance.available && activeVehicle.objectAvoidance.enabled visible: activeVehicle && activeVehicle.objectAvoidance.available && activeVehicle.objectAvoidance.enabled
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width * 0.5 width: parent.width * 0.5
height: parent.height * 0.5 height: parent.height * 0.5
color: Qt.rgba(0,0,0,0.25)
Repeater { Repeater {
model: activeVehicle && activeVehicle.objectAvoidance.gridSize > 0 ? activeVehicle.objectAvoidance.gridSize : [] model: activeVehicle && activeVehicle.objectAvoidance.gridSize > 0 ? activeVehicle.objectAvoidance.gridSize : []
Rectangle { Rectangle {
......
...@@ -27,7 +27,7 @@ QString SafetyComponent::name(void) const ...@@ -27,7 +27,7 @@ QString SafetyComponent::name(void) const
QString SafetyComponent::description(void) const QString SafetyComponent::description(void) const
{ {
return tr("Safety Setup is used to setup triggers for Return to Land as well as the settings for Return to Land itself."); return QString();
} }
QString SafetyComponent::iconResource(void) const QString SafetyComponent::iconResource(void) const
......
...@@ -170,12 +170,11 @@ SetupPage { ...@@ -170,12 +170,11 @@ SetupPage {
enabled: _collisionPrevention enabled: _collisionPrevention
Layout.minimumWidth:_editFieldWidth Layout.minimumWidth:_editFieldWidth
Layout.fillWidth: true Layout.fillWidth: true
Component.onCompleted: { currentIndex: _collisionPrevention ? (_collisionPrevention.rawValue > 0 ? 1 : 0) : 0
currentIndex = _collisionPrevention ? (_collisionPrevention.value > 0 ? 1 : 0) : 0
}
onActivated: { onActivated: {
if(_collisionPrevention) { if(_collisionPrevention) {
_collisionPrevention.value = index > 0 ? 5 : -1 _collisionPrevention.value = index > 0 ? 5 : -1
console.log('Collision prevention enabled: ' + _collisionPrevention.value)
} }
} }
} }
...@@ -186,14 +185,10 @@ SetupPage { ...@@ -186,14 +185,10 @@ SetupPage {
} }
QGCComboBox { QGCComboBox {
model: [qsTr("Disabled"), qsTr("Enabled")] model: [qsTr("Disabled"), qsTr("Enabled")]
enabled: _objectAvoidance enabled: _objectAvoidance && _collisionPrevention.rawValue > 0
Layout.minimumWidth:_editFieldWidth Layout.minimumWidth:_editFieldWidth
Layout.fillWidth: true Layout.fillWidth: true
Component.onCompleted: { currentIndex: _objectAvoidance ? (_objectAvoidance.value === 0 ? 0 : 1) : 0
if(_objectAvoidance) {
currentIndex = _objectAvoidance.value === 0 ? 0 : 1
}
}
onActivated: { onActivated: {
if(_objectAvoidance) { if(_objectAvoidance) {
_objectAvoidance.value = index > 0 ? 1 : 0 _objectAvoidance.value = index > 0 ? 1 : 0
...@@ -208,25 +203,26 @@ SetupPage { ...@@ -208,25 +203,26 @@ SetupPage {
} }
QGCSlider { QGCSlider {
width: _editFieldWidth width: _editFieldWidth
enabled: _collisionPrevention enabled: _collisionPrevention && _collisionPrevention.rawValue > 0
Layout.minimumWidth:_editFieldWidth Layout.minimumWidth:_editFieldWidth
Layout.minimumHeight: ScreenTools.defaultFontPixelHeight * 2 Layout.minimumHeight: ScreenTools.defaultFontPixelHeight * 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
maximumValue: 1 maximumValue: 15
minimumValue: 15 minimumValue: 0
stepSize: 1 stepSize: 1
displayValue: true displayValue: true
updateValueWhileDragging: false updateValueWhileDragging: false
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Component.onCompleted: { //-- Looking at raw value on purpose. I don't know how to handle the
if(_collisionPrevention && _collisionPrevention.value > 0) { // slider range when not using metric system.
value = _collisionPrevention.value value: (_collisionPrevention && _collisionPrevention.rawValue > 0) ? _collisionPrevention.rawValue : 0
}
}
onValueChanged: { onValueChanged: {
if(_collisionPrevention) { if(_collisionPrevention) {
_collisionPrevention.value = value //-- Negative means disabled
if(_collisionPrevention.rawValue >= 0) {
_collisionPrevention.rawValue = value
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment