Unverified Commit f62c8640 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8972 from DonLakeFlyer/MainStatus

Fly: Move flight mode, vtol mode, armed into main status
parents 3543cd37 863e2abe
...@@ -320,9 +320,6 @@ const QVariantList& FirmwarePlugin::modeIndicators(const Vehicle*) ...@@ -320,9 +320,6 @@ const QVariantList& FirmwarePlugin::modeIndicators(const Vehicle*)
if(_modeIndicatorList.size() == 0) { if(_modeIndicatorList.size() == 0) {
_modeIndicatorList = QVariantList({ _modeIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ROIIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ROIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ArmedIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/VTOLModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MultiVehicleSelector.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MultiVehicleSelector.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/LinkIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/LinkIndicator.qml")),
}); });
......
...@@ -19,7 +19,8 @@ QGCLabel { ...@@ -19,7 +19,8 @@ QGCLabel {
id: flightModeMenuLabel id: flightModeMenuLabel
text: currentVehicle ? currentVehicle.flightMode : qsTr("N/A", "No data to display") text: currentVehicle ? currentVehicle.flightMode : qsTr("N/A", "No data to display")
property var currentVehicle: QGroundControl.multiVehicleManager.activeVehicle property var currentVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real mouseAreaLeftMargin: 0
QGCMenu { QGCMenu {
id: flightModesMenu id: flightModesMenu
...@@ -60,8 +61,10 @@ QGCLabel { ...@@ -60,8 +61,10 @@ QGCLabel {
} }
MouseArea { MouseArea {
visible: currentVehicle && currentVehicle.flightModeSetAvailable id: mouseArea
anchors.fill: parent visible: currentVehicle && currentVehicle.flightModeSetAvailable
onClicked: flightModesMenu.popup() anchors.leftMargin: mouseAreaLeftMargin
anchors.fill: parent
onClicked: flightModesMenu.popup()
} }
} }
// QtQuick.Control 1.x Menu // Use old QtQuick.Control 1.x Menu to work around bug in new Qml Menu
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
......
...@@ -59,7 +59,6 @@ void TrajectoryPoints::start(void) ...@@ -59,7 +59,6 @@ void TrajectoryPoints::start(void)
void TrajectoryPoints::stop(void) void TrajectoryPoints::stop(void)
{ {
qDebug() << "Stop" << _points.count();
disconnect(_vehicle, &Vehicle::coordinateChanged, this, &TrajectoryPoints::_vehicleCoordinateChanged); disconnect(_vehicle, &Vehicle::coordinateChanged, this, &TrajectoryPoints::_vehicleCoordinateChanged);
} }
......
...@@ -758,20 +758,20 @@ ApplicationWindow { ...@@ -758,20 +758,20 @@ ApplicationWindow {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Indicator Popups //-- Indicator Popups
function showPopUp(item, dropItem) { function showIndicatorPopup(item, dropItem) {
indicatorDropdown.currentIndicator = dropItem indicatorPopup.currentIndicator = dropItem
indicatorDropdown.currentItem = item indicatorPopup.currentItem = item
indicatorDropdown.open() indicatorPopup.open()
} }
function hidePopUp() { function hideIndicatorPopup() {
indicatorDropdown.close() indicatorPopup.close()
indicatorDropdown.currentItem = null indicatorPopup.currentItem = null
indicatorDropdown.currentIndicator = null indicatorPopup.currentIndicator = null
} }
Popup { Popup {
id: indicatorDropdown id: indicatorPopup
padding: ScreenTools.defaultFontPixelWidth * 0.75 padding: ScreenTools.defaultFontPixelWidth * 0.75
modal: true modal: true
focus: true focus: true
...@@ -786,19 +786,19 @@ ApplicationWindow { ...@@ -786,19 +786,19 @@ ApplicationWindow {
Loader { Loader {
id: loader id: loader
onLoaded: { onLoaded: {
var centerX = mainWindow.contentItem.mapFromItem(indicatorDropdown.currentItem, 0, 0).x - (loader.width * 0.5) var centerX = mainWindow.contentItem.mapFromItem(indicatorPopup.currentItem, 0, 0).x - (loader.width * 0.5)
if((centerX + indicatorDropdown.width) > (mainWindow.width - ScreenTools.defaultFontPixelWidth)) { if((centerX + indicatorPopup.width) > (mainWindow.width - ScreenTools.defaultFontPixelWidth)) {
centerX = mainWindow.width - indicatorDropdown.width - ScreenTools.defaultFontPixelWidth centerX = mainWindow.width - indicatorPopup.width - ScreenTools.defaultFontPixelWidth
} }
indicatorDropdown.x = centerX indicatorPopup.x = centerX
} }
} }
onOpened: { onOpened: {
loader.sourceComponent = indicatorDropdown.currentIndicator loader.sourceComponent = indicatorPopup.currentIndicator
} }
onClosed: { onClosed: {
loader.sourceComponent = null loader.sourceComponent = null
indicatorDropdown.currentIndicator = null indicatorPopup.currentIndicator = null
} }
} }
} }
...@@ -120,7 +120,7 @@ Item { ...@@ -120,7 +120,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, batteryInfo) mainWindow.showIndicatorPopup(_root, batteryInfo)
} }
} }
} }
...@@ -109,7 +109,7 @@ Item { ...@@ -109,7 +109,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, gpsInfo) mainWindow.showIndicatorPopup(_root, gpsInfo)
} }
} }
} }
...@@ -109,7 +109,7 @@ Item { ...@@ -109,7 +109,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, gpsInfo) mainWindow.showIndicatorPopup(_root, gpsInfo)
} }
} }
} }
...@@ -91,7 +91,7 @@ Item { ...@@ -91,7 +91,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, joystickInfo) mainWindow.showIndicatorPopup(_root, joystickInfo)
} }
} }
} }
...@@ -16,57 +16,21 @@ import QGroundControl.MultiVehicleManager 1.0 ...@@ -16,57 +16,21 @@ 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
Item { RowLayout {
id: _root id: _root
Layout.preferredWidth: mainStatusLabel.contentWidth + ScreenTools.defaultFontPixelWidth spacing: 0
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _margins: ScreenTools.defaultFontPixelWidth property var _vehicleInAir: _activeVehicle ? _activeVehicle.flying || _activeVehicle.landing : false
property bool _vtolInFWDFlight: _activeVehicle ? _activeVehicle.vtolInFwdFlight : false
Component { property bool _armed: _activeVehicle ? _activeVehicle.armed : false
id: mainStatusInfo property real _margins: ScreenTools.defaultFontPixelWidth
property real _spacing: ScreenTools.defaultFontPixelWidth / 2
Rectangle {
width: mainLayout.width + (_margins * 2)
height: mainLayout.height + (_margins * 2)
radius: ScreenTools.defaultFontPixelHeight * 0.5
color: qgcPal.window
border.color: qgcPal.text
GridLayout {
id: mainLayout
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
rowSpacing: ScreenTools.defaultFontPixelWidth / 2
columnSpacing: rowSpacing
rows: _activeVehicle.sysStatusSensorInfo.sensorNames.length
flow: GridLayout.TopToBottom
Repeater {
model: _activeVehicle.sysStatusSensorInfo.sensorNames
QGCLabel {
text: modelData
}
}
Repeater {
model: _activeVehicle.sysStatusSensorInfo.sensorStatus
QGCLabel {
text: modelData
}
}
}
}
}
QGCLabel { QGCLabel {
id: mainStatusLabel id: mainStatusLabel
text: mainStatusText() text: mainStatusText()
font.pointSize: ScreenTools.largeFontPointSize font.pointSize: _vehicleInAir ? ScreenTools.defaultFontPointSize : ScreenTools.largeFontPointSize
anchors.verticalCenter: parent.verticalCenter
property string _commLostText: qsTr("Communication Lost") property string _commLostText: qsTr("Communication Lost")
property string _readyToFlyText: qsTr("Ready To Fly") property string _readyToFlyText: qsTr("Ready To Fly")
...@@ -117,13 +81,156 @@ Item { ...@@ -117,13 +81,156 @@ Item {
return mainStatusLabel._disconnectedText return mainStatusLabel._disconnectedText
} }
} }
MouseArea {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
height: _root.height
enabled: _activeVehicle
onClicked: mainWindow.showIndicatorPopup(mainStatusLabel, sensorStatusInfoComponent)
}
}
Item {
width: ScreenTools.defaultFontPixelWidth
height: 1
}
QGCColoredImage {
id: flightModeIcon
width: height
height: ScreenTools.defaultFontPixelHeight * 0.75
fillMode: Image.PreserveAspectFit
mipmap: true
color: qgcPal.text
source: "/qmlimages/FlightModesComponentIcon.png"
visible: _activeVehicle
}
Item {
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * (_vehicleInAir ? ScreenTools.largeFontPointRatio : 1) / 3
height: 1
visible: flightModeMenu.visible
}
FlightModeMenu {
id: flightModeMenu
Layout.preferredHeight: _root.height
verticalAlignment: Text.AlignVCenter
font.pointSize: _vehicleInAir ? ScreenTools.largeFontPointSize : ScreenTools.defaultFontPointSize
mouseAreaLeftMargin: -(flightModeMenu.x - flightModeIcon.x)
visible: _activeVehicle
}
Item {
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * ScreenTools.largeFontPointRatio
height: 1
visible: vtolModeLabel.visible
} }
MouseArea { QGCLabel {
anchors.fill: parent id: vtolModeLabel
enabled: _activeVehicle Layout.preferredHeight: _root.height
onClicked: { verticalAlignment: Text.AlignVCenter
mainWindow.showPopUp(_root, mainStatusInfo) text: _vtolInFWDFlight ? qsTr("FW(vtol)") : qsTr("MR(vtol)")
font.pointSize: ScreenTools.largeFontPointSize
visible: _activeVehicle ? _activeVehicle.vtol && _vehicleInAir : false
QGCMouseArea {
anchors.fill: parent
onClicked: mainWindow.showIndicatorPopup(vtolModeLabel, vtolTransitionComponent)
}
}
Component {
id: sensorStatusInfoComponent
Rectangle {
width: mainLayout.width + (_margins * 2)
height: mainLayout.height + (_margins * 2)
radius: ScreenTools.defaultFontPixelHeight * 0.5
color: qgcPal.window
border.color: qgcPal.text
ColumnLayout {
id: mainLayout
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
spacing: _spacing
QGCLabel {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Sensor Status")
}
GridLayout {
rowSpacing: _spacing
columnSpacing: _spacing
rows: _activeVehicle.sysStatusSensorInfo.sensorNames.length
flow: GridLayout.TopToBottom
Repeater {
model: _activeVehicle.sysStatusSensorInfo.sensorNames
QGCLabel {
text: modelData
}
}
Repeater {
model: _activeVehicle.sysStatusSensorInfo.sensorStatus
QGCLabel {
text: modelData
}
}
}
QGCButton {
Layout.alignment: Qt.AlignHCenter
text: _armed ? qsTr("Disarm") : qsTr("Arm")
onClicked: {
if (_armed) {
mainWindow.disarmVehicleRequest()
} else {
mainWindow.armVehicleRequest()
}
mainWindow.hideIndicatorPopup()
}
}
}
}
}
Component {
id: vtolTransitionComponent
Rectangle {
width: mainLayout.width + (_margins * 2)
height: mainLayout.height + (_margins * 2)
radius: ScreenTools.defaultFontPixelHeight * 0.5
color: qgcPal.window
border.color: qgcPal.text
QGCButton {
id: mainLayout
anchors.margins: _margins
anchors.top: parent.top
anchors.left: parent.left
text: _vtolInFWDFlight ? qsTr("Transition to Multi-Rotor") : qsTr("Transition to Fixed Wing")
onClicked: {
if (_vtolInFWDFlight) {
mainWindow.vtolTransitionToMRFlightRequest()
} else {
mainWindow.vtolTransitionToFwdFlightRequest()
}
mainWindow.hideIndicatorPopup()
}
}
} }
} }
} }
...@@ -87,19 +87,18 @@ Rectangle { ...@@ -87,19 +87,18 @@ Rectangle {
spacing: ScreenTools.defaultFontPixelWidth / 2 spacing: ScreenTools.defaultFontPixelWidth / 2
QGCToolBarButton { QGCToolBarButton {
id: currentButton id: currentButton
Layout.fillHeight: true Layout.preferredHeight: viewButtonRow.height
onClicked: viewSelectDrawer.visible = true onClicked: viewSelectDrawer.visible = true
} }
MainStatusIndicator { MainStatusIndicator {
Layout.fillHeight: true Layout.preferredHeight: viewButtonRow.height
visible: currentToolbar === flyViewToolbar visible: currentToolbar === flyViewToolbar
} }
QGCButton { QGCButton {
id: disconnectButton id: disconnectButton
Layout.alignment: Qt.AlignVCenter
text: qsTr("Disconnect") text: qsTr("Disconnect")
onClicked: _activeVehicle.disconnectInactiveVehicle() onClicked: _activeVehicle.disconnectInactiveVehicle()
visible: _activeVehicle && _communicationLost && currentToolbar === flyViewToolbar visible: _activeVehicle && _communicationLost && currentToolbar === flyViewToolbar
......
...@@ -95,7 +95,7 @@ Item { ...@@ -95,7 +95,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, rcRSSIInfo) mainWindow.showIndicatorPopup(_root, rcRSSIInfo)
} }
} }
} }
...@@ -61,7 +61,7 @@ Item { ...@@ -61,7 +61,7 @@ Item {
onClicked: { onClicked: {
if(activeVehicle) if(activeVehicle)
activeVehicle.stopGuidedModeROI() activeVehicle.stopGuidedModeROI()
mainWindow.hidePopUp() mainWindow.hideIndicatorPopup()
} }
} }
} }
...@@ -83,7 +83,7 @@ Item { ...@@ -83,7 +83,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, roiInfo) mainWindow.showIndicatorPopup(_root, roiInfo)
} }
} }
} }
...@@ -86,7 +86,7 @@ Item { ...@@ -86,7 +86,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
mainWindow.showPopUp(_root, telemRSSIInfo) mainWindow.showIndicatorPopup(_root, telemRSSIInfo)
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment