Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1c16dfea
Commit
1c16dfea
authored
Mar 15, 2017
by
Don Gagne
Committed by
GitHub
Mar 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4783 from DonLakeFlyer/MissingActiveVehicle
Toolbar Indicators: Fix reference to non-existent property
parents
3036d59f
5fff9645
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
39 deletions
+51
-39
BatteryIndicator.qml
src/ui/toolbar/BatteryIndicator.qml
+15
-13
MessageIndicator.qml
src/ui/toolbar/MessageIndicator.qml
+8
-6
ModeIndicator.qml
src/ui/toolbar/ModeIndicator.qml
+9
-6
RCRSSIIndicator.qml
src/ui/toolbar/RCRSSIIndicator.qml
+8
-6
TelemetryRSSIIndicator.qml
src/ui/toolbar/TelemetryRSSIIndicator.qml
+11
-8
No files found.
src/ui/toolbar/BatteryIndicator.qml
View file @
1c16dfea
...
@@ -25,15 +25,17 @@ Item {
...
@@ -25,15 +25,17 @@ Item {
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
width
:
batteryIndicatorRow
.
width
width
:
batteryIndicatorRow
.
width
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
function
getBatteryColor
()
{
function
getBatteryColor
()
{
if
(
activeVehicle
)
{
if
(
_
activeVehicle
)
{
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
75
)
{
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
75
)
{
return
qgcPal
.
text
return
qgcPal
.
text
}
}
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
50
)
{
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
50
)
{
return
colorOrange
return
colorOrange
}
}
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
0.1
)
{
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
0.1
)
{
return
colorRed
return
colorRed
}
}
}
}
...
@@ -41,15 +43,15 @@ Item {
...
@@ -41,15 +43,15 @@ Item {
}
}
function
getBatteryPercentageText
()
{
function
getBatteryPercentageText
()
{
if
(
activeVehicle
)
{
if
(
_
activeVehicle
)
{
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
98.9
)
{
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
98.9
)
{
return
"
100%
"
return
"
100%
"
}
}
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
0.1
)
{
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
0.1
)
{
return
activeVehicle
.
battery
.
percentRemaining
.
valueString
+
activeVehicle
.
battery
.
percentRemaining
.
units
return
_activeVehicle
.
battery
.
percentRemaining
.
valueString
+
_
activeVehicle
.
battery
.
percentRemaining
.
units
}
}
if
(
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
{
if
(
_
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
{
return
activeVehicle
.
battery
.
voltage
.
valueString
+
activeVehicle
.
battery
.
voltage
.
units
return
_activeVehicle
.
battery
.
voltage
.
valueString
+
_
activeVehicle
.
battery
.
voltage
.
units
}
}
}
}
return
"
N/A
"
return
"
N/A
"
...
@@ -87,9 +89,9 @@ Item {
...
@@ -87,9 +89,9 @@ Item {
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
qsTr
(
"
Voltage:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Voltage:
"
)
}
QGCLabel
{
text
:
(
activeVehicle
&&
activeVehicle
.
battery
.
voltage
.
value
!=
-
1
)
?
(
activeVehicle
.
battery
.
voltage
.
valueString
+
"
"
+
activeVehicle
.
battery
.
voltage
.
units
)
:
"
N/A
"
}
QGCLabel
{
text
:
(
_activeVehicle
&&
_activeVehicle
.
battery
.
voltage
.
value
!=
-
1
)
?
(
_activeVehicle
.
battery
.
voltage
.
valueString
+
"
"
+
_
activeVehicle
.
battery
.
voltage
.
units
)
:
"
N/A
"
}
QGCLabel
{
text
:
qsTr
(
"
Accumulated Consumption:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Accumulated Consumption:
"
)
}
QGCLabel
{
text
:
(
activeVehicle
&&
activeVehicle
.
battery
.
mahConsumed
.
value
!=
-
1
)
?
(
activeVehicle
.
battery
.
mahConsumed
.
valueString
+
"
"
+
activeVehicle
.
battery
.
mahConsumed
.
units
)
:
"
N/A
"
}
QGCLabel
{
text
:
(
_activeVehicle
&&
_activeVehicle
.
battery
.
mahConsumed
.
value
!=
-
1
)
?
(
_activeVehicle
.
battery
.
mahConsumed
.
valueString
+
"
"
+
_
activeVehicle
.
battery
.
mahConsumed
.
units
)
:
"
N/A
"
}
}
}
}
}
...
@@ -105,7 +107,7 @@ Item {
...
@@ -105,7 +107,7 @@ Item {
id
:
batteryIndicatorRow
id
:
batteryIndicatorRow
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
opacity
:
(
activeVehicle
&&
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
?
1
:
0.5
opacity
:
(
_activeVehicle
&&
_
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
?
1
:
0.5
QGCColoredImage
{
QGCColoredImage
{
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
...
...
src/ui/toolbar/MessageIndicator.qml
View file @
1c16dfea
...
@@ -25,15 +25,17 @@ Item {
...
@@ -25,15 +25,17 @@ Item {
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
function
getMessageColor
()
{
function
getMessageColor
()
{
if
(
activeVehicle
)
{
if
(
_
activeVehicle
)
{
if
(
activeVehicle
.
messageTypeNone
)
if
(
_
activeVehicle
.
messageTypeNone
)
return
colorGrey
return
colorGrey
if
(
activeVehicle
.
messageTypeNormal
)
if
(
_
activeVehicle
.
messageTypeNormal
)
return
colorBlue
;
return
colorBlue
;
if
(
activeVehicle
.
messageTypeWarning
)
if
(
_
activeVehicle
.
messageTypeWarning
)
return
colorOrange
;
return
colorOrange
;
if
(
activeVehicle
.
messageTypeError
)
if
(
_
activeVehicle
.
messageTypeError
)
return
colorRed
;
return
colorRed
;
// Cannot be so make make it obnoxious to show error
// Cannot be so make make it obnoxious to show error
console
.
log
(
"
Invalid vehicle message type
"
)
console
.
log
(
"
Invalid vehicle message type
"
)
...
@@ -50,7 +52,7 @@ Item {
...
@@ -50,7 +52,7 @@ Item {
sourceSize.height
:
height
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
cache
:
false
cache
:
false
visible
:
activeVehicle
&&
activeVehicle
.
messageCount
>
0
&&
isMessageImportant
visible
:
_activeVehicle
&&
_
activeVehicle
.
messageCount
>
0
&&
isMessageImportant
}
}
QGCColoredImage
{
QGCColoredImage
{
...
...
src/ui/toolbar/ModeIndicator.qml
View file @
1c16dfea
...
@@ -23,9 +23,12 @@ Item {
...
@@ -23,9 +23,12 @@ Item {
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
width
:
flightModeSelector
.
width
width
:
flightModeSelector
.
width
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
QGCLabel
{
QGCLabel
{
id
:
flightModeSelector
id
:
flightModeSelector
text
:
activeVehicle
?
activeVehicle
.
flightMode
:
qsTr
(
"
N/A
"
,
"
No data to display
"
)
text
:
_activeVehicle
?
_
activeVehicle
.
flightMode
:
qsTr
(
"
N/A
"
,
"
No data to display
"
)
font.pointSize
:
ScreenTools
.
mediumFontPointSize
font.pointSize
:
ScreenTools
.
mediumFontPointSize
color
:
qgcPal
.
buttonText
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
@@ -35,20 +38,20 @@ Item {
...
@@ -35,20 +38,20 @@ Item {
Component
{
Component
{
id
:
flightModeMenuItemComponent
id
:
flightModeMenuItemComponent
MenuItem
{
MenuItem
{
onTriggered
:
activeVehicle
.
flightMode
=
text
onTriggered
:
_
activeVehicle
.
flightMode
=
text
}
}
}
}
property
var
flightModesMenuItems
:
[]
property
var
flightModesMenuItems
:
[]
function
updateFlightModesMenu
()
{
function
updateFlightModesMenu
()
{
if
(
activeVehicle
&&
activeVehicle
.
flightModeSetAvailable
)
{
if
(
_activeVehicle
&&
_
activeVehicle
.
flightModeSetAvailable
)
{
// Remove old menu items
// Remove old menu items
for
(
var
i
=
0
;
i
<
flightModesMenuItems
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
flightModesMenuItems
.
length
;
i
++
)
{
flightModesMenu
.
removeItem
(
flightModesMenuItems
[
i
])
flightModesMenu
.
removeItem
(
flightModesMenuItems
[
i
])
}
}
flightModesMenuItems
.
length
=
0
flightModesMenuItems
.
length
=
0
// Add new items
// Add new items
for
(
var
i
=
0
;
i
<
activeVehicle
.
flightModes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
_
activeVehicle
.
flightModes
.
length
;
i
++
)
{
var
menuItem
=
flightModeMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
activeVehicle
.
flightModes
[
i
]
})
var
menuItem
=
flightModeMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
_
activeVehicle
.
flightModes
[
i
]
})
flightModesMenuItems
.
push
(
menuItem
)
flightModesMenuItems
.
push
(
menuItem
)
flightModesMenu
.
insertItem
(
i
,
menuItem
)
flightModesMenu
.
insertItem
(
i
,
menuItem
)
}
}
...
@@ -60,7 +63,7 @@ Item {
...
@@ -60,7 +63,7 @@ Item {
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
()
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
()
}
}
MouseArea
{
MouseArea
{
visible
:
activeVehicle
&&
activeVehicle
.
flightModeSetAvailable
visible
:
_activeVehicle
&&
_
activeVehicle
.
flightModeSetAvailable
anchors.fill
:
parent
anchors.fill
:
parent
onClicked
:
flightModesMenu
.
popup
()
onClicked
:
flightModesMenu
.
popup
()
}
}
...
...
src/ui/toolbar/RCRSSIIndicator.qml
View file @
1c16dfea
...
@@ -24,7 +24,9 @@ Item {
...
@@ -24,7 +24,9 @@ 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
visible
:
_activeVehicle
?
_activeVehicle
.
supportsRadio
:
true
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
Component
{
Component
{
id
:
rcRSSIInfo
id
:
rcRSSIInfo
...
@@ -45,21 +47,21 @@ Item {
...
@@ -45,21 +47,21 @@ Item {
QGCLabel
{
QGCLabel
{
id
:
rssiLabel
id
:
rssiLabel
text
:
activeVehicle
?
(
activeVehicle
.
rcRSSI
!=
255
?
qsTr
(
"
RC RSSI Status
"
)
:
qsTr
(
"
RC RSSI Data Unavailable
"
))
:
qsTr
(
"
N/A
"
,
"
No data available
"
)
text
:
_activeVehicle
?
(
_
activeVehicle
.
rcRSSI
!=
255
?
qsTr
(
"
RC RSSI Status
"
)
:
qsTr
(
"
RC RSSI Data Unavailable
"
))
:
qsTr
(
"
N/A
"
,
"
No data available
"
)
font.family
:
ScreenTools
.
demiboldFontFamily
font.family
:
ScreenTools
.
demiboldFontFamily
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
GridLayout
{
GridLayout
{
id
:
rcrssiGrid
id
:
rcrssiGrid
visible
:
activeVehicle
&&
activeVehicle
.
rcRSSI
!=
255
visible
:
_activeVehicle
&&
_
activeVehicle
.
rcRSSI
!=
255
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
columns
:
2
columns
:
2
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
qsTr
(
"
RSSI:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
RSSI:
"
)
}
QGCLabel
{
text
:
activeVehicle
?
(
activeVehicle
.
rcRSSI
+
"
%
"
)
:
0
}
QGCLabel
{
text
:
_activeVehicle
?
(
_
activeVehicle
.
rcRSSI
+
"
%
"
)
:
0
}
}
}
}
}
...
@@ -84,14 +86,14 @@ Item {
...
@@ -84,14 +86,14 @@ Item {
sourceSize.height
:
height
sourceSize.height
:
height
source
:
"
/qmlimages/RC.svg
"
source
:
"
/qmlimages/RC.svg
"
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
opacity
:
activeVehicle
?
(((
activeVehicle
.
rcRSSI
<
0
)
||
(
activeVehicle
.
rcRSSI
>
100
))
?
0.5
:
1
)
:
0.5
opacity
:
_activeVehicle
?
(((
_activeVehicle
.
rcRSSI
<
0
)
||
(
_
activeVehicle
.
rcRSSI
>
100
))
?
0.5
:
1
)
:
0.5
color
:
qgcPal
.
buttonText
color
:
qgcPal
.
buttonText
}
}
SignalStrength
{
SignalStrength
{
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
size
:
parent
.
height
*
0.5
size
:
parent
.
height
*
0.5
percent
:
activeVehicle
?
((
activeVehicle
.
rcRSSI
>
100
)
?
0
:
activeVehicle
.
rcRSSI
)
:
0
percent
:
_activeVehicle
?
((
_activeVehicle
.
rcRSSI
>
100
)
?
0
:
_
activeVehicle
.
rcRSSI
)
:
0
}
}
}
}
...
...
src/ui/toolbar/TelemetryRSSIIndicator.qml
View file @
1c16dfea
...
@@ -27,7 +27,10 @@ QGCColoredImage {
...
@@ -27,7 +27,10 @@ QGCColoredImage {
source
:
"
/qmlimages/TelemRSSI.svg
"
source
:
"
/qmlimages/TelemRSSI.svg
"
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
buttonText
color
:
qgcPal
.
buttonText
visible
:
activeVehicle
?
(
activeVehicle
.
telemetryLRSSI
<
0
)
:
false
visible
:
_activeVehicle
?
(
_activeVehicle
.
telemetryLRSSI
<
0
)
:
false
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
Component
{
Component
{
id
:
telemRSSIInfo
id
:
telemRSSIInfo
Rectangle
{
Rectangle
{
...
@@ -55,19 +58,19 @@ QGCColoredImage {
...
@@ -55,19 +58,19 @@ QGCColoredImage {
columns
:
2
columns
:
2
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
qsTr
(
"
Local RSSI:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Local RSSI:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryLRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryLRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
qsTr
(
"
Remote RSSI:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Remote RSSI:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryRRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryRRSSI
+
"
dBm
"
}
QGCLabel
{
text
:
qsTr
(
"
RX Errors:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
RX Errors:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryRXErrors
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryRXErrors
}
QGCLabel
{
text
:
qsTr
(
"
Errors Fixed:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Errors Fixed:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryFixed
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryFixed
}
QGCLabel
{
text
:
qsTr
(
"
TX Buffer:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
TX Buffer:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryTXBuffer
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryTXBuffer
}
QGCLabel
{
text
:
qsTr
(
"
Local Noise:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Local Noise:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryLNoise
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryLNoise
}
QGCLabel
{
text
:
qsTr
(
"
Remote Noise:
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Remote Noise:
"
)
}
QGCLabel
{
text
:
activeVehicle
.
telemetryRNoise
}
QGCLabel
{
text
:
_
activeVehicle
.
telemetryRNoise
}
}
}
}
}
Component.onCompleted
:
{
Component.onCompleted
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment