diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index 3ef7283da447d73ac6dd53e2be04ad99d929f42d..6c2c893acc5fb68e6bd191090d1e942e29c307da 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -21,6 +21,7 @@ include(QGCCommon.pri)
TARGET = QGroundControl
TEMPLATE = app
+QGCROOT = $$PWD
DebugBuild {
DESTDIR = $${OUT_PWD}/debug
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 9fe698a3fc06e95b985471a41fd3c0f7956a369a..36e85ae3ce060deb9fa36e2726bb7d40df7c6a6a 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -125,8 +125,8 @@
src/FlightMap/Widgets/QGCAttitudeHUD.qml
src/FlightMap/Widgets/QGCAttitudeWidget.qml
src/FlightMap/Widgets/QGCCompassWidget.qml
- src/FlightMap/Widgets/QGCInstrumentWidget.qml
- src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml
+ src/FlightMap/Widgets/QGCInstrumentWidget.qml
+ src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml
src/MissionEditor/QGCMapPolygonControls.qml
src/FlightMap/Widgets/QGCPitchIndicator.qml
src/FlightMap/QGCVideoBackground.qml
diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml
index ec47cffb248187a9435c59786a304b2850f955b7..473136265efaba6c82855a1fe71487c286d92425 100644
--- a/src/FlightDisplay/FlightDisplayView.qml
+++ b/src/FlightDisplay/FlightDisplayView.qml
@@ -33,25 +33,14 @@ QGCView {
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
+ property bool activeVehicleJoystickEnabled: _activeVehicle ? _activeVehicle.joystickEnabled : false
+
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _mainIsMap: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) : true
property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false
-
- property real _roll: _activeVehicle ? _activeVehicle.roll.value : _defaultRoll
- property real _pitch: _activeVehicle ? _activeVehicle.pitch.value : _defaultPitch
- property real _heading: _activeVehicle ? _activeVehicle.heading.value : _defaultHeading
-
- property Fact _emptyFact: Fact { }
- property Fact _groundSpeedFact: _activeVehicle ? _activeVehicle.groundSpeed : _emptyFact
- property Fact _airSpeedFact: _activeVehicle ? _activeVehicle.airSpeed : _emptyFact
-
- property bool activeVehicleJoystickEnabled: _activeVehicle ? _activeVehicle.joystickEnabled : false
-
- property real _savedZoomLevel: 0
- property real _margins: ScreenTools.defaultFontPixelWidth / 2
-
-
- property real pipSize: mainWindow.width * 0.2
+ property real _savedZoomLevel: 0
+ property real _margins: ScreenTools.defaultFontPixelWidth / 2
+ property real _pipSize: mainWindow.width * 0.2
readonly property bool isBackgroundDark: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
readonly property real _defaultRoll: 0
@@ -136,8 +125,8 @@ QGCView {
anchors.left: _panel.left
anchors.bottom: _panel.bottom
visible: _mainIsMap || _isPipVisible
- width: _mainIsMap ? _panel.width : pipSize
- height: _mainIsMap ? _panel.height : pipSize * (9/16)
+ width: _mainIsMap ? _panel.width : _pipSize
+ height: _mainIsMap ? _panel.height : _pipSize * (9/16)
states: [
State {
name: "pipMode"
@@ -166,8 +155,8 @@ QGCView {
Item {
id: _flightVideo
z: _mainIsMap ? _panel.z + 2 : _panel.z + 1
- width: !_mainIsMap ? _panel.width : pipSize
- height: !_mainIsMap ? _panel.height : pipSize * (9/16)
+ width: !_mainIsMap ? _panel.width : _pipSize
+ height: !_mainIsMap ? _panel.height : _pipSize * (9/16)
anchors.left: _panel.left
anchors.bottom: _panel.bottom
visible: QGroundControl.videoManager.hasVideo && (!_mainIsMap || _isPipVisible)
@@ -204,8 +193,8 @@ QGCView {
QGCPipable {
id: _flightVideoPipControl
z: _flightVideo.z + 3
- width: pipSize
- height: pipSize * (9/16)
+ width: _pipSize
+ height: _pipSize * (9/16)
anchors.left: _panel.left
anchors.bottom: _panel.bottom
anchors.margins: ScreenTools.defaultFontPixelHeight
diff --git a/src/FlightDisplay/FlightDisplayViewVideo.qml b/src/FlightDisplay/FlightDisplayViewVideo.qml
index 2b82520948f95229ad601ed5dd3d44af33c716e5..86d08aff747a1088ef63406745d42ee64695f667 100644
--- a/src/FlightDisplay/FlightDisplayViewVideo.qml
+++ b/src/FlightDisplay/FlightDisplayViewVideo.qml
@@ -45,8 +45,8 @@ Item {
QGCAttitudeHUD {
id: attitudeHUD
visible: !_mainIsMap
- rollAngle: _roll
- pitchAngle: _pitch
+ rollAngle: _activeVehicle ? _activeVehicle.roll.value : 0
+ pitchAngle: _activeVehicle ? _activeVehicle.pitch.value : 0
width: ScreenTools.defaultFontPixelHeight * (30)
height: ScreenTools.defaultFontPixelHeight * (30)
active: QGroundControl.multiVehicleManager.activeVehicleAvailable
diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml
index 9743c72f3a25f454963d2931f8b923d8cd496a04..f6475d47deb8a3e789282c42796c97a34f0b3882 100644
--- a/src/FlightDisplay/FlightDisplayViewWidgets.qml
+++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml
@@ -15,32 +15,31 @@ import QtQuick.Dialogs 1.2
import QtLocation 5.3
import QtPositioning 5.2
-import QGroundControl 1.0
-import QGroundControl.ScreenTools 1.0
-import QGroundControl.Controls 1.0
-import QGroundControl.Palette 1.0
-import QGroundControl.Vehicle 1.0
-import QGroundControl.FlightMap 1.0
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.Vehicle 1.0
+import QGroundControl.FlightMap 1.0
Item {
id: _root
- property alias guidedModeBar: _guidedModeBar
- property bool gotoEnabled: _activeVehicle && _activeVehicle.guidedMode && _activeVehicle.flying
+ property alias guidedModeBar: _guidedModeBar
+ property bool gotoEnabled: _activeVehicle && _activeVehicle.guidedMode && _activeVehicle.flying
property var qgcView
property bool isBackgroundDark
- property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
- property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
- property bool _lightWidgetBorders: _isSatellite
- property bool _useAlternateInstruments: QGroundControl.virtualTabletJoystick || ScreenTools.isTinyScreen
+ property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
+ property bool _isSatellite: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
+ property bool _lightWidgetBorders: _isSatellite
- readonly property real _margins: ScreenTools.defaultFontPixelHeight / 2
+ readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
QGCMapPalette { id: mapPal; lightColors: isBackgroundDark }
- QGCPalette { id: qgcPal }
+ QGCPalette { id: qgcPal }
- function getGadgetWidth() {
+ function getPreferredInstrumentWidth() {
if(ScreenTools.isMobile) {
return ScreenTools.isTinyScreen ? mainWindow.width * 0.2 : mainWindow.width * 0.15
}
@@ -48,6 +47,44 @@ Item {
return Math.min(w, 200)
}
+ 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.virtualTabletJoystick || ScreenTools.isTinyScreen
+ if(useAlternateInstruments) {
+ instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
+ instrumentsLoader.state = "topMode"
+ } else {
+ instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
+ instrumentsLoader.state = "centerMode"
+ }
+ }
+ }
+
+ Connections {
+ target: QGroundControl
+ onVirtualTabletJoystickChanged: {
+ _setInstrumentWidget()
+ }
+ }
+
+ Component.onCompleted: {
+ _setInstrumentWidget()
+ }
+
//-- Map warnings
Column {
anchors.horizontalCenter: parent.horizontalCenter
@@ -74,54 +111,44 @@ Item {
}
//-- Instrument Panel
- QGCInstrumentWidget {
- id: instrumentGadget
- anchors.margins: ScreenTools.defaultFontPixelHeight / 2
- anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
- anchors.verticalCenter: parent.verticalCenter
- visible: !_useAlternateInstruments
- size: getGadgetWidth()
- heading: _heading
- rollAngle: _roll
- pitchAngle: _pitch
- groundSpeedFact: _groundSpeedFact
- airSpeedFact: _airSpeedFact
- lightBorders: _lightWidgetBorders
- z: QGroundControl.zOrderWidgets
- qgcView: _root.qgcView
- maxHeight: parent.height - (anchors.margins * 2)
- }
-
- QGCInstrumentWidgetAlternate {
- id: instrumentGadgetAlternate
+ Loader {
+ id: instrumentsLoader
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
- anchors.top: parent.top
anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right
- visible: _useAlternateInstruments
- width: ScreenTools.isTinyScreen ? getGadgetWidth() * 1.5 : getGadgetWidth()
- heading: _heading
- rollAngle: _roll
- pitchAngle: _pitch
- groundSpeedFact: _groundSpeedFact
- airSpeedFact: _airSpeedFact
- lightBorders: _lightWidgetBorders
- qgcView: _root.qgcView
- maxHeight: parent.height - (anchors.margins * 2)
z: QGroundControl.zOrderWidgets
+ property var qgcView: _root.qgcView
+ property real maxHeight:parent.height - (anchors.margins * 2)
+ states: [
+ State {
+ name: "topMode"
+ AnchorChanges {
+ target: instrumentsLoader
+ anchors.verticalCenter: undefined
+ anchors.bottom: undefined
+ anchors.top: _root ? _root.top : undefined
+ }
+ },
+ State {
+ name: "centerMode"
+ AnchorChanges {
+ target: instrumentsLoader
+ anchors.top: undefined
+ anchors.bottom: undefined
+ anchors.verticalCenter: _root ? _root.verticalCenter : undefined
+ }
+ },
+ State {
+ name: "bottomMode"
+ AnchorChanges {
+ target: instrumentsLoader
+ anchors.top: undefined
+ anchors.verticalCenter: undefined
+ anchors.bottom: _root ? _root.bottom : undefined
+ }
+ }
+ ]
}
- /*
- ValuesWidget {
- anchors.topMargin: ScreenTools.defaultFontPixelHeight
- anchors.top: instrumentGadgetAlternate.bottom
- anchors.horizontalCenter: instrumentGadgetAlternate.horizontalCenter
- width: getGadgetWidth()
- qgcView: _root.qgcView
- textColor: _isSatellite ? "white" : "black"
- visible: _useAlternateInstruments
- maxHeight: virtualJoystickMultiTouch.visible ? virtualJoystickMultiTouch.y - y : parent.height - anchors.margins - y
- }*/
-
//-- Guided mode buttons
Rectangle {
id: _guidedModeBar
@@ -131,7 +158,7 @@ Item {
width: guidedModeColumn.width + (_margins * 2)
height: guidedModeColumn.height + (_margins * 2)
radius: ScreenTools.defaultFontPixelHeight * 0.25
- color: _lightWidgetBorders ? Qt.rgba(qgcPal.mapWidgetBorderLight.r, qgcPal.mapWidgetBorderLight.g, qgcPal.mapWidgetBorderLight.b, 0.8) : Qt.rgba(qgcPal.mapWidgetBorderDark.r, qgcPal.mapWidgetBorderDark.g, qgcPal.mapWidgetBorderDark.b, 0.75)
+ color: _isSatellite ? Qt.rgba(qgcPal.mapWidgetBorderLight.r, qgcPal.mapWidgetBorderLight.g, qgcPal.mapWidgetBorderLight.b, 0.8) : Qt.rgba(qgcPal.mapWidgetBorderDark.r, qgcPal.mapWidgetBorderDark.g, qgcPal.mapWidgetBorderDark.b, 0.75)
visible: _activeVehicle
z: QGroundControl.zOrderWidgets
state: "Shown"
@@ -303,7 +330,7 @@ Item {
QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter
- color: _lightWidgetBorders ? qgcPal.mapWidgetBorderDark : qgcPal.mapWidgetBorderLight
+ color: _isSatellite ? qgcPal.mapWidgetBorderDark : qgcPal.mapWidgetBorderLight
text: "Click in map to move vehicle"
visible: gotoEnabled
}
diff --git a/src/FlightDisplay/MultiVehicleList.qml b/src/FlightDisplay/MultiVehicleList.qml
index 9278056d6753451436fb36fdc7367132708fafc3..a266bf0b6dd13f9a79f990f63ff70395bec336d0 100644
--- a/src/FlightDisplay/MultiVehicleList.qml
+++ b/src/FlightDisplay/MultiVehicleList.qml
@@ -52,15 +52,12 @@ QGCListView {
QGCCompassWidget {
size: _widgetHeight
- heading: _vehicle.heading.rawValue
vehicle: _vehicle
}
QGCAttitudeWidget {
size: _widgetHeight
- active: true
- rollAngle: _vehicle.roll.rawValue
- pitchAngle: _vehicle.pitch.rawValue
+ vehicle: _vehicle
}
}
diff --git a/src/FlightMap/Widgets/QGCAttitudeWidget.qml b/src/FlightMap/Widgets/QGCAttitudeWidget.qml
index 9f252926c279848ac948e47d92c266403dedb968..b3358db3d0d486949fefc25933b34140213480d6 100644
--- a/src/FlightMap/Widgets/QGCAttitudeWidget.qml
+++ b/src/FlightMap/Widgets/QGCAttitudeWidget.qml
@@ -17,22 +17,18 @@
import QtQuick 2.4
import QtGraphicalEffects 1.0
+import QGroundControl 1.0
import QGroundControl.Controls 1.0
Item {
id: root
- property bool active: false ///< true: actively connected to data provider, false: show inactive control
- property real rollAngle : _defaultRollAngle
- property real pitchAngle: _defaultPitchAngle
property bool showPitch: true
+ property var vehicle: null
property real size
- readonly property real _defaultRollAngle: 0
- readonly property real _defaultPitchAngle: 0
-
- property real _rollAngle: active ? rollAngle : _defaultRollAngle
- property real _pitchAngle: active ? pitchAngle : _defaultPitchAngle
+ property real _rollAngle: vehicle ? vehicle.roll.rawValue : 0
+ property real _pitchAngle: vehicle ? vehicle.pitch.rawValue : 0
width: size
height: size
diff --git a/src/FlightMap/Widgets/QGCCompassWidget.qml b/src/FlightMap/Widgets/QGCCompassWidget.qml
index b941fbf919f8fbd9663aba8f0822738e39942ae1..a8e107180e32b41d45ccf242cffdb06a4c25a1ef 100644
--- a/src/FlightMap/Widgets/QGCCompassWidget.qml
+++ b/src/FlightMap/Widgets/QGCCompassWidget.qml
@@ -25,12 +25,12 @@ Item {
id: root
property real size: _defaultSize
- property real heading: 0
property var vehicle: null
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (10)
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property int _fontSize: ScreenTools.defaultFontPointSize * _sizeRatio
+ property real _heading: vehicle ? vehicle.heading.rawValue : 0
width: size
height: size
@@ -58,7 +58,7 @@ Item {
transform: Rotation {
origin.x: pointer.width / 2
origin.y: pointer.height / 2
- angle: heading
+ angle: _heading
}
}
@@ -79,7 +79,7 @@ Item {
color: Qt.rgba(0,0,0,0.65)
QGCLabel {
- text: vehicle ? heading.toFixed(0) : qsTr("OFF")
+ text: vehicle ? _heading.toFixed(0) : qsTr("OFF")
font.family: vehicle ? ScreenTools.demiboldFontFamily : ScreenTools.normalFontFamily
font.pointSize: _fontSize < 8 ? 8 : _fontSize;
color: "white"
diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml
index 879f740c4295eb240ff6e996802618cec944ba4e..a5b81c55a2ca64ef57bf7ff6bf6ab805f3ceab53 100644
--- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml
+++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml
@@ -26,27 +26,15 @@ import QGroundControl.Palette 1.0
Item {
id: instrumentPanel
height: instrumentColumn.y + instrumentColumn.height + _topBottomMargin
- width: size
-
- property alias heading: compass.heading
- property alias rollAngle: attitudeWidget.rollAngle
- property alias pitchAngle: attitudeWidget.pitchAngle
- property real size: _defaultSize
- property bool lightBorders: true
- property bool active: false
- property var qgcView
- property real maxHeight
-
- property Fact _emptyFact: Fact { }
- property Fact groundSpeedFact: _emptyFact
- property Fact airSpeedFact: _emptyFact
-
- property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
+ width: getPreferredInstrumentWidth()
+ property var _qgcView: qgcView
+ property real _maxHeight: maxHeight
+ property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property color _backgroundColor: qgcPal.window
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
- property real _topBottomMargin: (size * 0.05) / 2
- property real _availableValueHeight: maxHeight - (attitudeWidget.height + _spacer1.height + _spacer2.height + (_spacing * 4)) - (_showCompass ? compass.height : 0)
+ property real _topBottomMargin: (width * 0.05) / 2
+ property real _availableValueHeight: _maxHeight - (attitudeWidget.height + _spacer1.height + _spacer2.height + (_spacing * 4)) - (_showCompass ? compass.height : 0)
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
readonly property bool _showCompass: true // !ScreenTools.isShortScreen
@@ -57,10 +45,10 @@ Item {
anchors.left: parent.left
anchors.right: parent.right
height: (_showCompass ? instrumentColumn.height : attitudeWidget.height) + (_topBottomMargin * 2)
- radius: size / 2
+ radius: width / 2
color: _backgroundColor
border.width: 1
- border.color: lightBorders ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
+ border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
}
MouseArea {
@@ -83,7 +71,7 @@ Item {
QGCAttitudeWidget {
id: attitudeWidget
size: parent.width * 0.95
- active: instrumentPanel.active
+ vehicle: _activeVehicle
anchors.horizontalCenter: parent.horizontalCenter
}
@@ -131,7 +119,7 @@ Item {
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
- qgcView: instrumentPanel.qgcView
+ qgcView: instrumentPanel._qgcView
textColor: qgcPal.text
backgroundColor: _backgroundColor
maxHeight: _availableValueHeight
diff --git a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml
index 2ce355663276064feb8f7139dc6fec8d6b11fca2..03d5e34f323724675d3a8d3484d7349718e28936 100644
--- a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml
+++ b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml
@@ -20,38 +20,24 @@ import QGroundControl.Palette 1.0
/// Instrument panel shown when virtual thumbsticks are visible
Rectangle {
id: root
+ width: ScreenTools.isTinyScreen ? getPreferredInstrumentWidth() * 1.5 : getPreferredInstrumentWidth()
height: _outerRadius * 2
radius: _outerRadius
color: qgcPal.window
border.width: 1
- border.color: lightBorders ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
-
- property alias heading: compass.heading
- property alias rollAngle: attitude.rollAngle
- property alias pitchAngle: attitude.pitchAngle
- property real size: _defaultSize
- property bool active: false
- property bool lightBorders: true
- property var qgcView
- property real maxHeight
-
- property Fact _emptyFact: Fact { }
- property Fact groundSpeedFact: _emptyFact
- property Fact airSpeedFact: _emptyFact
- property Fact altitudeFact: _emptyFact
-
- property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
- property real _outerRadius: _innerRadius + _topBottomMargin
-
- property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
-
- property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
- property real _bigFontSize: ScreenTools.defaultFontPointSize * 2.5 * _sizeRatio
- property real _normalFontSize:ScreenTools.defaultFontPointSize * 1.5 * _sizeRatio
- property real _labelFontSize: ScreenTools.defaultFontPointSize * 0.75 * _sizeRatio
- property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
- property real _topBottomMargin: (size * 0.05) / 2
+ border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
+
+ property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
+ property real _outerRadius: _innerRadius + _topBottomMargin
+ property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
+ property real _sizeRatio: ScreenTools.isTinyScreen ? (width / _defaultSize) * 0.5 : width / _defaultSize
+ property real _bigFontSize: ScreenTools.defaultFontPointSize * 2.5 * _sizeRatio
+ property real _normalFontSize: ScreenTools.defaultFontPointSize * 1.5 * _sizeRatio
+ property real _labelFontSize: ScreenTools.defaultFontPointSize * 0.75 * _sizeRatio
+ property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
+ property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: maxHeight - (root.height + _valuesItem.anchors.topMargin)
+ property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
QGCPalette { id: qgcPal }
@@ -60,7 +46,7 @@ Rectangle {
anchors.leftMargin: _topBottomMargin
anchors.left: parent.left
size: _innerRadius * 2
- active: root.active
+ vehicle: _activeVehicle
anchors.verticalCenter: parent.verticalCenter
}
@@ -69,7 +55,7 @@ Rectangle {
anchors.leftMargin: _spacing
anchors.left: attitude.right
size: _innerRadius * 2
- vehicle: QGroundControl.multiVehicleManager.activeVehicle
+ vehicle: _activeVehicle
anchors.verticalCenter: parent.verticalCenter
}
diff --git a/src/FlightMap/qmldir b/src/FlightMap/qmldir
index c6d02e2cf02b458c0500ec20cb0920839b820513..84cdd15c37a80593e0e4d740a7644492051f6948 100644
--- a/src/FlightMap/qmldir
+++ b/src/FlightMap/qmldir
@@ -14,8 +14,6 @@ QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml
QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml
QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml
QGCCompassWidget 1.0 QGCCompassWidget.qml
-QGCInstrumentWidget 1.0 QGCInstrumentWidget.qml
-QGCInstrumentWidgetAlternate 1.0 QGCInstrumentWidgetAlternate.qml
QGCPitchIndicator 1.0 QGCPitchIndicator.qml
QGCSlider 1.0 QGCSlider.qml
ValuesWidget 1.0 ValuesWidget.qml
diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc
index a530547ddc96be0dcb7cb3a4f4b322f47e778452..89eac8c4c39131f4f55d9af9c511cb00f91a49cf 100644
--- a/src/api/QGCCorePlugin.cc
+++ b/src/api/QGCCorePlugin.cc
@@ -126,6 +126,11 @@ QVariantList &QGCCorePlugin::settings()
return _p->settingsList;
}
+int QGCCorePlugin::defaltSettings()
+{
+ return 0;
+}
+
QGCOptions* QGCCorePlugin::options()
{
if(!_p->defaultOptions) {
diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h
index 9d1a1afa03ff965cf157fad294b5638bb57ef943..492da621de138335e2138704fdb1ac29fcf1c925 100644
--- a/src/api/QGCCorePlugin.h
+++ b/src/api/QGCCorePlugin.h
@@ -32,20 +32,27 @@ public:
QGCCorePlugin(QGCApplication* app);
~QGCCorePlugin();
- Q_PROPERTY(QVariantList settings READ settings CONSTANT)
- Q_PROPERTY(QGCOptions* options READ options CONSTANT)
+ Q_PROPERTY(QVariantList settings READ settings CONSTANT)
+ Q_PROPERTY(int defaltSettings READ defaltSettings CONSTANT)
+ Q_PROPERTY(QGCOptions* options READ options CONSTANT)
//! The list of settings under the Settings Menu
/*!
@return A list of QGCSettings
*/
- virtual QVariantList& settings ();
+ virtual QVariantList& settings ();
+
+ //! The default settings panel to show
+ /*!
+ @return The settings index
+ */
+ virtual int defaltSettings ();
//! Global options
/*!
@return An instance of QGCOptions
*/
- virtual QGCOptions* options ();
+ virtual QGCOptions* options ();
// Override from QGCTool
void setToolbox (QGCToolbox *toolbox);
diff --git a/src/api/QGCOptions.cc b/src/api/QGCOptions.cc
index 3b598fe3dfc19aa3e25ca86407540249674a8913..0955cec12d1e46520cf663d8d759ebd24ef45479 100644
--- a/src/api/QGCOptions.cc
+++ b/src/api/QGCOptions.cc
@@ -8,6 +8,7 @@
****************************************************************************/
#include "QGCOptions.h"
+#include
/// @file
/// @brief Core Plugin Interface for QGroundControl - Application Options
@@ -15,5 +16,23 @@
QGCOptions::QGCOptions(QObject* parent)
: QObject(parent)
+ , _defaultInstrumentWidget(NULL)
{
+ qmlRegisterUncreatableType("QGroundControl", 1, 0, "CustomInstrumentWidget", "Reference only");
}
+
+CustomInstrumentWidget*
+QGCOptions::instrumentWidget()
+{
+ if(!_defaultInstrumentWidget) {
+ _defaultInstrumentWidget = new CustomInstrumentWidget(this);
+ }
+ return _defaultInstrumentWidget;
+}
+
+CustomInstrumentWidget::CustomInstrumentWidget(QObject* parent)
+ : QObject(parent)
+{
+}
+
+
diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h
index 1845d3abbe3d39482295a983e34aa2cd0ea08971..dbe141d4fc356e3ef6bfbc9b2f53c5247890cad6 100644
--- a/src/api/QGCOptions.h
+++ b/src/api/QGCOptions.h
@@ -11,11 +11,13 @@
#include
#include
+#include
/// @file
/// @brief Core Plugin Interface for QGroundControl - Application Options
/// @author Gus Grubba
+class CustomInstrumentWidget;
class QGCOptions : public QObject
{
Q_OBJECT
@@ -32,6 +34,8 @@ public:
Q_PROPERTY(double toolbarHeightMultiplier READ toolbarHeightMultiplier CONSTANT)
Q_PROPERTY(double defaultFontPointSize READ defaultFontPointSize CONSTANT)
Q_PROPERTY(bool enablePlanViewSelector READ enablePlanViewSelector CONSTANT)
+ Q_PROPERTY(CustomInstrumentWidget* instrumentWidget READ instrumentWidget CONSTANT)
+
//! Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
/*!
@@ -83,4 +87,32 @@ public:
@return True or false
*/
virtual bool enablePlanViewSelector () { return true; }
+ //! Provides an alternate instrument widget for the Fly View
+ /*!
+ @return An alternate widget (see QGCInstrumentWidget.qml, the default widget)
+ */
+ virtual CustomInstrumentWidget* instrumentWidget();
+private:
+ CustomInstrumentWidget* _defaultInstrumentWidget;
+};
+
+//-----------------------------------------------------------------------------
+class CustomInstrumentWidget : public QObject
+{
+ Q_OBJECT
+public:
+ //-- Widget Position
+ enum Pos {
+ POS_TOP_RIGHT = 0,
+ POS_CENTER_RIGHT = 1,
+ POS_BOTTOM_RIGHT = 2,
+ };
+ Q_ENUMS(Pos)
+ CustomInstrumentWidget(QObject* parent = NULL);
+ Q_PROPERTY(QUrl source READ source CONSTANT)
+ Q_PROPERTY(Pos widgetPosition READ widgetPosition NOTIFY widgetPositionChanged)
+ virtual QUrl source () { return QUrl(); }
+ virtual Pos widgetPosition () { return POS_CENTER_RIGHT; }
+signals:
+ void widgetPositionChanged ();
};
diff --git a/src/ui/AppSettings.qml b/src/ui/AppSettings.qml
index 337aac725d54101f0820af470b351b632c004f32..5599e025287adad2a717c455bf23b0e9b602d03e 100644
--- a/src/ui/AppSettings.qml
+++ b/src/ui/AppSettings.qml
@@ -35,8 +35,8 @@ Rectangle {
QGCPalette { id: qgcPal }
Component.onCompleted: {
- //-- Default to General Settings
- __rightPanel.source = "GeneralSettings.qml"
+ //-- Default Settings
+ __rightPanel.source = QGroundControl.corePlugin.settings[QGroundControl.corePlugin.defaltSettings].url
}
QGCFlickable {
diff --git a/src/ui/toolbar/MainToolBarController.h b/src/ui/toolbar/MainToolBarController.h
index c8f42b284ed962848bd416de12a61a9d5e6a6a36..bb167cdcbc41e75c480e460b2fba5a341a0526a5 100644
--- a/src/ui/toolbar/MainToolBarController.h
+++ b/src/ui/toolbar/MainToolBarController.h
@@ -22,13 +22,6 @@
#include "Vehicle.h"
#include "UASMessageView.h"
-#define TOOL_BAR_SETTINGS_GROUP "TOOLBAR_SETTINGS_GROUP"
-#define TOOL_BAR_SHOW_BATTERY "ShowBattery"
-#define TOOL_BAR_SHOW_GPS "ShowGPS"
-#define TOOL_BAR_SHOW_MAV "ShowMav"
-#define TOOL_BAR_SHOW_MESSAGES "ShowMessages"
-#define TOOL_BAR_SHOW_RSSI "ShowRSSI"
-
class MainToolBarController : public QObject
{
Q_OBJECT
@@ -45,8 +38,6 @@ public:
Q_PROPERTY(unsigned int telemetryLNoise READ telemetryLNoise NOTIFY telemetryLNoiseChanged)
Q_PROPERTY(unsigned int telemetryRNoise READ telemetryRNoise NOTIFY telemetryRNoiseChanged)
- void viewStateChanged (const QString& key, bool value);
-
int telemetryRRSSI () { return _telemetryRRSSI; }
int telemetryLRSSI () { return _telemetryLRSSI; }
unsigned int telemetryRXErrors () { return _telemetryRXErrors; }
@@ -58,7 +49,6 @@ public:
signals:
void telemetryRRSSIChanged (int value);
void telemetryLRSSIChanged (int value);
- void heightChanged (double height);
void telemetryRXErrorsChanged (unsigned int value);
void telemetryFixedChanged (unsigned int value);
void telemetryTXBufferChanged (unsigned int value);
@@ -81,8 +71,6 @@ private:
uint32_t _telemetryLNoise;
uint32_t _telemetryRNoise;
- QStringList _toolbarMessageQueue;
- QMutex _toolbarMessageQueueMutex;
};
#endif // MainToolBarController_H