Commit 73a4286d authored by Stefan Dunca's avatar Stefan Dunca

custom-example: Make GPS info optional and persistent

parent 80ce7ae0
...@@ -61,7 +61,6 @@ Item { ...@@ -61,7 +61,6 @@ Item {
property real _distance: 0.0 property real _distance: 0.0
property string _messageTitle: "" property string _messageTitle: ""
property string _messageText: "" property string _messageText: ""
property bool _showAttitude: true
function secondsToHHMMSS(timeS) { function secondsToHHMMSS(timeS) {
var sec_num = parseInt(timeS, 10); var sec_num = parseInt(timeS, 10);
...@@ -260,19 +259,25 @@ Item { ...@@ -260,19 +259,25 @@ Item {
anchors.bottomMargin: ScreenTools.defaultFontPixelWidth anchors.bottomMargin: ScreenTools.defaultFontPixelWidth
anchors.right: attitudeIndicator.visible ? attitudeIndicator.left : parent.right anchors.right: attitudeIndicator.visible ? attitudeIndicator.left : parent.right
anchors.rightMargin: attitudeIndicator.visible ? -ScreenTools.defaultFontPixelWidth : ScreenTools.defaultFontPixelWidth anchors.rightMargin: attitudeIndicator.visible ? -ScreenTools.defaultFontPixelWidth : ScreenTools.defaultFontPixelWidth
GridLayout {
id: vehicleStatusGrid readonly property bool _showGps: CustomQuickInterface.showAttitudeWidget
columnSpacing: ScreenTools.defaultFontPixelWidth * 1.5
GridLayout {
id: vehicleStatusGrid
columnSpacing: ScreenTools.defaultFontPixelWidth * 1.5
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columns: 7 columns: 7
anchors.centerIn: parent anchors.centerIn: parent
//-- Latitude //-- Latitude
QGCLabel { QGCLabel {
height: _indicatorsHeight height: _indicatorsHeight
width: height width: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text color: qgcPal.text
text: "lat:" text: "Lat:"
visible: vehicleIndicator._showGps
} }
QGCLabel { QGCLabel {
id: firstLabel id: firstLabel
...@@ -282,6 +287,7 @@ Item { ...@@ -282,6 +287,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
visible: vehicleIndicator._showGps
} }
//-- Longitude //-- Longitude
QGCLabel { QGCLabel {
...@@ -289,7 +295,8 @@ Item { ...@@ -289,7 +295,8 @@ Item {
width: height width: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text color: qgcPal.text
text: "lon:" text: "Lon:"
visible: vehicleIndicator._showGps
} }
QGCLabel { QGCLabel {
text: activeVehicle ? activeVehicle.gps.lon.value.toFixed(activeVehicle.gps.lon.decimalPlaces) : "-" text: activeVehicle ? activeVehicle.gps.lon.value.toFixed(activeVehicle.gps.lon.decimalPlaces) : "-"
...@@ -298,6 +305,7 @@ Item { ...@@ -298,6 +305,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment horizontalAlignment: firstLabel.horizontalAlignment
visible: vehicleIndicator._showGps
} }
//-- HDOP //-- HDOP
QGCLabel { QGCLabel {
...@@ -306,6 +314,7 @@ Item { ...@@ -306,6 +314,7 @@ Item {
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text color: qgcPal.text
text: "HDOP:" text: "HDOP:"
visible: vehicleIndicator._showGps
} }
QGCLabel { QGCLabel {
text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(activeVehicle.gps.hdop.decimalPlaces) : "-" text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(activeVehicle.gps.hdop.decimalPlaces) : "-"
...@@ -314,6 +323,7 @@ Item { ...@@ -314,6 +323,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment horizontalAlignment: firstLabel.horizontalAlignment
visible: vehicleIndicator._showGps
} }
//-- Compass //-- Compass
...@@ -506,7 +516,7 @@ Item { ...@@ -506,7 +516,7 @@ Item {
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onDoubleClicked: _showAttitude = !_showAttitude onDoubleClicked: CustomQuickInterface.showAttitudeWidget = !CustomQuickInterface.showAttitudeWidget
} }
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
...@@ -515,7 +525,7 @@ Item { ...@@ -515,7 +525,7 @@ Item {
color: qgcPal.window color: qgcPal.window
width: attitudeIndicator.width * 0.5 width: attitudeIndicator.width * 0.5
height: vehicleIndicator.height height: vehicleIndicator.height
visible: _showAttitude visible: CustomQuickInterface.showAttitudeWidget
anchors.top: vehicleIndicator.top anchors.top: vehicleIndicator.top
anchors.left: vehicleIndicator.right anchors.left: vehicleIndicator.right
} }
...@@ -529,7 +539,7 @@ Item { ...@@ -529,7 +539,7 @@ Item {
width: height width: height
radius: height * 0.5 radius: height * 0.5
color: qgcPal.windowShade color: qgcPal.windowShade
visible: _showAttitude visible: CustomQuickInterface.showAttitudeWidget
CustomAttitudeWidget { CustomAttitudeWidget {
size: parent.height * 0.95 size: parent.height * 0.95
vehicle: activeVehicle vehicle: activeVehicle
......
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