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
1c7174f2
Commit
1c7174f2
authored
Nov 30, 2016
by
Don Gagne
Committed by
GitHub
Nov 30, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4265 from DonLakeFlyer/TBMultiVehicleFixes
Toolbar multi vehicle fixes
parents
63e27884
7602c276
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
376 additions
and
412 deletions
+376
-412
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+1
-0
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+119
-114
MainToolBarIndicators.qml
src/ui/toolbar/MainToolBarIndicators.qml
+256
-298
No files found.
src/QmlControls/QGroundControl.Controls.qmldir
View file @
1c7174f2
...
...
@@ -9,6 +9,7 @@ FactSliderPanel 1.0 FactSliderPanel.qml
IndicatorButton 1.0 IndicatorButton.qml
JoystickThumbPad 1.0 JoystickThumbPad.qml
MainToolBar 1.0 MainToolBar.qml
MainToolBarIndicators 1.0 MainToolBarIndicators.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
...
...
src/ui/toolbar/MainToolBar.qml
View file @
1c7174f2
...
...
@@ -7,17 +7,9 @@
*
****************************************************************************/
/**
* @file
* @brief QGC Main Tool Bar
* @author Gus Grubba <mavlink@grubba.com>
*/
import
QtQuick
2.5
import
QtQuick
.
Layouts
1.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
2.5
import
QtQuick
.
Layouts
1.2
import
QtQuick
.
Controls
1.2
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
...
...
@@ -316,123 +308,136 @@ Rectangle {
visible
:
qgcPal
.
globalTheme
==
QGCPalette
.
Light
}
//---------------------------------------------
// Toolbar Row
Row
{
id
:
viewRow
height
:
mainWindow
.
tbCellHeight
spacing
:
mainWindow
.
tbSpacing
anchors.left
:
parent
.
left
RowLayout
{
anchors.bottomMargin
:
1
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
ExclusiveGroup
{
id
:
mainActionGroup
}
QGCToolBarButton
{
id
:
settingsButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/res/QGCLogoWhite
"
logo
:
true
onClicked
:
toolBar
.
showSettingsView
()
visible
:
!
QGroundControl
.
corePlugin
.
options
.
combineSettingsAndSetup
}
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.fill
:
parent
spacing
:
mainWindow
.
tbSpacing
*
2
//---------------------------------------------
// Toolbar Row
Row
{
id
:
viewRow
height
:
mainWindow
.
tbCellHeight
spacing
:
mainWindow
.
tbSpacing
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
ExclusiveGroup
{
id
:
mainActionGroup
}
QGCToolBarButton
{
id
:
settingsButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/res/QGCLogoWhite
"
logo
:
true
onClicked
:
toolBar
.
showSettingsView
()
visible
:
!
QGroundControl
.
corePlugin
.
options
.
combineSettingsAndSetup
}
QGCToolBarButton
{
id
:
setupButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/Gears.svg
"
onClicked
:
toolBar
.
showSetupView
()
}
QGCToolBarButton
{
id
:
setupButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/Gears.svg
"
onClicked
:
toolBar
.
showSetupView
()
}
QGCToolBarButton
{
id
:
planButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/Plan.svg
"
onClicked
:
toolBar
.
showPlanView
()
}
QGCToolBarButton
{
id
:
planButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/Plan.svg
"
onClicked
:
toolBar
.
showPlanView
()
}
QGCToolBarButton
{
id
:
flyButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/PaperPlane.svg
"
onClicked
:
toolBar
.
showFlyView
()
}
QGCToolBarButton
{
id
:
flyButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/PaperPlane.svg
"
onClicked
:
toolBar
.
showFlyView
()
}
QGCToolBarButton
{
id
:
analyzeButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/Analyze.svg
"
visible
:
!
ScreenTools
.
isMobile
onClicked
:
toolBar
.
showAnalyzeView
()
QGCToolBarButton
{
id
:
analyzeButton
width
:
mainWindow
.
tbButtonWidth
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
exclusiveGroup
:
mainActionGroup
source
:
"
/qmlimages/Analyze.svg
"
visible
:
!
ScreenTools
.
isMobile
onClicked
:
toolBar
.
showAnalyzeView
()
}
}
}
Item
{
id
:
vehicleIndicators
height
:
mainWindow
.
tbCellHeight
anchors.leftMargin
:
mainWindow
.
tbSpacing
*
2
anchors.left
:
viewRow
.
right
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
//-------------------------------------------------------------------------
//-- Vehicle Selector
QGCButton
{
id
:
vehicleSelectorButton
width
:
ScreenTools
.
defaultFontPixelHeight
*
8
text
:
"
Vehicle
"
+
(
activeVehicle
?
activeVehicle
.
id
:
"
None
"
)
visible
:
QGroundControl
.
multiVehicleManager
.
vehicles
.
count
>
1
anchors.verticalCenter
:
parent
.
verticalCenter
property
bool
vehicleConnectionLost
:
activeVehicle
?
activeVehicle
.
connectionLost
:
false
menu
:
vehicleMenu
Loader
{
id
:
indicatorLoader
source
:
activeVehicle
&&
!
parent
.
vehicleConnectionLost
?
"
MainToolBarIndicators.qml
"
:
""
anchors.left
:
parent
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
}
Menu
{
id
:
vehicleMenu
}
QGCLabel
{
id
:
connectionLost
text
:
qsTr
(
"
COMMUNICATION LOST
"
)
font.pointSize
:
ScreenTools
.
largeFontPointSize
font.family
:
ScreenTools
.
demiboldFontFamily
color
:
colorRed
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
disconnectButton
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
visible
:
parent
.
vehicleConnectionLost
}
Component
{
id
:
vehicleMenuItemComponent
QGCButton
{
id
:
disconnectButton
anchors.rightMargin
:
mainWindow
.
tbSpacing
*
2
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
qsTr
(
"
Disconnect
"
)
visible
:
parent
.
vehicleConnectionLost
primary
:
true
onClicked
:
activeVehicle
.
disconnectInactiveVehicle
()
}
MenuItem
{
checkable
:
true
onTriggered
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
=
vehicle
property
int
vehicleId
:
Number
(
text
.
split
(
"
"
)[
1
])
property
var
vehicle
:
QGroundControl
.
multiVehicleManager
.
getVehicleById
(
vehicleId
)
}
}
property
var
vehicleMenuItems
:
[]
Image
{
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
visible
:
x
>
indicatorLoader
.
x
+
indicatorLoader
.
width
&&
!
disconnectButton
.
visible
&&
source
!=
""
fillMode
:
Image
.
PreserveAspectFit
source
:
activeVehicle
?
activeVehicle
.
brandImage
:
""
function
updateVehicleMenu
()
{
// Remove old menu items
for
(
var
i
=
0
;
i
<
vehicleMenuItems
.
length
;
i
++
)
{
vehicleMenu
.
removeItem
(
vehicleMenuItems
[
i
])
}
vehicleMenuItems
.
length
=
0
// Add new items
for
(
var
i
=
0
;
i
<
QGroundControl
.
multiVehicleManager
.
vehicles
.
count
;
i
++
)
{
var
vehicle
=
QGroundControl
.
multiVehicleManager
.
vehicles
.
get
(
i
)
var
menuItem
=
vehicleMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
"
Vehicle
"
+
vehicle
.
id
})
vehicleMenuItems
.
push
(
menuItem
)
vehicleMenu
.
insertItem
(
i
,
menuItem
)
}
}
Component.onCompleted
:
updateVehicleMenu
()
Connections
{
target
:
QGroundControl
.
multiVehicleManager
.
vehicles
onCountChanged
:
vehicleSelectorButton
.
updateVehicleMenu
()
}
}
MainToolBarIndicators
{
height
:
mainWindow
.
tbCellHeight
Layout.fillWidth
:
true
anchors.verticalCenter
:
parent
.
verticalCenter
visible
:
activeVehicle
}
}
// Progress bar
...
...
src/ui/toolbar/MainToolBarIndicators.qml
View file @
1c7174f2
...
...
@@ -10,30 +10,26 @@
import
QtQuick
2.5
import
QtQuick
.
Controls
1.2
import
QtGraphicalEffects
1.0
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
.
Dialogs
1.1
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
Row
{
spacing
:
tbSpacing
*
2
Item
{
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
bool
_communicationLost
:
_activeVehicle
?
_activeVehicle
.
connectionLost
:
false
QGCPalette
{
id
:
qgcPal
}
//-------------------------------------------------------------------------
function
getMessageColor
()
{
if
(
activeVehicle
)
{
if
(
activeVehicle
.
messageTypeNone
)
if
(
_
activeVehicle
)
{
if
(
_
activeVehicle
.
messageTypeNone
)
return
colorGrey
if
(
activeVehicle
.
messageTypeNormal
)
if
(
_
activeVehicle
.
messageTypeNormal
)
return
colorBlue
;
if
(
activeVehicle
.
messageTypeWarning
)
if
(
_
activeVehicle
.
messageTypeWarning
)
return
colorOrange
;
if
(
activeVehicle
.
messageTypeError
)
if
(
_
activeVehicle
.
messageTypeError
)
return
colorRed
;
// Cannot be so make make it obnoxious to show error
console
.
log
(
"
Invalid vehicle message type
"
)
...
...
@@ -43,350 +39,312 @@ Row {
return
"
white
"
;
}
//-------------------------------------------------------------------------
function
getBatteryVoltageText
()
{
if
(
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
{
return
activeVehicle
.
battery
.
voltage
.
valueString
+
activeVehicle
.
battery
.
voltage
.
units
if
(
_
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
{
return
_activeVehicle
.
battery
.
voltage
.
valueString
+
_
activeVehicle
.
battery
.
voltage
.
units
}
return
'
N/A
'
;
}
//-------------------------------------------------------------------------
function
getBatteryPercentageText
()
{
if
(
activeVehicle
)
{
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
98.9
)
{
if
(
_
activeVehicle
)
{
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
98.9
)
{
return
"
100%
"
}
if
(
activeVehicle
.
battery
.
percentRemaining
.
value
>
0.1
)
{
return
activeVehicle
.
battery
.
percentRemaining
.
valueString
+
activeVehicle
.
battery
.
percentRemaining
.
units
if
(
_
activeVehicle
.
battery
.
percentRemaining
.
value
>
0.1
)
{
return
_activeVehicle
.
battery
.
percentRemaining
.
valueString
+
_
activeVehicle
.
battery
.
percentRemaining
.
units
}
if
(
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
{
return
activeVehicle
.
battery
.
voltage
.
valueString
+
activeVehicle
.
battery
.
voltage
.
units
if
(
_
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
{
return
_activeVehicle
.
battery
.
voltage
.
valueString
+
_
activeVehicle
.
battery
.
voltage
.
units
}
}
return
"
N/A
"
}
//-------------------------------------------------------------------------
//-- Message Indicator
Item
{
id
:
messages
width
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
visible
:
activeVehicle
&&
activeVehicle
.
messageCount
anchors.verticalCenter
:
parent
.
verticalCenter
Item
{
id
:
criticalMessage
anchors.fill
:
parent
visible
:
activeVehicle
&&
activeVehicle
.
messageCount
>
0
&&
isMessageImportant
Image
{
source
:
"
/qmlimages/Yield.svg
"
height
:
mainWindow
.
tbCellHeight
*
0.75
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
cache
:
false
visible
:
isMessageImportant
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
Item
{
anchors.fill
:
parent
visible
:
!
criticalMessage
.
visible
QGCColoredImage
{
id
:
messageIcon
source
:
"
/qmlimages/Megaphone.svg
"
height
:
mainWindow
.
tbCellHeight
*
0.5
width
:
height
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
color
:
getMessageColor
()
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
mainWindow
.
showMessageArea
()
}
}
}
Row
{
id
:
indicatorRow
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
1.5
visible
:
!
_communicationLost
//-------------------------------------------------------------------------
//-- GPS Indicator
Item
{
id
:
satelitte
width
:
(
gpsValuesColumn
.
x
+
gpsValuesColumn
.
width
)
*
1.1
height
:
mainWindow
.
tbCellHeight
QGCColoredImage
{
id
:
gpsIcon
source
:
"
/qmlimages/Gps.svg
"
fillMode
:
Image
.
PreserveAspectFit
width
:
mainWindow
.
tbCellHeight
*
0.65
height
:
mainWindow
.
tbCellHeight
*
0.5
sourceSize.height
:
height
opacity
:
(
activeVehicle
&&
activeVehicle
.
gps
.
count
.
value
>=
0
)
?
1
:
0.5
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCPalette
{
id
:
qgcPal
}
Column
{
id
:
gpsValuesColumn
//-------------------------------------------------------------------------
//-- Message Indicator
Item
{
id
:
messages
width
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
visible
:
_activeVehicle
&&
_activeVehicle
.
messageCount
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.left
:
gpsIcon
.
right
QGCLabel
{
anchors.horizontalCenter
:
hdopValue
.
horizontalCenter
visible
:
activeVehicle
&&
!
isNaN
(
activeVehicle
.
gps
.
hdop
.
value
)
color
:
qgcPal
.
buttonText
text
:
activeVehicle
?
activeVehicle
.
gps
.
count
.
valueString
:
""
Item
{
id
:
criticalMessage
anchors.fill
:
parent
visible
:
_activeVehicle
&&
_activeVehicle
.
messageCount
>
0
&&
isMessageImportant
Image
{
source
:
"
/qmlimages/Yield.svg
"
height
:
mainWindow
.
tbCellHeight
*
0.75
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
cache
:
false
visible
:
isMessageImportant
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
QGCLabel
{
id
:
hdopValue
visible
:
activeVehicle
&&
!
isNaN
(
activeVehicle
.
gps
.
hdop
.
value
)
color
:
qgcPal
.
buttonText
text
:
activeVehicle
?
activeVehicle
.
gps
.
hdop
.
value
.
toFixed
(
1
)
:
""
Item
{
anchors.fill
:
parent
visible
:
!
criticalMessage
.
visible
QGCColoredImage
{
id
:
messageIcon
source
:
"
/qmlimages/Megaphone.svg
"
height
:
mainWindow
.
tbCellHeight
*
0.5
width
:
height
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
color
:
getMessageColor
()
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
}
// Column
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
gpsInfo
,
centerX
)
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
mainWindow
.
showMessageArea
()
}
}
}
}
//-------------------------------------------------------------------------
//-- RC RSSI
Item
{
id
:
rcRssi
width
:
rssiRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
visible
:
activeVehicle
?
activeVehicle
.
supportsRadio
:
true
Row
{
id
:
rssiRow
height
:
parent
.
height
spacing
:
ScreenTools
.
defaultFontPixelWidth
//-------------------------------------------------------------------------
//-- GPS Indicator
Item
{
id
:
satelitte
width
:
(
gpsValuesColumn
.
x
+
gpsValuesColumn
.
width
)
*
1.1
height
:
mainWindow
.
tbCellHeight
QGCColoredImage
{
id
:
gpsIcon
source
:
"
/qmlimages/Gps.svg
"
fillMode
:
Image
.
PreserveAspectFit
width
:
mainWindow
.
tbCellHeight
*
0.65
height
:
width
height
:
mainWindow
.
tbCellHeight
*
0.5
sourceSize.height
:
height
source
:
"
/qmlimages/RC.svg
"
fillMode
:
Image
.
PreserveAspectFit
opacity
:
activeVehicle
?
(((
activeVehicle
.
rcRSSI
<
0
)
||
(
activeVehicle
.
rcRSSI
>
100
))
?
0.5
:
1
)
:
0.5
opacity
:
(
_activeVehicle
&&
_activeVehicle
.
gps
.
count
.
value
>=
0
)
?
1
:
0.5
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
}
SignalStrength
{
size
:
mainWindow
.
tbCellHeight
*
0.5
percent
:
activeVehicle
?
((
activeVehicle
.
rcRSSI
>
100
)
?
0
:
activeVehicle
.
rcRSSI
)
:
0
Column
{
id
:
gpsValuesColumn
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.left
:
gpsIcon
.
right
QGCLabel
{
anchors.horizontalCenter
:
hdopValue
.
horizontalCenter
visible
:
_activeVehicle
&&
!
isNaN
(
_activeVehicle
.
gps
.
hdop
.
value
)
color
:
qgcPal
.
buttonText
text
:
_activeVehicle
?
_activeVehicle
.
gps
.
count
.
valueString
:
""
}
QGCLabel
{
id
:
hdopValue
visible
:
_activeVehicle
&&
!
isNaN
(
_activeVehicle
.
gps
.
hdop
.
value
)
color
:
qgcPal
.
buttonText
text
:
_activeVehicle
?
_activeVehicle
.
gps
.
hdop
.
value
.
toFixed
(
1
)
:
""
}
}
// Column
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
gpsInfo
,
centerX
)
}
}
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
rcRSSIInfo
,
centerX
)
}
}
}
//-------------------------------------------------------------------------
//-- Telemetry RSSI
Item
{
id
:
telemRssi
width
:
telemIcon
.
width
height
:
mainWindow
.
tbCellHeight
visible
:
_controller
.
telemetryLRSSI
<
0
QGCColoredImage
{
id
:
telemIcon
height
:
parent
.
height
*
0.5
sourceSize.height
:
height
width
:
height
*
1.5
source
:
"
/qmlimages/TelemRSSI.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
telemRSSIInfo
,
centerX
)
//-------------------------------------------------------------------------
//-- RC RSSI
Item
{
id
:
rcRssi
width
:
rssiRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
visible
:
_activeVehicle
?
_activeVehicle
.
supportsRadio
:
true
Row
{
id
:
rssiRow
height
:
parent
.
height
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCColoredImage
{
width
:
mainWindow
.
tbCellHeight
*
0.65
height
:
width
sourceSize.height
:
height
source
:
"
/qmlimages/RC.svg
"
fillMode
:
Image
.
PreserveAspectFit
opacity
:
_activeVehicle
?
(((
_activeVehicle
.
rcRSSI
<
0
)
||
(
_activeVehicle
.
rcRSSI
>
100
))
?
0.5
:
1
)
:
0.5
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
}
SignalStrength
{
size
:
mainWindow
.
tbCellHeight
*
0.5
percent
:
_activeVehicle
?
((
_activeVehicle
.
rcRSSI
>
100
)
?
0
:
_activeVehicle
.
rcRSSI
)
:
0
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
rcRSSIInfo
,
centerX
)
}
}
}
}
//-------------------------------------------------------------------------
//-- Battery Indicator
Item
{
id
:
batteryStatus
width
:
battRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
opacity
:
(
activeVehicle
&&
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
?
1
:
0.5
Row
{
id
:
battRow
height
:
mainWindow
.
tbCellHeight
anchors.horizontalCenter
:
parent
.
horizontalCenter
//-------------------------------------------------------------------------
//-- Telemetry RSSI
Item
{
id
:
telemRssi
width
:
telemIcon
.
width
height
:
mainWindow
.
tbCellHeight
visible
:
_controller
.
telemetryLRSSI
<
0
QGCColoredImage
{
height
:
mainWindow
.
tbCellHeight
*
0.65
width
:
height
sourceSize.width
:
width
source
:
"
/qmlimages/Battery.svg
"
id
:
telemIcon
height
:
parent
.
height
*
0.5
sourceSize.height
:
height
width
:
height
*
1.5
source
:
"
/qmlimages/TelemRSSI.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
text
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCLabel
{
text
:
getBatteryPercentageText
()
font.pointSize
:
ScreenTools
.
mediumFontPointSize
color
:
getBatteryColor
()
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
if
(
activeVehicle
)
{
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
battery
Info
,
centerX
)
mainWindow
.
showPopUp
(
telemRSSI
Info
,
centerX
)
}
}
}
}
//-------------------------------------------------------------------------
//-- Vehicle Selector
QGCButton
{
id
:
vehicleSelectorButton
width
:
ScreenTools
.
defaultFontPixelHeight
*
8
text
:
"
Vehicle
"
+
(
activeVehicle
?
activeVehicle
.
id
:
"
None
"
)
visible
:
QGroundControl
.
multiVehicleManager
.
vehicles
.
count
>
1
anchors.verticalCenter
:
parent
.
verticalCenter
menu
:
vehicleMenu
Menu
{
id
:
vehicleMenu
}
Component
{
id
:
vehicleMenuItemComponent
MenuItem
{
checkable
:
true
onTriggered
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
=
vehicle
property
int
vehicleId
:
Number
(
text
.
split
(
"
"
)[
1
])
property
var
vehicle
:
QGroundControl
.
multiVehicleManager
.
getVehicleById
(
vehicleId
)
//-------------------------------------------------------------------------
//-- Battery Indicator
Item
{
id
:
batteryStatus
width
:
battRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
opacity
:
(
_activeVehicle
&&
_activeVehicle
.
battery
.
voltage
.
value
>=
0
)
?
1
:
0.5
Row
{
id
:
battRow
height
:
mainWindow
.
tbCellHeight
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCColoredImage
{
height
:
mainWindow
.
tbCellHeight
*
0.65
width
:
height
sourceSize.width
:
width
source
:
"
/qmlimages/Battery.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
text
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCLabel
{
text
:
getBatteryPercentageText
()
font.pointSize
:
ScreenTools
.
mediumFontPointSize
color
:
getBatteryColor
()
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
property
var
vehicleMenuItems
:
[]
function
updateVehicleMenu
()
{
// Remove old menu items
for
(
var
i
=
0
;
i
<
vehicleMenuItems
.
length
;
i
++
)
{
vehicleMenu
.
removeItem
(
vehicleMenuItems
[
i
])
}
vehicleMenuItems
.
length
=
0
// Add new items
for
(
var
i
=
0
;
i
<
QGroundControl
.
multiVehicleManager
.
vehicles
.
count
;
i
++
)
{
var
vehicle
=
QGroundControl
.
multiVehicleManager
.
vehicles
.
get
(
i
)
var
menuItem
=
vehicleMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
"
Vehicle
"
+
vehicle
.
id
})
vehicleMenuItems
.
push
(
menuItem
)
vehicleMenu
.
insertItem
(
i
,
menuItem
)
MouseArea
{
anchors.fill
:
parent
onClicked
:
mainWindow
.
showPopUp
(
batteryInfo
,
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
))
}
}
Component.onCompleted
:
updateVehicleMenu
()
Connections
{
target
:
QGroundControl
.
multiVehicleManager
.
vehicles
onCountChanged
:
vehicleSelectorButton
.
updateVehicleMenu
()
}
}
//-------------------------------------------------------------------------
//-- Mode Selector
Item
{
id
:
flightModeSelector
width
:
selectorRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
anchors.verticalCenter
:
parent
.
verticalCenter
Row
{
id
:
selectorRow
spacing
:
tbSpacing
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
//-------------------------------------------------------------------------
//-- Mode Selector
QGCLabel
{
id
:
flightModeSelector
text
:
_activeVehicle
?
_activeVehicle
.
flightMode
:
qsTr
(
"
N/A
"
,
"
No data to display
"
)
font.pointSize
:
ScreenTools
.
mediumFontPointSize
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
text
:
activeVehicle
?
activeVehicle
.
flightMode
:
qsTr
(
"
N/A
"
,
"
No data to display
"
)
font.pointSize
:
ScreenTools
.
mediumFontPointSize
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
Menu
{
id
:
flightModesMenu
}
}
Menu
{
id
:
flightModesMenu
}
Component
{
id
:
flightModeMenuItemComponent
Component
{
id
:
flightModeMenuItemComponent
MenuItem
{
onTriggered
:
{
if
(
activeVehicle
)
{
activeVehicle
.
flightMode
=
text
}
MenuItem
{
onTriggered
:
_activeVehicle
.
flightMode
=
text
}
}
}
property
var
flightModesMenuItems
:
[]
property
var
flightModesMenuItems
:
[]
function
updateFlightModesMenu
()
{
if
(
activeVehicle
.
flightModeSetAvailable
)
{
// Remove old menu items
for
(
var
i
=
0
;
i
<
flightModesMenuItems
.
length
;
i
++
)
{
flightModesMenu
.
removeItem
(
flightModesMenuItems
[
i
])
}
flightModesMenuItems
.
length
=
0
// Add new items
for
(
var
i
=
0
;
i
<
activeVehicle
.
flightModes
.
length
;
i
++
)
{
var
menuItem
=
flightModeMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
activeVehicle
.
flightModes
[
i
]
})
flightModesMenuItems
.
push
(
menuItem
)
flightModesMenu
.
insertItem
(
i
,
menuItem
)
function
updateFlightModesMenu
()
{
if
(
_activeVehicle
&&
_activeVehicle
.
flightModeSetAvailable
)
{
// Remove old menu items
for
(
var
i
=
0
;
i
<
flightModesMenuItems
.
length
;
i
++
)
{
flightModesMenu
.
removeItem
(
flightModesMenuItems
[
i
])
}
flightModesMenuItems
.
length
=
0
// Add new items
for
(
var
i
=
0
;
i
<
_activeVehicle
.
flightModes
.
length
;
i
++
)
{
var
menuItem
=
flightModeMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
_activeVehicle
.
flightModes
[
i
]
})
flightModesMenuItems
.
push
(
menuItem
)
flightModesMenu
.
insertItem
(
i
,
menuItem
)
}
}
}
}
Component
.
onCompleted
:
updateFlightModesMenu
()
Component.onCompleted
:
flightModeSelector
.
updateFlightModesMenu
()
Connections
{
target
:
QGroundControl
.
multiVehicleManager
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
}
Connections
{
target
:
QGroundControl
.
multiVehicleManager
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
()
}
MouseArea
{
visible
:
activeVehicle
?
activeVehicle
.
flightModeSetAvailable
:
false
anchors.fill
:
parent
onClicked
:
{
flightModesMenu
.
popup
()
MouseArea
{
visible
:
_activeVehicle
&&
_activeVehicle
.
flightModeSetAvailable
anchors.fill
:
parent
onClicked
:
flightModesMenu
.
popup
()
}
}
}
// QGCLabel - Flight mode selector
}
// Row - Vehicle indicators
Image
{
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
visible
:
x
>
indicatorRow
.
width
&&
!
_communicationLost
fillMode
:
Image
.
PreserveAspectFit
source
:
_activeVehicle
?
_activeVehicle
.
brandImage
:
""
}
}
Row
{
anchors.fill
:
parent
layoutDirection
:
Qt
.
RightToLeft
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_communicationLost
QGCButton
{
id
:
disconnectButton
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
qsTr
(
"
Disconnect
"
)
primary
:
true
onClicked
:
_activeVehicle
.
disconnectInactiveVehicle
()
}
QGCLabel
{
id
:
connectionLost
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
qsTr
(
"
COMMUNICATION LOST
"
)
font.pointSize
:
ScreenTools
.
largeFontPointSize
font.family
:
ScreenTools
.
demiboldFontFamily
color
:
colorRed
}
}
// Row - Communication lost
}
// Item
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