Commit ce911c01 authored by Gus Grubba's avatar Gus Grubba

Enable (custom) Fly View overlay

Added top/bottom alignment state to map scale
Allow disabling instrument widget altogether
Added an otherwise redundant row to PlanToolbar so it matches the same button position as the main toolbar
Fixed typo (Math.max()) in ScreenTools
Fixed Javascript Exception in OfflineMap
Increased the import window size in OfflineMap
Added function to MainWindow to disable toolbar for a truly modal dialog
Added code so clicking on an open toolbar indicator will cause it to close
parent eaaeab0c
...@@ -114,6 +114,9 @@ QGCView { ...@@ -114,6 +114,9 @@ QGCView {
Component.onCompleted: { Component.onCompleted: {
setStates() setStates()
px4JoystickCheck() px4JoystickCheck()
if(QGroundControl.corePlugin.options.flyViewOverlay.toString().length) {
flyViewOverlay.source = QGroundControl.corePlugin.options.flyViewOverlay
}
} }
QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true } QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true }
...@@ -157,6 +160,7 @@ QGCView { ...@@ -157,6 +160,7 @@ QGCView {
flightWidgets: flightDisplayViewWidgets flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
qgcView: root qgcView: root
scaleState: (_mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode"
} }
} }
...@@ -259,6 +263,17 @@ QGCView { ...@@ -259,6 +263,17 @@ QGCView {
visible: singleVehicleView.checked 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 // Button to start/stop video recording
Item { Item {
z: _flightVideoPipControl.z + 1 z: _flightVideoPipControl.z + 1
......
...@@ -30,6 +30,8 @@ FlightMap { ...@@ -30,6 +30,8 @@ FlightMap {
allowGCSLocationCenter: !userPanned allowGCSLocationCenter: !userPanned
allowVehicleLocationCenter: !_keepVehicleCentered allowVehicleLocationCenter: !_keepVehicleCentered
property alias scaleState: mapScale.state
property var missionController property var missionController
property var guidedActionsController property var guidedActionsController
property var flightWidgets property var flightWidgets
...@@ -299,11 +301,31 @@ FlightMap { ...@@ -299,11 +301,31 @@ FlightMap {
} }
MapScale { MapScale {
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * (0.66) id: mapScale
anchors.rightMargin: ScreenTools.defaultFontPixelHeight * (0.33)
anchors.bottom: parent.bottom
anchors.right: parent.right 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 mapControl: flightMap
visible: !ScreenTools.isTinyScreen 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 { ...@@ -47,29 +47,33 @@ Item {
} }
function _setInstrumentWidget() { function _setInstrumentWidget() {
if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) { if(QGroundControl.corePlugin.options.instrumentWidget) {
instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) {
switch(QGroundControl.corePlugin.options.instrumentWidget.widgetPosition) { instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source
case CustomInstrumentWidget.POS_TOP_RIGHT: switch(QGroundControl.corePlugin.options.instrumentWidget.widgetPosition) {
instrumentsLoader.state = "topMode" case CustomInstrumentWidget.POS_TOP_RIGHT:
break; instrumentsLoader.state = "topMode"
case CustomInstrumentWidget.POS_BOTTOM_RIGHT: break;
instrumentsLoader.state = "bottomMode" case CustomInstrumentWidget.POS_BOTTOM_RIGHT:
break; instrumentsLoader.state = "bottomMode"
case CustomInstrumentWidget.POS_CENTER_RIGHT: break;
default: case CustomInstrumentWidget.POS_CENTER_RIGHT:
instrumentsLoader.state = "centerMode" default:
break; 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"
} else { } else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml" var useAlternateInstruments = QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
instrumentsLoader.state = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode" 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 { ...@@ -19,6 +19,7 @@ Rectangle {
z: toolBar.z + 1 z: toolBar.z + 1
color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75) color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75)
visible: false visible: false
anchors.bottomMargin: 1
signal showFlyView signal showFlyView
...@@ -79,13 +80,11 @@ Rectangle { ...@@ -79,13 +80,11 @@ Rectangle {
onReleased: { mouse.accepted = true; } onReleased: { mouse.accepted = true; }
} }
RowLayout { Row {
anchors.top: parent.top anchors.bottomMargin: 1
anchors.bottom: parent.bottom anchors.left: parent.left
anchors.left: parent.left anchors.top: parent.top
anchors.right: uploadButton.visible ? uploadButton.left : uploadButton.right anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelWidth * 2
QGCToolBarButton { QGCToolBarButton {
id: settingsButton id: settingsButton
anchors.top: parent.top anchors.top: parent.top
...@@ -93,7 +92,6 @@ Rectangle { ...@@ -93,7 +92,6 @@ Rectangle {
source: "/qmlimages/PaperPlane.svg" source: "/qmlimages/PaperPlane.svg"
logo: true logo: true
checked: false checked: false
onClicked: { onClicked: {
checked = false checked = false
if (missionController.uploadOnSwitch()) { if (missionController.uploadOnSwitch()) {
...@@ -101,6 +99,14 @@ Rectangle { ...@@ -101,6 +99,14 @@ Rectangle {
} }
} }
} }
}
Row {
anchors.top: parent.top
anchors.bottom: parent.bottom
spacing: _margins * 2
anchors.horizontalCenter: parent.horizontalCenter
GridLayout { GridLayout {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
......
...@@ -70,7 +70,7 @@ Item { ...@@ -70,7 +70,7 @@ Item {
property real implicitTextFieldHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6)) property real implicitTextFieldHeight: Math.round(defaultFontPixelHeight * (isMobile ? 2.0 : 1.6))
property real implicitComboBoxHeight: 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 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 normalFontFamily: "opensans"
readonly property string demiboldFontFamily: "opensans-demibold" readonly property string demiboldFontFamily: "opensans-demibold"
......
...@@ -1043,8 +1043,8 @@ QGCView { ...@@ -1043,8 +1043,8 @@ QGCView {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
BusyIndicator { BusyIndicator {
visible: QGroundControl.mapEngineManager.exporting visible: QGroundControl.mapEngineManager ? QGroundControl.mapEngineManager.exporting : false
running: QGroundControl.mapEngineManager.exporting running: QGroundControl.mapEngineManager ? QGroundControl.mapEngineManager.exporting : false
width: exportCloseButton.height width: exportCloseButton.height
height: exportCloseButton.height height: exportCloseButton.height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
...@@ -1072,7 +1072,7 @@ QGCView { ...@@ -1072,7 +1072,7 @@ QGCView {
color: "black" color: "black"
anchors.centerIn: parent anchors.centerIn: parent
Rectangle { Rectangle {
width: parent.width * 0.45 width: parent.width * 0.5
height: importCol.height * 1.5 height: importCol.height * 1.5
radius: ScreenTools.defaultFontPixelWidth radius: ScreenTools.defaultFontPixelWidth
color: qgcPal.windowShadeDark color: qgcPal.windowShadeDark
......
...@@ -28,6 +28,7 @@ public: ...@@ -28,6 +28,7 @@ public:
Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT) Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT)
Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT) Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT)
Q_PROPERTY(CustomInstrumentWidget* instrumentWidget READ instrumentWidget 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 showSensorCalibrationCompass READ showSensorCalibrationCompass NOTIFY showSensorCalibrationCompassChanged)
Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged) Q_PROPERTY(bool showSensorCalibrationGyro READ showSensorCalibrationGyro NOTIFY showSensorCalibrationGyroChanged)
Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged) Q_PROPERTY(bool showSensorCalibrationAccel READ showSensorCalibrationAccel NOTIFY showSensorCalibrationAccelChanged)
...@@ -56,6 +57,8 @@ public: ...@@ -56,6 +57,8 @@ public:
/// @return An alternate widget (see QGCInstrumentWidget.qml, the default widget) /// @return An alternate widget (see QGCInstrumentWidget.qml, the default widget)
virtual CustomInstrumentWidget* instrumentWidget(); 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 /// By returning false you can hide the following sensor calibration pages
virtual bool showSensorCalibrationCompass () const { return true; } virtual bool showSensorCalibrationCompass () const { return true; }
virtual bool showSensorCalibrationGyro () const { return true; } virtual bool showSensorCalibrationGyro () const { return true; }
...@@ -82,7 +85,7 @@ signals: ...@@ -82,7 +85,7 @@ signals:
void showSensorCalibrationLevelChanged (bool show); void showSensorCalibrationLevelChanged (bool show);
void showSensorCalibrationAirspeedChanged (bool show); void showSensorCalibrationAirspeedChanged (bool show);
void showFirmwareUpgradeChanged (bool show); void showFirmwareUpgradeChanged (bool show);
void guidedBarShowEmergencyStopChanged (bool show); void guidedBarShowEmergencyStopChanged (bool show);
void guidedBarShowOrbitChanged (bool show); void guidedBarShowOrbitChanged (bool show);
private: private:
......
...@@ -47,6 +47,14 @@ Item { ...@@ -47,6 +47,14 @@ Item {
} }
} }
function disableToolbar() {
toolbarBlocker.enabled = true
}
function enableToolbar() {
toolbarBlocker.enabled = false
}
function hideAllViews() { function hideAllViews() {
for (var i=0; i<_viewList.length; i++) { for (var i=0; i<_viewList.length; i++) {
_viewList[i].visible = false _viewList[i].visible = false
...@@ -55,6 +63,7 @@ Item { ...@@ -55,6 +63,7 @@ Item {
} }
function showSettingsView() { function showSettingsView() {
rootLoader.sourceComponent = null
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
...@@ -69,6 +78,7 @@ Item { ...@@ -69,6 +78,7 @@ Item {
} }
function showSetupView() { function showSetupView() {
rootLoader.sourceComponent = null
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
...@@ -83,6 +93,7 @@ Item { ...@@ -83,6 +93,7 @@ Item {
} }
function showPlanView() { function showPlanView() {
rootLoader.sourceComponent = null
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
...@@ -96,6 +107,7 @@ Item { ...@@ -96,6 +107,7 @@ Item {
} }
function showFlyView() { function showFlyView() {
rootLoader.sourceComponent = null
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
...@@ -106,6 +118,7 @@ Item { ...@@ -106,6 +118,7 @@ Item {
} }
function showAnalyzeView() { function showAnalyzeView() {
rootLoader.sourceComponent = null
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
...@@ -206,30 +219,40 @@ Item { ...@@ -206,30 +219,40 @@ Item {
} }
function showMessageArea() { function showMessageArea() {
rootLoader.sourceComponent = null
var currentlyVisible = messageArea.visible
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
if(QGroundControl.multiVehicleManager.activeVehicleAvailable) { if(!currentlyVisible) {
messageText.text = formatMessage(activeVehicle.formatedMessages) if(QGroundControl.multiVehicleManager.activeVehicleAvailable) {
//-- Hack to scroll to last message messageText.text = formatMessage(activeVehicle.formatedMessages)
for (var i = 0; i < activeVehicle.messageCount; i++) //-- Hack to scroll to last message
messageFlick.flick(0,-5000) for (var i = 0; i < activeVehicle.messageCount; i++)
activeVehicle.resetMessages() messageFlick.flick(0,-5000)
} else { activeVehicle.resetMessages()
messageText.text = qsTr("No Messages") } else {
messageText.text = qsTr("No Messages")
}
currentPopUp = messageArea
messageArea.visible = true
} }
currentPopUp = messageArea
messageArea.visible = true
} }
function showPopUp(dropItem, centerX) { function showPopUp(dropItem, centerX) {
rootLoader.sourceComponent = null
var oldIndicator = indicatorDropdown.sourceComponent
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
indicatorDropdown.centerX = centerX if(oldIndicator !== dropItem) {
indicatorDropdown.sourceComponent = dropItem console.log(oldIndicator)
indicatorDropdown.visible = true console.log(dropItem)
currentPopUp = indicatorDropdown indicatorDropdown.centerX = centerX
indicatorDropdown.sourceComponent = dropItem
indicatorDropdown.visible = true
currentPopUp = indicatorDropdown
}
} }
//-- Main UI //-- Main UI
...@@ -242,13 +265,21 @@ Item { ...@@ -242,13 +265,21 @@ Item {
anchors.top: parent.top anchors.top: parent.top
opacity: planToolBar.visible ? 0 : 1 opacity: planToolBar.visible ? 0 : 1
z: QGroundControl.zOrderTopMost z: QGroundControl.zOrderTopMost
Component.onCompleted: ScreenTools.availableHeight = parent.height - toolBar.height Component.onCompleted: ScreenTools.availableHeight = parent.height - toolBar.height
onShowSettingsView: mainWindow.showSettingsView() onShowSettingsView: mainWindow.showSettingsView()
onShowSetupView: mainWindow.showSetupView() onShowSetupView: mainWindow.showSetupView()
onShowPlanView: mainWindow.showPlanView() onShowPlanView: mainWindow.showPlanView()
onShowFlyView: mainWindow.showFlyView() onShowFlyView: mainWindow.showFlyView()
onShowAnalyzeView: mainWindow.showAnalyzeView() 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 { 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