Newer
Older
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
Gus Grubba
committed
import QtQuick 2.11
import QtQuick.Controls 2.4
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.MultiVehicleManager 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-- Link Indicator
Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
QGCLabel {
id: priorityLinkSelector
text: activeVehicle ? activeVehicle.priorityLinkName : qsTr("N/A", "No data to display")
font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter
id: linkSelectionMenu
}
Component {
id: linkSelectionMenuItemComponent
onTriggered: activeVehicle.priorityLinkName = text
}
}
property var linkSelectionMenuItems: []
function updatelinkSelectionMenu() {
var i
for (i = 0; i < linkSelectionMenuItems.length; i++) {
linkSelectionMenu.removeItem(linkSelectionMenuItems[i])
}
linkSelectionMenuItems.length = 0
var links = activeVehicle.links
var menuItem = linkSelectionMenuItemComponent.createObject(null, { "text": links[i].getName(), "enabled": links[i].link_active(activeVehicle.id)})
linkSelectionMenuItems.push(menuItem)
linkSelectionMenu.insertItem(i, menuItem)
if (links[i].getHighLatency()) {
has_hl = true
}
Component.onCompleted: priorityLinkSelector.updatelinkSelectionMenu()
Connections {
target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: priorityLinkSelector.updatelinkSelectionMenu()
}
onLinksChanged: priorityLinkSelector.updatelinkSelectionMenu()
onLinksPropertiesChanged: priorityLinkSelector.updatelinkSelectionMenu()
}