Unverified Commit 3c8fd695 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8967 from DonLakeFlyer/ViewDrawer

View change done using Drawer
parents d2f97086 6e280eeb
......@@ -16,10 +16,11 @@ Rectangle {
color: "transparent"
property string name
property color borderColor
property color borderColor: "red"
function logEverything() {
console.log(qsTr("%1 x:%2 y:%3 width:%4 height:%5 visible: %6 enabled: %7 z:%8 parent:%9 implicitWidth/Height:%10:%11", "Do not translate").arg(name).arg(parent.x).arg(parent.y).arg(parent.width).arg(parent.height).arg(parent.visible).arg(parent.enabled).arg(parent.z).arg(parent.parent))
console.log(qsTr("%1 x:%2 y:%3 width:%4 height:%5 visible:%6 enabled:%7 z:%8 parent:%9 implicitWidth/Height:%10:%11", "Do not translate")
.arg(name).arg(parent.x).arg(parent.y).arg(parent.width).arg(parent.height).arg(parent.visible).arg(parent.enabled).arg(parent.z).arg(parent.parent).arg(implicitHeight).arg(implicitWidth))
}
Component.onCompleted: logEverything()
......
......@@ -13,6 +13,7 @@ Button {
id: _rootButton
property bool setupComplete: true ///< true: setup complete indicator shows as completed
property bool setupIndicator: true ///< true: show setup complete indicator
property var imageColor: undefined
property string imageResource: "/qmlimages/subMenuButtonImage.png" ///< Button image
property size sourceSize: Qt.size(ScreenTools.defaultFontPixelHeight * 2, ScreenTools.defaultFontPixelHeight * 2)
......@@ -49,7 +50,7 @@ Button {
height: ScreenTools.defaultFontPixelHeight * 2
fillMode: Image.PreserveAspectFit
mipmap: true
color: control.setupComplete ? qgcPal.button : "red"
color: imageColor ? imageColor : (control.setupComplete ? qgcPal.button : "red")
source: control.imageResource
sourceSize: _rootButton.sourceSize
}
......
......@@ -3584,36 +3584,40 @@ QStringList Vehicle::unhealthySensors() const
struct sensorInfo_s {
uint32_t bit;
const char* sensorName;
QString sensorName;
};
static const sensorInfo_s rgSensorInfo[] = {
{ MAV_SYS_STATUS_SENSOR_3D_GYRO, "Gyro" },
{ MAV_SYS_STATUS_SENSOR_3D_ACCEL, "Accelerometer" },
{ MAV_SYS_STATUS_SENSOR_3D_MAG, "Magnetometer" },
{ MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE, "Absolute pressure" },
{ MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE, "Differential pressure" },
{ MAV_SYS_STATUS_SENSOR_GPS, "GPS" },
{ MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW, "Optical flow" },
{ MAV_SYS_STATUS_SENSOR_VISION_POSITION, "Computer vision position" },
{ MAV_SYS_STATUS_SENSOR_LASER_POSITION, "Laser based position" },
{ MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH, "External ground truth" },
{ MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL, "Angular rate control" },
{ MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION, "Attitude stabilization" },
{ MAV_SYS_STATUS_SENSOR_YAW_POSITION, "Yaw position" },
{ MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL, "Z/altitude control" },
{ MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL, "X/Y position control" },
{ MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS, "Motor outputs / control" },
{ MAV_SYS_STATUS_SENSOR_RC_RECEIVER, "RC receiver" },
{ MAV_SYS_STATUS_SENSOR_3D_GYRO2, "Gyro 2" },
{ MAV_SYS_STATUS_SENSOR_3D_ACCEL2, "Accelerometer 2" },
{ MAV_SYS_STATUS_SENSOR_3D_MAG2, "Magnetometer 2" },
{ MAV_SYS_STATUS_GEOFENCE, "GeoFence" },
{ MAV_SYS_STATUS_AHRS, "AHRS" },
{ MAV_SYS_STATUS_TERRAIN, "Terrain" },
{ MAV_SYS_STATUS_REVERSE_MOTOR, "Motors reversed" },
{ MAV_SYS_STATUS_LOGGING, "Logging" },
{ MAV_SYS_STATUS_SENSOR_BATTERY, "Battery" },
{ MAV_SYS_STATUS_SENSOR_3D_GYRO, tr("Gyro") },
{ MAV_SYS_STATUS_SENSOR_3D_ACCEL, tr("Accelerometer") },
{ MAV_SYS_STATUS_SENSOR_3D_MAG, tr("Magnetometer") },
{ MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE, tr("Absolute pressure") },
{ MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE, tr("Differential pressure") },
{ MAV_SYS_STATUS_SENSOR_GPS, tr("GPS") },
{ MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW, tr("Optical flow") },
{ MAV_SYS_STATUS_SENSOR_VISION_POSITION, tr("Computer vision position") },
{ MAV_SYS_STATUS_SENSOR_LASER_POSITION, tr("Laser based position") },
{ MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH, tr("External ground truth") },
{ MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL, tr("Angular rate control") },
{ MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION, tr("Attitude stabilization") },
{ MAV_SYS_STATUS_SENSOR_YAW_POSITION, tr("Yaw position") },
{ MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL, tr("Z/altitude control") },
{ MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL, tr("X/Y position control") },
{ MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS, tr("Motor outputs / control") },
{ MAV_SYS_STATUS_SENSOR_RC_RECEIVER, tr("RC receiver") },
{ MAV_SYS_STATUS_SENSOR_3D_GYRO2, tr("Gyro 2") },
{ MAV_SYS_STATUS_SENSOR_3D_ACCEL2, tr("Accelerometer 2") },
{ MAV_SYS_STATUS_SENSOR_3D_MAG2, tr("Magnetometer 2") },
{ MAV_SYS_STATUS_GEOFENCE, tr("GeoFence") },
{ MAV_SYS_STATUS_AHRS, tr("AHRS") },
{ MAV_SYS_STATUS_TERRAIN, tr("Terrain") },
{ MAV_SYS_STATUS_REVERSE_MOTOR, tr("Motors reversed") },
{ MAV_SYS_STATUS_LOGGING, tr("Logging") },
{ MAV_SYS_STATUS_SENSOR_BATTERY, tr("Battery") },
{ MAV_SYS_STATUS_SENSOR_PROXIMITY, tr("Proximity") },
{ MAV_SYS_STATUS_SENSOR_SATCOM, tr("Satellite Communication") },
{ MAV_SYS_STATUS_PREARM_CHECK, tr("Pre-Arm Check") },
{ MAV_SYS_STATUS_OBSTACLE_AVOIDANCE, tr("Avoidance/collision prevention") },
};
for (size_t i=0; i<sizeof(rgSensorInfo)/sizeof(sensorInfo_s); i++) {
......
......@@ -325,6 +325,164 @@ ApplicationWindow {
visible: QGroundControl.settingsManager.flyViewSettings.showLogReplayStatusBar.rawValue
}
Drawer {
id: viewSelectDrawer
height: mainWindow.height
edge: Qt.LeftEdge
interactive: true
dragMargin: 0
visible: false
property var _mainWindow: mainWindow
property real _toolButtonHeight: ScreenTools.defaultFontPixelHeight * 3
Rectangle {
width: mainLayout.width + (mainLayout.anchors.margins * 2)
height: parent.height
color: qgcPal.window
QGCFlickable {
anchors.top: parent.top
anchors.bottom: qgcVersionLayout.top
anchors.left: parent.left
anchors.right: parent.right
contentHeight: mainLayout.height + (mainLayout.anchors.margins * 2)
flickableDirection: QGCFlickable.VerticalFlick
ColumnLayout {
id: mainLayout
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
SubMenuButton {
id: flyButton
height: viewSelectDrawer._toolButtonHeight
Layout.fillWidth: true
text: qsTr("Fly View")
imageResource: "/qmlimages/PaperPlane.svg"
imageColor: qgcPal.text
onClicked: {
if (toolbar.viewButtonClicked(this)) {
mainWindow.showFlyView()
}
}
}
SubMenuButton {
id: planButton
height: viewSelectDrawer._toolButtonHeight
Layout.fillWidth: true
text: qsTr("Plan View")
imageResource: "/qmlimages/Plan.svg"
imageColor: qgcPal.text
onClicked: {
if (toolbar.viewButtonClicked(this)) {
mainWindow.showPlanView()
}
}
}
SubMenuButton {
id: analyzeButton
height: viewSelectDrawer._toolButtonHeight
Layout.fillWidth: true
text: qsTr("Analyze Tools")
imageResource: "/qmlimages/Analyze.svg"
imageColor: qgcPal.text
visible: QGroundControl.corePlugin.showAdvancedUI
onClicked: {
if (toolbar.viewButtonClicked(this)) {
mainWindow.showAnalyzeView()
}
}
}
SubMenuButton {
id: setupButton
height: viewSelectDrawer._toolButtonHeight
Layout.fillWidth: true
text: qsTr("Vehicle Setup")
imageColor: qgcPal.text
imageResource: "/qmlimages/Gears.svg"
onClicked: {
if (toolbar.viewButtonClicked(this)) {
mainWindow.showSetupView()
}
}
}
SubMenuButton {
id: settingsButton
height: viewSelectDrawer._toolButtonHeight
Layout.fillWidth: true
text: qsTr("Application Settings")
imageResource: "/res/QGCLogoFull"
imageColor: "transparent"
visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup
onClicked: {
if (toolbar.viewButtonClicked(this)) {
mainWindow.showSettingsView()
}
}
}
}
}
ColumnLayout {
id: qgcVersionLayout
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: 0
QGCLabel {
text: qsTr("%1 Version").arg(QGroundControl.appName)
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WordWrap
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignHCenter
}
QGCLabel {
text: QGroundControl.qgcVersion
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: QGCLabel.WrapAnywhere
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignHCenter
}
}
QGCMouseArea {
anchors.fill: qgcVersionLayout
onClicked: {
if (mouse.modifiers & Qt.ShiftModifier) {
QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas
} else {
if(!QGroundControl.corePlugin.showAdvancedUI) {
advancedModeConfirmation.open()
} else {
QGroundControl.corePlugin.showAdvancedUI = false
}
}
}
MessageDialog {
id: advancedModeConfirmation
title: qsTr("Advanced Mode")
text: QGroundControl.corePlugin.showAdvancedUIMessage
standardButtons: StandardButton.Yes | StandardButton.No
onYes: {
QGroundControl.corePlugin.showAdvancedUI = true
advancedModeConfirmation.close()
}
}
}
}
}
//-------------------------------------------------------------------------
/// Fly View
FlyView {
......
......@@ -32,16 +32,15 @@ Rectangle {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _communicationLost: _activeVehicle ? _activeVehicle.connectionLost : false
Component.onCompleted: _viewButtonClicked(flyButton)
Component.onCompleted: toolbar.viewButtonClicked(flyButton)
function _viewButtonClicked(button) {
function viewButtonClicked(button) {
if (mainWindow.preventViewSwitch()) {
return false
}
viewButtonSelectRow.visible = false
buttonSelectHideTimer.stop()
currentButton.icon.source = button.icon.source
currentButton.logo = button.logo
viewSelectDrawer.visible = false
currentButton.icon.source = button.imageResource
currentButton.logo = button.imageColor == "transparent"
return true
}
......@@ -50,7 +49,7 @@ Rectangle {
target: setupWindow
onVisibleChanged: {
if (setupWindow.visible) {
_viewButtonClicked(setupButton)
toolbar.viewButtonClicked(setupButton)
}
}
}
......@@ -77,122 +76,7 @@ Rectangle {
QGCToolBarButton {
id: currentButton
Layout.fillHeight: true
visible: !viewButtonSelectRow.visible
onClicked: {
viewButtonSelectRow.visible = !viewButtonSelectRow.visible
if (viewButtonSelectRow.visible) {
buttonSelectHideTimer.start()
} else {
buttonSelectHideTimer.stop()
}
}
}
//---------------------------------------------
// Toolbar Row
RowLayout {
id: viewButtonSelectRow
Layout.fillHeight: true
spacing: 0
visible: false
Timer {
id: buttonSelectHideTimer
interval: 5000
repeat: false
onTriggered: viewButtonSelectRow.visible = false
}
QGCToolBarButton {
id: settingsButton
Layout.fillHeight: true
icon.source: "/res/QGCLogoFull"
logo: true
visible: !QGroundControl.corePlugin.options.combineSettingsAndSetup
onClicked: {
if (_viewButtonClicked(this)) {
mainWindow.showSettingsView()
}
}
}
QGCToolBarButton {
id: setupButton
Layout.fillHeight: true
icon.source: "/qmlimages/Gears.svg"
onClicked: {
if (_viewButtonClicked(this)) {
mainWindow.showSetupView()
}
}
}
QGCToolBarButton {
id: planButton
Layout.fillHeight: true
icon.source: "/qmlimages/Plan.svg"
onClicked: {
if (_viewButtonClicked(this)) {
mainWindow.showPlanView()
}
}
}
QGCToolBarButton {
id: flyButton
Layout.fillHeight: true
icon.source: "/qmlimages/PaperPlane.svg"
onClicked: {
if (_viewButtonClicked(this)) {
mainWindow.showFlyView()
// Easter Egg mechanism
_clickCount++
eggTimer.restart()
if (_clickCount == 5) {
if(!QGroundControl.corePlugin.showAdvancedUI) {
advancedModeConfirmation.open()
} else {
QGroundControl.corePlugin.showAdvancedUI = false
}
} else if (_clickCount == 7) {
QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas
}
}
}
property int _clickCount: 0
Timer {
id: eggTimer
interval: 1000
repeat: false
onTriggered: parent._clickCount = 0
}
MessageDialog {
id: advancedModeConfirmation
title: qsTr("Advanced Mode")
text: QGroundControl.corePlugin.showAdvancedUIMessage
standardButtons: StandardButton.Yes | StandardButton.No
onYes: {
QGroundControl.corePlugin.showAdvancedUI = true
advancedModeConfirmation.close()
}
}
}
QGCToolBarButton {
id: analyzeButton
Layout.fillHeight: true
icon.source: "/qmlimages/Analyze.svg"
visible: QGroundControl.corePlugin.showAdvancedUI
onClicked: {
if (_viewButtonClicked(this)) {
mainWindow.showAnalyzeView()
}
}
}
onClicked: viewSelectDrawer.visible = true
}
}
......
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