Commit b168706b authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5529 from bluerobotics/pr-vehicle-setup-armed-transition-jacob

Rework disabling of setup pages
parents d0946f6b 732cfc1a
...@@ -22,6 +22,7 @@ import QGroundControl.ScreenTools 1.0 ...@@ -22,6 +22,7 @@ import QGroundControl.ScreenTools 1.0
SetupPage { SetupPage {
id: safetyPage id: safetyPage
pageComponent: safetyPageComponent pageComponent: safetyPageComponent
visibleWhileArmed: true
Component { Component {
id: safetyPageComponent id: safetyPageComponent
......
...@@ -32,8 +32,51 @@ QGCView { ...@@ -32,8 +32,51 @@ QGCView {
property real _margins: ScreenTools.defaultFontPixelHeight / 2 property real _margins: ScreenTools.defaultFontPixelHeight / 2
property bool visibleWhileArmed: false
property bool vehicleArmed: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.armed : false
onVehicleArmedChanged: {
if (visibleWhileArmed) {
return
}
if (vehicleArmed) {
disabledWhileArmed.visible = true
setupView.viewPanel.enabled = false
} else {
disabledWhileArmed.visible = false
setupView.viewPanel.enabled = true
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: setupPanel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: setupPanel.enabled }
// Overlay to display when vehicle is armed and the setup page needs
// to be disabled
Item {
id: disabledWhileArmed
visible: false
z: 9999
anchors.fill: parent
Rectangle {
anchors.fill: parent
color: "black"
opacity: 0.5
}
QGCLabel {
anchors.margins: defaultTextWidth * 2
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.largeFontPointSize
color: "red"
text: "Setup disabled while the vehicle is armed"
}
}
QGCViewPanel { QGCViewPanel {
id: setupPanel id: setupPanel
anchors.fill: parent anchors.fill: parent
...@@ -68,7 +111,6 @@ QGCView { ...@@ -68,7 +111,6 @@ QGCView {
id: pageLoader id: pageLoader
anchors.topMargin: _margins anchors.topMargin: _margins
anchors.top: headingColumn.bottom anchors.top: headingColumn.bottom
} }
} }
} }
......
...@@ -12,6 +12,7 @@ import QtQuick 2.3 ...@@ -12,6 +12,7 @@ import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
...@@ -21,16 +22,26 @@ import QGroundControl.Palette 1.0 ...@@ -21,16 +22,26 @@ import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
QGCView { SetupPage {
id: qgcView id: firmwarePage
viewPanel: panel pageComponent: firmwarePageComponent
pageName: "Firmware" // For building setup page title: 'Firmware Setup'
Component {
id: firmwarePageComponent
ColumnLayout {
width: availableWidth
height: availableHeight
spacing: ScreenTools.defaultFontPixelHeight
// Those user visible strings are hard to translate because we can't send the // Those user visible strings are hard to translate because we can't send the
// HTML strings to translation as this can create a security risk. we need to find // HTML strings to translation as this can create a security risk. we need to find
// a better way to hightlight them, or use less hightlights. // a better way to hightlight them, or use less highlights.
// User visible strings // User visible strings
readonly property string title: "FIRMWARE" readonly property string title: "Firmware Setup" // Popup dialog title
readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">" readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
readonly property string highlightSuffix: "</font>" readonly property string highlightSuffix: "</font>"
readonly property string welcomeText: qsTr("%1 can upgrade the firmware on Pixhawk devices, SiK Radios and PX4 Flow Smart Cameras.").arg(QGroundControl.appName) readonly property string welcomeText: qsTr("%1 can upgrade the firmware on Pixhawk devices, SiK Radios and PX4 Flow Smart Cameras.").arg(QGroundControl.appName)
...@@ -117,7 +128,7 @@ QGCView { ...@@ -117,7 +128,7 @@ QGCView {
} }
} }
onCompleted: { Component.onCompleted: {
if (controllerCompleted) { if (controllerCompleted) {
// We can only start the board search when the Qml and Controller are completely done loading // We can only start the board search when the Qml and Controller are completely done loading
controller.startBoardSearch() controller.startBoardSearch()
...@@ -386,29 +397,15 @@ QGCView { ...@@ -386,29 +397,15 @@ QGCView {
} }
} }
QGCViewPanel {
id: panel
anchors.fill: parent
QGCLabel {
id: titleLabel
text: title
font.pointSize: ScreenTools.mediumFontPointSize
}
ProgressBar { ProgressBar {
id: progressBar id: progressBar
anchors.topMargin: ScreenTools.defaultFontPixelHeight Layout.preferredWidth: parent.width
anchors.top: titleLabel.bottom
width: parent.width
} }
TextArea { TextArea {
id: statusTextArea id: statusTextArea
anchors.topMargin: ScreenTools.defaultFontPixelHeight Layout.preferredWidth: parent.width
anchors.top: progressBar.bottom Layout.fillHeight: true
anchors.bottom: parent.bottom
width: parent.width
readOnly: true readOnly: true
frameVisible: false frameVisible: false
font.pointSize: ScreenTools.defaultFontPointSize font.pointSize: ScreenTools.defaultFontPointSize
...@@ -420,5 +417,6 @@ QGCView { ...@@ -420,5 +417,6 @@ QGCView {
backgroundColor: qgcPal.windowShade backgroundColor: qgcPal.windowShade
} }
} }
} // QGCViewPabel } // ColumnLayout
} // QGCView } // Component
} // SetupPage
...@@ -56,24 +56,14 @@ Rectangle { ...@@ -56,24 +56,14 @@ Rectangle {
function showFirmwarePanel() function showFirmwarePanel()
{ {
if (!ScreenTools.isMobile) { if (!ScreenTools.isMobile) {
if (QGroundControl.multiVehicleManager.activeVehicleAvailable && QGroundControl.multiVehicleManager.activeVehicle.armed) {
_messagePanelText = _armedVehicleText
panelLoader.setSourceComponent(messagePanelComponent)
} else {
panelLoader.setSource("FirmwareUpgrade.qml") panelLoader.setSource("FirmwareUpgrade.qml")
} }
} }
}
function showJoystickPanel() function showJoystickPanel()
{ {
if (QGroundControl.multiVehicleManager.activeVehicleAvailable && QGroundControl.multiVehicleManager.activeVehicle.armed) {
_messagePanelText = _armedVehicleText
panelLoader.setSourceComponent(messagePanelComponent)
} else {
panelLoader.setSource("JoystickConfig.qml") panelLoader.setSource("JoystickConfig.qml")
} }
}
function showParametersPanel() function showParametersPanel()
{ {
...@@ -87,14 +77,10 @@ Rectangle { ...@@ -87,14 +77,10 @@ Rectangle {
function showVehicleComponentPanel(vehicleComponent) function showVehicleComponentPanel(vehicleComponent)
{ {
if (QGroundControl.multiVehicleManager.activeVehicle.armed && !vehicleComponent.allowSetupWhileArmed) {
_messagePanelText = _armedVehicleText
panelLoader.setSourceComponent(messagePanelComponent)
} else {
var autopilotPlugin = QGroundControl.multiVehicleManager.activeVehicle.autopilot var autopilotPlugin = QGroundControl.multiVehicleManager.activeVehicle.autopilot
var prereq = autopilotPlugin.prerequisiteSetup(vehicleComponent) var prereq = autopilotPlugin.prerequisiteSetup(vehicleComponent)
if (prereq !== "") { if (prereq !== "") {
//-- TODO: This cannot be trasnlated when built this way. //-- TODO: This cannot be translated when built this way.
_messagePanelText = prereq + " setup must be completed prior to " + vehicleComponent.name + " setup." _messagePanelText = prereq + " setup must be completed prior to " + vehicleComponent.name + " setup."
panelLoader.setSourceComponent(messagePanelComponent) panelLoader.setSourceComponent(messagePanelComponent)
} else { } else {
...@@ -108,7 +94,6 @@ Rectangle { ...@@ -108,7 +94,6 @@ Rectangle {
} }
} }
} }
}
Component.onCompleted: showSummaryPanel() Component.onCompleted: showSummaryPanel()
...@@ -170,6 +155,7 @@ Rectangle { ...@@ -170,6 +155,7 @@ Rectangle {
} }
} }
} }
Component { Component {
id: missingParametersVehicleSummaryComponent id: missingParametersVehicleSummaryComponent
......
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