Commit 865a47fe authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #4920 from dogmaphobic/flyviewOverlay

Flyview overlay
parents 799780bd 6b431672
......@@ -114,6 +114,9 @@ QGCView {
Component.onCompleted: {
setStates()
px4JoystickCheck()
if(QGroundControl.corePlugin.options.flyViewOverlay.toString().length) {
flyViewOverlay.source = QGroundControl.corePlugin.options.flyViewOverlay
}
}
QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true }
......@@ -157,6 +160,7 @@ QGCView {
flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
qgcView: root
scaleState: (_mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode"
}
}
......@@ -259,6 +263,17 @@ QGCView {
visible: singleVehicleView.checked
}
//-------------------------------------------------------------------------
//-- Loader helper for plugins to overlay elements over the fly view
Loader {
id: flyViewOverlay
z: flightDisplayViewWidgets.z + 1
height: ScreenTools.availableHeight
anchors.left: parent.left
anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
anchors.bottom: parent.bottom
}
// Button to start/stop video recording
Item {
z: _flightVideoPipControl.z + 1
......
......@@ -30,6 +30,8 @@ FlightMap {
allowGCSLocationCenter: !userPanned
allowVehicleLocationCenter: !_keepVehicleCentered
property alias scaleState: mapScale.state
property var missionController
property var guidedActionsController
property var flightWidgets
......@@ -299,11 +301,31 @@ FlightMap {
}
MapScale {
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * (0.66)
anchors.rightMargin: ScreenTools.defaultFontPixelHeight * (0.33)
anchors.bottom: parent.bottom
id: mapScale
anchors.right: parent.right
anchors.margins: ScreenTools.defaultFontPixelHeight * (0.33)
anchors.topMargin: ScreenTools.defaultFontPixelHeight * (0.33) + state === "bottomMode" ? 0 : ScreenTools.toolbarHeight
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * (0.33)
mapControl: flightMap
visible: !ScreenTools.isTinyScreen
state: "bottomMode"
states: [
State {
name: "topMode"
AnchorChanges {
target: mapScale
anchors.top: parent.top
anchors.bottom: undefined
}
},
State {
name: "bottomMode"
AnchorChanges {
target: mapScale
anchors.top: undefined
anchors.bottom: parent.bottom
}
}
]
}
}
......@@ -47,29 +47,33 @@ Item {
}
function _setInstrumentWidget() {
if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) {
instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source
switch(QGroundControl.corePlugin.options.instrumentWidget.widgetPosition) {
case CustomInstrumentWidget.POS_TOP_RIGHT:
instrumentsLoader.state = "topMode"
break;
case CustomInstrumentWidget.POS_BOTTOM_RIGHT:
instrumentsLoader.state = "bottomMode"
break;
case CustomInstrumentWidget.POS_CENTER_RIGHT:
default:
instrumentsLoader.state = "centerMode"
break;
}
} else {
var useAlternateInstruments = QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
if(useAlternateInstruments) {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
instrumentsLoader.state = "topMode"
if(QGroundControl.corePlugin.options.instrumentWidget) {
if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) {
instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source
switch(QGroundControl.corePlugin.options.instrumentWidget.widgetPosition) {
case CustomInstrumentWidget.POS_TOP_RIGHT:
instrumentsLoader.state = "topMode"
break;
case CustomInstrumentWidget.POS_BOTTOM_RIGHT:
instrumentsLoader.state = "bottomMode"
break;
case CustomInstrumentWidget.POS_CENTER_RIGHT:
default:
instrumentsLoader.state = "centerMode"
break;
}
} else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
instrumentsLoader.state = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode"
var useAlternateInstruments = QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
if(useAlternateInstruments) {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
instrumentsLoader.state = "topMode"
} else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
instrumentsLoader.state = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode"
}
}
} else {
instrumentsLoader.source = ""
}
}
......
......@@ -19,6 +19,7 @@ Rectangle {
z: toolBar.z + 1
color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75)
visible: false
anchors.bottomMargin: 1
signal showFlyView
......@@ -79,13 +80,11 @@ Rectangle {
onReleased: { mouse.accepted = true; }
}
RowLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: uploadButton.visible ? uploadButton.left : uploadButton.right
spacing: ScreenTools.defaultFontPixelWidth * 2
Row {
anchors.bottomMargin: 1
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
QGCToolBarButton {
id: settingsButton
anchors.top: parent.top
......@@ -93,7 +92,6 @@ Rectangle {
source: "/qmlimages/PaperPlane.svg"
logo: true
checked: false
onClicked: {
checked = false
if (missionController.uploadOnSwitch()) {
......@@ -101,6 +99,14 @@ Rectangle {
}
}
}
}
Row {
anchors.top: parent.top
anchors.bottom: parent.bottom
spacing: _margins * 2
anchors.horizontalCenter: parent.horizontalCenter
GridLayout {
anchors.verticalCenter: parent.verticalCenter
......
......@@ -70,7 +70,7 @@ Item {
property real implicitTextFieldHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6))
property real implicitComboBoxHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6))
property real implicitComboBoxWidth: Math.round(defaultFontPixelWidth * (isMobile ? 7.0 : 5.0))
property real implicitSliderHeight: isMobile ? Math.Max(defaultFontPixelHeight, minTouchPixels) : defaultFontPixelHeight
property real implicitSliderHeight: isMobile ? Math.max(defaultFontPixelHeight, minTouchPixels) : defaultFontPixelHeight
readonly property string normalFontFamily: "opensans"
readonly property string demiboldFontFamily: "opensans-demibold"
......
......@@ -1043,8 +1043,8 @@ QGCView {
anchors.horizontalCenter: parent.horizontalCenter
}
BusyIndicator {
visible: QGroundControl.mapEngineManager.exporting
running: QGroundControl.mapEngineManager.exporting
visible: QGroundControl.mapEngineManager ? QGroundControl.mapEngineManager.exporting : false
running: QGroundControl.mapEngineManager ? QGroundControl.mapEngineManager.exporting : false
width: exportCloseButton.height
height: exportCloseButton.height
anchors.horizontalCenter: parent.horizontalCenter
......@@ -1072,7 +1072,7 @@ QGCView {
color: "black"
anchors.centerIn: parent
Rectangle {
width: parent.width * 0.45
width: parent.width * 0.5
height: importCol.height * 1.5
radius: ScreenTools.defaultFontPixelWidth
color: qgcPal.windowShadeDark
......
......@@ -28,6 +28,7 @@ public:
Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT)
Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT)
Q_PROPERTY(CustomInstrumentWidget* instrumentWidget READ instrumentWidget CONSTANT)
Q_PROPERTY(QUrl flyViewOverlay READ flyViewOverlay CONSTANT)
Q_PROPERTY(bool showSensorCalibrationCompass READ showSensorCalibrationCompass NOTIFY showSensorCalibrationCompassChanged)
Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged)
Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged)
......@@ -56,6 +57,8 @@ public:
/// @return An alternate widget (see QGCInstrumentWidget.qml, the default widget)
virtual CustomInstrumentWidget* instrumentWidget();
/// Allows access to the full fly view window
virtual QUrl flyViewOverlay () const { return QUrl(); }
/// By returning false you can hide the following sensor calibration pages
virtual bool showSensorCalibrationCompass () const { return true; }
virtual bool showSensorCalibrationGyro () const { return true; }
......@@ -82,7 +85,7 @@ signals:
void showSensorCalibrationLevelChanged (bool show);
void showSensorCalibrationAirspeedChanged (bool show);
void showFirmwareUpgradeChanged (bool show);
void guidedBarShowEmergencyStopChanged (bool show);
void guidedBarShowEmergencyStopChanged (bool show);
void guidedBarShowOrbitChanged (bool show);
private:
......
......@@ -47,6 +47,14 @@ Item {
}
}
function disableToolbar() {
toolbarBlocker.enabled = true
}
function enableToolbar() {
toolbarBlocker.enabled = false
}
function hideAllViews() {
for (var i=0; i<_viewList.length; i++) {
_viewList[i].visible = false
......@@ -55,6 +63,7 @@ Item {
}
function showSettingsView() {
rootLoader.sourceComponent = null
if(currentPopUp) {
currentPopUp.close()
}
......@@ -69,6 +78,7 @@ Item {
}
function showSetupView() {
rootLoader.sourceComponent = null
if(currentPopUp) {
currentPopUp.close()
}
......@@ -83,6 +93,7 @@ Item {
}
function showPlanView() {
rootLoader.sourceComponent = null
if(currentPopUp) {
currentPopUp.close()
}
......@@ -96,6 +107,7 @@ Item {
}
function showFlyView() {
rootLoader.sourceComponent = null
if(currentPopUp) {
currentPopUp.close()
}
......@@ -106,6 +118,7 @@ Item {
}
function showAnalyzeView() {
rootLoader.sourceComponent = null
if(currentPopUp) {
currentPopUp.close()
}
......@@ -206,30 +219,40 @@ Item {
}
function showMessageArea() {
rootLoader.sourceComponent = null
var currentlyVisible = messageArea.visible
if(currentPopUp) {
currentPopUp.close()
}
if(QGroundControl.multiVehicleManager.activeVehicleAvailable) {
messageText.text = formatMessage(activeVehicle.formatedMessages)
//-- Hack to scroll to last message
for (var i = 0; i < activeVehicle.messageCount; i++)
messageFlick.flick(0,-5000)
activeVehicle.resetMessages()
} else {
messageText.text = qsTr("No Messages")
if(!currentlyVisible) {
if(QGroundControl.multiVehicleManager.activeVehicleAvailable) {
messageText.text = formatMessage(activeVehicle.formatedMessages)
//-- Hack to scroll to last message
for (var i = 0; i < activeVehicle.messageCount; i++)
messageFlick.flick(0,-5000)
activeVehicle.resetMessages()
} else {
messageText.text = qsTr("No Messages")
}
currentPopUp = messageArea
messageArea.visible = true
}
currentPopUp = messageArea
messageArea.visible = true
}
function showPopUp(dropItem, centerX) {
rootLoader.sourceComponent = null
var oldIndicator = indicatorDropdown.sourceComponent
if(currentPopUp) {
currentPopUp.close()
}
indicatorDropdown.centerX = centerX
indicatorDropdown.sourceComponent = dropItem
indicatorDropdown.visible = true
currentPopUp = indicatorDropdown
if(oldIndicator !== dropItem) {
console.log(oldIndicator)
console.log(dropItem)
indicatorDropdown.centerX = centerX
indicatorDropdown.sourceComponent = dropItem
indicatorDropdown.visible = true
currentPopUp = indicatorDropdown
}
}
//-- Main UI
......@@ -242,13 +265,21 @@ Item {
anchors.top: parent.top
opacity: planToolBar.visible ? 0 : 1
z: QGroundControl.zOrderTopMost
Component.onCompleted: ScreenTools.availableHeight = parent.height - toolBar.height
onShowSettingsView: mainWindow.showSettingsView()
onShowSetupView: mainWindow.showSetupView()
onShowPlanView: mainWindow.showPlanView()
onShowFlyView: mainWindow.showFlyView()
onShowAnalyzeView: mainWindow.showAnalyzeView()
//-- Entire tool bar area disable on cammand
MouseArea {
id: toolbarBlocker
anchors.fill: parent
enabled: false
onWheel: { wheel.accepted = true; }
onPressed: { mouse.accepted = true; }
onReleased: { mouse.accepted = true; }
}
}
PlanToolBar {
......
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