Browse Source

Merge pull request #7933 from DonLakeFlyer/IndicatorSpacing

Toolbar: Indicator spacing
QGC4.4
Don Gagne 6 years ago committed by GitHub
parent
commit
97ad69d0c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 69
      src/FlightDisplay/GuidedActionsController.qml
  2. 2
      src/ui/toolbar/ArmedIndicator.qml
  3. 2
      src/ui/toolbar/BatteryIndicator.qml
  4. 2
      src/ui/toolbar/GPSIndicator.qml
  5. 5
      src/ui/toolbar/GPSRTKIndicator.qml
  6. 7
      src/ui/toolbar/LinkIndicator.qml
  7. 4
      src/ui/toolbar/MainToolBarIndicators.qml
  8. 4
      src/ui/toolbar/MessageIndicator.qml
  9. 2
      src/ui/toolbar/ModeIndicator.qml
  10. 3
      src/ui/toolbar/MultiVehicleSelector.qml
  11. 4
      src/ui/toolbar/RCRSSIIndicator.qml
  12. 8
      src/ui/toolbar/TelemetryRSSIIndicator.qml
  13. 8
      src/ui/toolbar/VTOLModeIndicator.qml

69
src/FlightDisplay/GuidedActionsController.qml

@ -96,9 +96,9 @@ Item {
property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying
property bool showArm: _guidedActionsEnabled && !_vehicleArmed property bool showArm: _guidedActionsEnabled && !_vehicleArmed
property bool showDisarm: _guidedActionsEnabled && _vehicleArmed && !_vehicleFlying property bool showDisarm: _guidedActionsEnabled && _vehicleArmed && !_vehicleFlying
property bool showRTL: _guidedActionsEnabled && _vehicleArmed && activeVehicle.guidedModeSupported && _vehicleFlying && !_vehicleInRTLMode property bool showRTL: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.guidedModeSupported && _vehicleFlying && !_vehicleInRTLMode
property bool showTakeoff: _guidedActionsEnabled && activeVehicle.takeoffVehicleSupported && !_vehicleFlying property bool showTakeoff: _guidedActionsEnabled && _activeVehicle.takeoffVehicleSupported && !_vehicleFlying
property bool showLand: _guidedActionsEnabled && activeVehicle.guidedModeSupported && _vehicleArmed && !activeVehicle.fixedWing && !_vehicleInLandMode property bool showLand: _guidedActionsEnabled && _activeVehicle.guidedModeSupported && _vehicleArmed && !_activeVehicle.fixedWing && !_vehicleInLandMode
property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying
property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleArmed && _vehicleFlying && (_currentMissionIndex < _missionItemCount - 1) property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleArmed && _vehicleFlying && (_currentMissionIndex < _missionItemCount - 1)
property bool showPause: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused && !_fixedWingOnApproach property bool showPause: _guidedActionsEnabled && _vehicleArmed && _activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused && !_fixedWingOnApproach
@ -108,18 +108,19 @@ Item {
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
// Note: The '_missionItemCount - 2' is a hack to not trigger resume mission when a mission ends with an RTL item // Note: The '_missionItemCount - 2' is a hack to not trigger resume mission when a mission ends with an RTL item
property bool showResumeMission: activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < _missionItemCount - 2) property bool showResumeMission: _activeVehicle && !_vehicleArmed && _vehicleWasFlying && _missionAvailable && _resumeMissionIndex > 0 && (_resumeMissionIndex < _missionItemCount - 2)
property bool guidedUIVisible: guidedActionConfirm.visible || guidedActionList.visible property bool guidedUIVisible: guidedActionConfirm.visible || guidedActionList.visible
property var _corePlugin: QGroundControl.corePlugin property var _corePlugin: QGroundControl.corePlugin
property bool _guidedActionsEnabled: (!ScreenTools.isDebug && QGroundControl.corePlugin.options.guidedActionsRequireRCRSSI && activeVehicle) ? _rcRSSIAvailable : activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string _flightMode: activeVehicle ? activeVehicle.flightMode : "" property bool _guidedActionsEnabled: (!ScreenTools.isDebug && QGroundControl.corePlugin.options.guidedActionsRequireRCRSSI && _activeVehicle) ? _rcRSSIAvailable : _activeVehicle
property string _flightMode: _activeVehicle ? _activeVehicle.flightMode : ""
property bool _missionAvailable: missionController.containsItems property bool _missionAvailable: missionController.containsItems
property bool _missionActive: activeVehicle ? _vehicleArmed && (_vehicleInLandMode || _vehicleInRTLMode || _vehicleInMissionMode) : false property bool _missionActive: _activeVehicle ? _vehicleArmed && (_vehicleInLandMode || _vehicleInRTLMode || _vehicleInMissionMode) : false
property bool _vehicleArmed: activeVehicle ? activeVehicle.armed : false property bool _vehicleArmed: _activeVehicle ? _activeVehicle.armed : false
property bool _vehicleFlying: activeVehicle ? activeVehicle.flying : false property bool _vehicleFlying: _activeVehicle ? _activeVehicle.flying : false
property bool _vehicleLanding: activeVehicle ? activeVehicle.landing : false property bool _vehicleLanding: _activeVehicle ? _activeVehicle.landing : false
property bool _vehiclePaused: false property bool _vehiclePaused: false
property bool _vehicleInMissionMode: false property bool _vehicleInMissionMode: false
property bool _vehicleInRTLMode: false property bool _vehicleInRTLMode: false
@ -134,13 +135,13 @@ Item {
property bool _fixedWingOnApproach: _activeVehicle ? _activeVehicle.fixedWing && _vehicleLanding : false property bool _fixedWingOnApproach: _activeVehicle ? _activeVehicle.fixedWing && _vehicleLanding : false
// You can turn on log output for GuidedActionsController by turning on GuidedActionsControllerLog category // You can turn on log output for GuidedActionsController by turning on GuidedActionsControllerLog category
property bool __guidedModeSupported: activeVehicle ? activeVehicle.guidedModeSupported : false property bool __guidedModeSupported: _activeVehicle ? _activeVehicle.guidedModeSupported : false
property bool __pauseVehicleSupported: activeVehicle ? activeVehicle.pauseVehicleSupported : false property bool __pauseVehicleSupported: _activeVehicle ? _activeVehicle.pauseVehicleSupported : false
property bool __flightMode: _flightMode property bool __flightMode: _flightMode
function _outputState() { function _outputState() {
if (_corePlugin.guidedActionsControllerLogging()) { if (_corePlugin.guidedActionsControllerLogging()) {
console.log(qsTr("activeVehicle(%1) _vehicleArmed(%2) guidedModeSupported(%3) _vehicleFlying(%4) _vehicleWasFlying(%5) _vehicleInRTLMode(%6) pauseVehicleSupported(%7) _vehiclePaused(%8) _flightMode(%9) _missionItemCount(%10)").arg(activeVehicle ? 1 : 0).arg(_vehicleArmed ? 1 : 0).arg(__guidedModeSupported ? 1 : 0).arg(_vehicleFlying ? 1 : 0).arg(_vehicleWasFlying ? 1 : 0).arg(_vehicleInRTLMode ? 1 : 0).arg(__pauseVehicleSupported ? 1 : 0).arg(_vehiclePaused ? 1 : 0).arg(_flightMode).arg(_missionItemCount)) console.log(qsTr("_activeVehicle(%1) _vehicleArmed(%2) guidedModeSupported(%3) _vehicleFlying(%4) _vehicleWasFlying(%5) _vehicleInRTLMode(%6) pauseVehicleSupported(%7) _vehiclePaused(%8) _flightMode(%9) _missionItemCount(%10)").arg(_activeVehicle ? 1 : 0).arg(_vehicleArmed ? 1 : 0).arg(__guidedModeSupported ? 1 : 0).arg(_vehicleFlying ? 1 : 0).arg(_vehicleWasFlying ? 1 : 0).arg(_vehicleInRTLMode ? 1 : 0).arg(__pauseVehicleSupported ? 1 : 0).arg(_vehiclePaused ? 1 : 0).arg(_flightMode).arg(_missionItemCount))
} }
} }
@ -208,10 +209,10 @@ Item {
property var _actionData property var _actionData
on_FlightModeChanged: { on_FlightModeChanged: {
_vehiclePaused = activeVehicle ? _flightMode === activeVehicle.pauseFlightMode : false _vehiclePaused = _activeVehicle ? _flightMode === _activeVehicle.pauseFlightMode : false
_vehicleInRTLMode = activeVehicle ? _flightMode === activeVehicle.rtlFlightMode || _flightMode === activeVehicle.smartRTLFlightMode : false _vehicleInRTLMode = _activeVehicle ? _flightMode === _activeVehicle.rtlFlightMode || _flightMode === _activeVehicle.smartRTLFlightMode : false
_vehicleInLandMode = activeVehicle ? _flightMode === activeVehicle.landFlightMode : false _vehicleInLandMode = _activeVehicle ? _flightMode === _activeVehicle.landFlightMode : false
_vehicleInMissionMode = activeVehicle ? _flightMode === activeVehicle.missionFlightMode : false // Must be last to get correct signalling for showStartMission popups _vehicleInMissionMode = _activeVehicle ? _flightMode === _activeVehicle.missionFlightMode : false // Must be last to get correct signalling for showStartMission popups
} }
// Called when an action is about to be executed in order to confirm // Called when an action is about to be executed in order to confirm
@ -286,7 +287,7 @@ Item {
case actionRTL: case actionRTL:
confirmDialog.title = rtlTitle confirmDialog.title = rtlTitle
confirmDialog.message = rtlMessage confirmDialog.message = rtlMessage
if (activeVehicle.supportsSmartRTL) { if (_activeVehicle.supportsSmartRTL) {
confirmDialog.optionText = qsTr("Smart RTL") confirmDialog.optionText = qsTr("Smart RTL")
confirmDialog.optionChecked = false confirmDialog.optionChecked = false
} }
@ -355,13 +356,13 @@ Item {
var rgVehicle; var rgVehicle;
switch (actionCode) { switch (actionCode) {
case actionRTL: case actionRTL:
activeVehicle.guidedModeRTL(optionChecked) _activeVehicle.guidedModeRTL(optionChecked)
break break
case actionLand: case actionLand:
activeVehicle.guidedModeLand() _activeVehicle.guidedModeLand()
break break
case actionTakeoff: case actionTakeoff:
activeVehicle.guidedModeTakeoff(actionAltitudeChange) _activeVehicle.guidedModeTakeoff(actionAltitudeChange)
break break
case actionResumeMission: case actionResumeMission:
case actionResumeMissionUploadFail: case actionResumeMissionUploadFail:
@ -369,7 +370,7 @@ Item {
break break
case actionStartMission: case actionStartMission:
case actionContinueMission: case actionContinueMission:
activeVehicle.startMission() _activeVehicle.startMission()
break break
case actionMVStartMission: case actionMVStartMission:
rgVehicle = QGroundControl.multiVehicleManager.vehicles rgVehicle = QGroundControl.multiVehicleManager.vehicles
@ -378,32 +379,32 @@ Item {
} }
break break
case actionArm: case actionArm:
activeVehicle.armed = true _activeVehicle.armed = true
break break
case actionDisarm: case actionDisarm:
activeVehicle.armed = false _activeVehicle.armed = false
break break
case actionEmergencyStop: case actionEmergencyStop:
activeVehicle.emergencyStop() _activeVehicle.emergencyStop()
break break
case actionChangeAlt: case actionChangeAlt:
activeVehicle.guidedModeChangeAltitude(actionAltitudeChange) _activeVehicle.guidedModeChangeAltitude(actionAltitudeChange)
break break
case actionGoto: case actionGoto:
activeVehicle.guidedModeGotoLocation(actionData) _activeVehicle.guidedModeGotoLocation(actionData)
break break
case actionSetWaypoint: case actionSetWaypoint:
activeVehicle.setCurrentMissionSequence(actionData) _activeVehicle.setCurrentMissionSequence(actionData)
break break
case actionOrbit: case actionOrbit:
activeVehicle.guidedModeOrbit(orbitMapCircle.center, orbitMapCircle.radius() * (orbitMapCircle.clockwiseRotation ? 1 : -1), activeVehicle.altitudeAMSL.rawValue + actionAltitudeChange) _activeVehicle.guidedModeOrbit(orbitMapCircle.center, orbitMapCircle.radius() * (orbitMapCircle.clockwiseRotation ? 1 : -1), _activeVehicle.altitudeAMSL.rawValue + actionAltitudeChange)
break break
case actionLandAbort: case actionLandAbort:
activeVehicle.abortLanding(50) // hardcoded value for climbOutAltitude that is currently ignored _activeVehicle.abortLanding(50) // hardcoded value for climbOutAltitude that is currently ignored
break break
case actionPause: case actionPause:
activeVehicle.pauseVehicle() _activeVehicle.pauseVehicle()
activeVehicle.guidedModeChangeAltitude(actionAltitudeChange) _activeVehicle.guidedModeChangeAltitude(actionAltitudeChange)
break break
case actionMVPause: case actionMVPause:
rgVehicle = QGroundControl.multiVehicleManager.vehicles rgVehicle = QGroundControl.multiVehicleManager.vehicles
@ -412,10 +413,10 @@ Item {
} }
break break
case actionVtolTransitionToFwdFlight: case actionVtolTransitionToFwdFlight:
activeVehicle.vtolInFwdFlight = true _activeVehicle.vtolInFwdFlight = true
break break
case actionVtolTransitionToMRFlight: case actionVtolTransitionToMRFlight:
activeVehicle.vtolInFwdFlight = false _activeVehicle.vtolInFwdFlight = false
break break
default: default:
console.warn(qsTr("Internal error: unknown actionCode"), actionCode) console.warn(qsTr("Internal error: unknown actionCode"), actionCode)

2
src/ui/toolbar/ArmedIndicator.qml

@ -28,6 +28,8 @@ QGCComboBox {
currentIndex: -1 currentIndex: -1
sizeToContents: true sizeToContents: true
property bool showIndicator: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _armed: _activeVehicle ? _activeVehicle.armed : false property bool _armed: _activeVehicle ? _activeVehicle.armed : false

2
src/ui/toolbar/BatteryIndicator.qml

@ -24,6 +24,8 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: batteryIndicatorRow.width width: batteryIndicatorRow.width
property bool showIndicator: true
function getBatteryColor() { function getBatteryColor() {
if(activeVehicle) { if(activeVehicle) {
if(activeVehicle.battery.percentRemaining.value > 75) { if(activeVehicle.battery.percentRemaining.value > 75) {

2
src/ui/toolbar/GPSIndicator.qml

@ -24,6 +24,8 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
property bool showIndicator: true
Component { Component {
id: gpsInfo id: gpsInfo

5
src/ui/toolbar/GPSRTKIndicator.qml

@ -19,10 +19,11 @@ import QGroundControl.Palette 1.0
//-- GPS Indicator //-- GPS Indicator
Item { Item {
id: _root id: _root
width: visible ? (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 : 0 width: (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: QGroundControl.gpsRtk.connected.value
property bool showIndicator: QGroundControl.gpsRtk.connected.value
Component { Component {
id: gpsInfo id: gpsInfo

7
src/ui/toolbar/LinkIndicator.qml

@ -23,10 +23,9 @@ import QGroundControl.Vehicle 1.0
Item { Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: visible ? priorityLinkSelector.width : 0 width: priorityLinkSelector.width
visible: _visible
property bool _visible: false property bool showIndicator: false
QGCLabel { QGCLabel {
id: priorityLinkSelector id: priorityLinkSelector
@ -66,7 +65,7 @@ Item {
} }
} }
_visible = links.length > 1 && has_hl showIndicator = links.length > 1 && has_hl
} }
} }

4
src/ui/toolbar/MainToolBarIndicators.qml

@ -84,10 +84,12 @@ Item {
Repeater { Repeater {
model: activeVehicle ? activeVehicle.toolBarIndicators : [] model: activeVehicle ? activeVehicle.toolBarIndicators : []
Loader { Loader {
id: indicatorLoader
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66 anchors.margins: ScreenTools.defaultFontPixelHeight * 0.66
source: modelData; source: modelData
visible: item.showIndicator
} }
} }
} }

4
src/ui/toolbar/MessageIndicator.qml

@ -25,7 +25,9 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
property bool _isMessageImportant: activeVehicle ? !activeVehicle.messageTypeNormal && !activeVehicle.messageTypeNone : false property bool showIndicator: true
property bool _isMessageImportant: activeVehicle ? !activeVehicle.messageTypeNormal && !activeVehicle.messageTypeNone : false
function getMessageColor() { function getMessageColor() {
if (activeVehicle) { if (activeVehicle) {

2
src/ui/toolbar/ModeIndicator.qml

@ -28,6 +28,8 @@ QGCComboBox {
currentIndex: -1 currentIndex: -1
sizeToContents: true sizeToContents: true
property bool showIndicator: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _flightModes: _activeVehicle ? _activeVehicle.flightModes : [ ] property var _flightModes: _activeVehicle ? _activeVehicle.flightModes : [ ]

3
src/ui/toolbar/MultiVehicleSelector.qml

@ -26,7 +26,8 @@ QGCComboBox {
currentIndex: -1 currentIndex: -1
sizeToContents: true sizeToContents: true
model: _vehicleModel model: _vehicleModel
visible: _multipleVehicles
property bool showIndicator: _multipleVehicles
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _multipleVehicles: _activeVehicle ? QGroundControl.multiVehicleManager.vehicles.count > 1 : false property bool _multipleVehicles: _activeVehicle ? QGroundControl.multiVehicleManager.vehicles.count > 1 : false

4
src/ui/toolbar/RCRSSIIndicator.qml

@ -23,8 +23,10 @@ Item {
width: rssiRow.width * 1.1 width: rssiRow.width * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: activeVehicle ? activeVehicle.supportsRadio : true
property bool showIndicator: _activeVehicle.supportsRadio
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _rcRSSIAvailable: activeVehicle ? activeVehicle.rcRSSI > 0 && activeVehicle.rcRSSI <= 100 : false property bool _rcRSSIAvailable: activeVehicle ? activeVehicle.rcRSSI > 0 && activeVehicle.rcRSSI <= 100 : false
Component { Component {

8
src/ui/toolbar/TelemetryRSSIIndicator.qml

@ -22,10 +22,12 @@ Item {
id: _root id: _root
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: _hasTelemetry ? telemIcon.width * 1.1 : 0 width: telemIcon.width * 1.1
visible: _hasTelemetry
property bool _hasTelemetry: activeVehicle ? activeVehicle.telemetryLRSSI !== 0 : false property bool showIndicator: _hasTelemetry
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _hasTelemetry: _activeVehicle ? _activeVehicle.telemetryLRSSI !== 0 : false
Component { Component {
id: telemRSSIInfo id: telemRSSIInfo

8
src/ui/toolbar/VTOLModeIndicator.qml

@ -26,10 +26,12 @@ QGCLabel {
text: _fwdFlight ? qsTr("VTOL: Fixed Wing") : qsTr("VTOL: Multi-Rotor") text: _fwdFlight ? qsTr("VTOL: Fixed Wing") : qsTr("VTOL: Multi-Rotor")
font.pointSize: ScreenTools.mediumFontPointSize font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText color: qgcPal.buttonText
visible: activeVehicle ? activeVehicle.vtol && activeVehicle.px4Firmware : false width: implicitWidth
width: visible ? implicitWidth : 0
property bool _fwdFlight: activeVehicle ? activeVehicle.vtolInFwdFlight : false property bool showIndicator: _activeVehicle.vtol && _activeVehicle.px4Firmware
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _fwdFlight: _activeVehicle.vtolInFwdFlight
QGCMouseArea { QGCMouseArea {
fillItem: parent fillItem: parent

Loading…
Cancel
Save