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
Show 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
...
@@ -9,6 +9,7 @@ FactSliderPanel 1.0 FactSliderPanel.qml
IndicatorButton 1.0 IndicatorButton.qml
IndicatorButton 1.0 IndicatorButton.qml
JoystickThumbPad 1.0 JoystickThumbPad.qml
JoystickThumbPad 1.0 JoystickThumbPad.qml
MainToolBar 1.0 MainToolBar.qml
MainToolBar 1.0 MainToolBar.qml
MainToolBarIndicators 1.0 MainToolBarIndicators.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
...
...
src/ui/toolbar/MainToolBar.qml
View file @
1c7174f2
...
@@ -7,17 +7,9 @@
...
@@ -7,17 +7,9 @@
*
*
****************************************************************************/
****************************************************************************/
/**
* @file
* @brief QGC Main Tool Bar
* @author Gus Grubba <mavlink@grubba.com>
*/
import
QtQuick
2.5
import
QtQuick
2.5
import
QtQuick
.
Layouts
1.2
import
QtQuick
.
Layouts
1.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
1.0
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
...
@@ -316,14 +308,18 @@ Rectangle {
...
@@ -316,14 +308,18 @@ Rectangle {
visible
:
qgcPal
.
globalTheme
==
QGCPalette
.
Light
visible
:
qgcPal
.
globalTheme
==
QGCPalette
.
Light
}
}
RowLayout
{
anchors.bottomMargin
:
1
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.fill
:
parent
spacing
:
mainWindow
.
tbSpacing
*
2
//---------------------------------------------
//---------------------------------------------
// Toolbar Row
// Toolbar Row
Row
{
Row
{
id
:
viewRow
id
:
viewRow
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
spacing
:
mainWindow
.
tbSpacing
spacing
:
mainWindow
.
tbSpacing
anchors.left
:
parent
.
left
anchors.bottomMargin
:
1
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
...
@@ -383,56 +379,65 @@ Rectangle {
...
@@ -383,56 +379,65 @@ Rectangle {
}
}
}
}
Item
{
//-------------------------------------------------------------------------
id
:
vehicleIndicators
//-- Vehicle Selector
height
:
mainWindow
.
tbCellHeight
QGCButton
{
anchors.leftMargin
:
mainWindow
.
tbSpacing
*
2
id
:
vehicleSelectorButton
anchors.left
:
viewRow
.
right
width
:
ScreenTools
.
defaultFontPixelHeight
*
8
anchors.right
:
parent
.
right
text
:
"
Vehicle
"
+
(
activeVehicle
?
activeVehicle
.
id
:
"
None
"
)
visible
:
QGroundControl
.
multiVehicleManager
.
vehicles
.
count
>
1
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
property
bool
vehicleConnectionLost
:
activeVehicle
?
activeVehicle
.
connectionLost
:
false
menu
:
vehicleMenu
Loader
{
Menu
{
id
:
indicatorLoader
id
:
vehicleMenu
source
:
activeVehicle
&&
!
parent
.
vehicleConnectionLost
?
"
MainToolBarIndicators.qml
"
:
""
anchors.left
:
parent
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
QGCLabel
{
Component
{
id
:
connectionLos
t
id
:
vehicleMenuItemComponen
t
text
:
qsTr
(
"
COMMUNICATION LOST
"
)
font.pointSize
:
ScreenTools
.
largeFontPointSize
MenuItem
{
font.family
:
ScreenTools
.
demiboldFontFamily
checkable
:
true
color
:
colorRed
onTriggered
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
=
vehicle
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
disconnectButton
.
left
property
int
vehicleId
:
Number
(
text
.
split
(
"
"
)[
1
])
anchors.verticalCenter
:
parent
.
verticalCenter
property
var
vehicle
:
QGroundControl
.
multiVehicleManager
.
getVehicleById
(
vehicleId
)
visible
:
parent
.
vehicleConnectionLost
}
}
}
QGCButton
{
property
var
vehicleMenuItems
:
[]
id
:
disconnectButton
anchors.rightMargin
:
mainWindow
.
tbSpacing
*
2
function
updateVehicleMenu
()
{
anchors.right
:
parent
.
right
// Remove old menu items
anchors.verticalCenter
:
parent
.
verticalCenter
for
(
var
i
=
0
;
i
<
vehicleMenuItems
.
length
;
i
++
)
{
text
:
qsTr
(
"
Disconnect
"
)
vehicleMenu
.
removeItem
(
vehicleMenuItems
[
i
])
visible
:
parent
.
vehicleConnectionLost
primary
:
true
onClicked
:
activeVehicle
.
disconnectInactiveVehicle
()
}
}
vehicleMenuItems
.
length
=
0
Image
{
// Add new items
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
for
(
var
i
=
0
;
i
<
QGroundControl
.
multiVehicleManager
.
vehicles
.
count
;
i
++
)
{
anchors.right
:
parent
.
right
var
vehicle
=
QGroundControl
.
multiVehicleManager
.
vehicles
.
get
(
i
)
anchors.top
:
parent
.
top
var
menuItem
=
vehicleMenuItemComponent
.
createObject
(
null
,
{
"
text
"
:
"
Vehicle
"
+
vehicle
.
id
})
anchors.bottom
:
parent
.
bottom
vehicleMenuItems
.
push
(
menuItem
)
visible
:
x
>
indicatorLoader
.
x
+
indicatorLoader
.
width
&&
!
disconnectButton
.
visible
&&
source
!=
""
vehicleMenu
.
insertItem
(
i
,
menuItem
)
fillMode
:
Image
.
PreserveAspectFit
}
source
:
activeVehicle
?
activeVehicle
.
brandImage
:
""
}
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
// Progress bar
...
...
src/ui/toolbar/MainToolBarIndicators.qml
View file @
1c7174f2
...
@@ -10,30 +10,26 @@
...
@@ -10,30 +10,26 @@
import
QtQuick
2.5
import
QtQuick
2.5
import
QtQuick
.
Controls
1.2
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
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
Row
{
Item
{
spacing
:
tbSpacing
*
2
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
bool
_communicationLost
:
_activeVehicle
?
_activeVehicle
.
connectionLost
:
false
QGCPalette
{
id
:
qgcPal
}
//-------------------------------------------------------------------------
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
"
)
...
@@ -43,42 +39,49 @@ Row {
...
@@ -43,42 +39,49 @@ Row {
return
"
white
"
;
return
"
white
"
;
}
}
//-------------------------------------------------------------------------
function
getBatteryVoltageText
()
{
function
getBatteryVoltageText
()
{
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
'
;
}
}
//-------------------------------------------------------------------------
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
"
}
}
Row
{
id
:
indicatorRow
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
1.5
visible
:
!
_communicationLost
QGCPalette
{
id
:
qgcPal
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-- Message Indicator
//-- Message Indicator
Item
{
Item
{
id
:
messages
id
:
messages
width
:
mainWindow
.
tbCellHeight
width
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
visible
:
activeVehicle
&&
activeVehicle
.
messageCount
visible
:
_activeVehicle
&&
_
activeVehicle
.
messageCount
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
Item
{
Item
{
id
:
criticalMessage
id
:
criticalMessage
anchors.fill
:
parent
anchors.fill
:
parent
visible
:
activeVehicle
&&
activeVehicle
.
messageCount
>
0
&&
isMessageImportant
visible
:
_activeVehicle
&&
_
activeVehicle
.
messageCount
>
0
&&
isMessageImportant
Image
{
Image
{
source
:
"
/qmlimages/Yield.svg
"
source
:
"
/qmlimages/Yield.svg
"
height
:
mainWindow
.
tbCellHeight
*
0.75
height
:
mainWindow
.
tbCellHeight
*
0.75
...
@@ -127,7 +130,7 @@ Row {
...
@@ -127,7 +130,7 @@ Row {
width
:
mainWindow
.
tbCellHeight
*
0.65
width
:
mainWindow
.
tbCellHeight
*
0.65
height
:
mainWindow
.
tbCellHeight
*
0.5
height
:
mainWindow
.
tbCellHeight
*
0.5
sourceSize.height
:
height
sourceSize.height
:
height
opacity
:
(
activeVehicle
&&
activeVehicle
.
gps
.
count
.
value
>=
0
)
?
1
:
0.5
opacity
:
(
_activeVehicle
&&
_
activeVehicle
.
gps
.
count
.
value
>=
0
)
?
1
:
0.5
color
:
qgcPal
.
buttonText
color
:
qgcPal
.
buttonText
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
...
@@ -140,16 +143,16 @@ Row {
...
@@ -140,16 +143,16 @@ Row {
QGCLabel
{
QGCLabel
{
anchors.horizontalCenter
:
hdopValue
.
horizontalCenter
anchors.horizontalCenter
:
hdopValue
.
horizontalCenter
visible
:
activeVehicle
&&
!
isNaN
(
activeVehicle
.
gps
.
hdop
.
value
)
visible
:
_activeVehicle
&&
!
isNaN
(
_
activeVehicle
.
gps
.
hdop
.
value
)
color
:
qgcPal
.
buttonText
color
:
qgcPal
.
buttonText
text
:
activeVehicle
?
activeVehicle
.
gps
.
count
.
valueString
:
""
text
:
_activeVehicle
?
_
activeVehicle
.
gps
.
count
.
valueString
:
""
}
}
QGCLabel
{
QGCLabel
{
id
:
hdopValue
id
:
hdopValue
visible
:
activeVehicle
&&
!
isNaN
(
activeVehicle
.
gps
.
hdop
.
value
)
visible
:
_activeVehicle
&&
!
isNaN
(
_
activeVehicle
.
gps
.
hdop
.
value
)
color
:
qgcPal
.
buttonText
color
:
qgcPal
.
buttonText
text
:
activeVehicle
?
activeVehicle
.
gps
.
hdop
.
value
.
toFixed
(
1
)
:
""
text
:
_activeVehicle
?
_
activeVehicle
.
gps
.
hdop
.
value
.
toFixed
(
1
)
:
""
}
}
}
// Column
}
// Column
...
@@ -168,7 +171,7 @@ Row {
...
@@ -168,7 +171,7 @@ Row {
id
:
rcRssi
id
:
rcRssi
width
:
rssiRow
.
width
*
1.1
width
:
rssiRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
visible
:
activeVehicle
?
activeVehicle
.
supportsRadio
:
true
visible
:
_activeVehicle
?
_
activeVehicle
.
supportsRadio
:
true
Row
{
Row
{
id
:
rssiRow
id
:
rssiRow
height
:
parent
.
height
height
:
parent
.
height
...
@@ -179,13 +182,13 @@ Row {
...
@@ -179,13 +182,13 @@ Row {
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
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
SignalStrength
{
SignalStrength
{
size
:
mainWindow
.
tbCellHeight
*
0.5
size
:
mainWindow
.
tbCellHeight
*
0.5
percent
:
activeVehicle
?
((
activeVehicle
.
rcRSSI
>
100
)
?
0
:
activeVehicle
.
rcRSSI
)
:
0
percent
:
_activeVehicle
?
((
_activeVehicle
.
rcRSSI
>
100
)
?
0
:
_
activeVehicle
.
rcRSSI
)
:
0
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
...
@@ -230,7 +233,7 @@ Row {
...
@@ -230,7 +233,7 @@ Row {
id
:
batteryStatus
id
:
batteryStatus
width
:
battRow
.
width
*
1.1
width
:
battRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
opacity
:
(
activeVehicle
&&
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
?
1
:
0.5
opacity
:
(
_activeVehicle
&&
_
activeVehicle
.
battery
.
voltage
.
value
>=
0
)
?
1
:
0.5
Row
{
Row
{
id
:
battRow
id
:
battRow
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
...
@@ -251,92 +254,21 @@ Row {
...
@@ -251,92 +254,21 @@ Row {
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
onClicked
:
{
onClicked
:
mainWindow
.
showPopUp
(
batteryInfo
,
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
))
if
(
activeVehicle
)
{
var
centerX
=
mapToItem
(
toolBar
,
x
,
y
).
x
+
(
width
/
2
)
mainWindow
.
showPopUp
(
batteryInfo
,
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
)
}
}
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
)
}
}
Component.onCompleted
:
updateVehicleMenu
()
Connections
{
target
:
QGroundControl
.
multiVehicleManager
.
vehicles
onCountChanged
:
vehicleSelectorButton
.
updateVehicleMenu
()
}
}
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-- Mode Selector
//-- 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
QGCLabel
{
QGCLabel
{
text
:
activeVehicle
?
activeVehicle
.
flightMode
:
qsTr
(
"
N/A
"
,
"
No data to display
"
)
id
:
flightModeSelector
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
}
}
Menu
{
Menu
{
id
:
flightModesMenu
id
:
flightModesMenu
...
@@ -346,47 +278,73 @@ Row {
...
@@ -346,47 +278,73 @@ Row {
id
:
flightModeMenuItemComponent
id
:
flightModeMenuItemComponent
MenuItem
{
MenuItem
{
onTriggered
:
{
onTriggered
:
_activeVehicle
.
flightMode
=
text
if
(
activeVehicle
)
{
activeVehicle
.
flightMode
=
text
}
}
}
}
}
}
property
var
flightModesMenuItems
:
[]
property
var
flightModesMenuItems
:
[]
function
updateFlightModesMenu
()
{
function
updateFlightModesMenu
()
{
if
(
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
)
}
}
}
}
}
}
Component
.
onCompleted
:
updateFlightModesMenu
()
Component.onCompleted
:
flightModeSelector
.
updateFlightModesMenu
()
Connections
{
Connections
{
target
:
QGroundControl
.
multiVehicleManager
target
:
QGroundControl
.
multiVehicleManager
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
()
}
}
MouseArea
{
MouseArea
{
visible
:
activeVehicle
?
activeVehicle
.
flightModeSetAvailable
:
fals
e
visible
:
_activeVehicle
&&
_activeVehicle
.
flightModeSetAvailabl
e
anchors.fill
:
parent
anchors.fill
:
parent
onClicked
:
{
onClicked
:
flightModesMenu
.
popup
()
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