Commit 6c20246f authored by Gus Grubba's avatar Gus Grubba

Merge pull request #2219 from dogmaphobic/position

Position
parents 827bab13 130ffcf4
......@@ -34,6 +34,10 @@
<string>6.0</string>
<key>ForAppStore</key>
<string>No</string>
<key>NSLocationUsageDescription</key>
<string>Ground Station Location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Ground Station Location</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
......
......@@ -34,6 +34,10 @@
<string>6.0</string>
<key>ForAppStore</key>
<string>Yes</string>
<key>NSLocationUsageDescription</key>
<string>Ground Station Location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Ground Station Location</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
......
......@@ -54,10 +54,10 @@ CONFIG += qt \
thread
QT += \
network \
concurrent \
gui \
location \
network \
opengl \
positioning \
qml \
......
......@@ -49,7 +49,7 @@ Item {
property var _activeVehicle: multiVehicleManager.activeVehicle
readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276)
readonly property var _defaultVehicleCoordinate: mainWindow.tabletPosition
readonly property real _defaultRoll: 0
readonly property real _defaultPitch: 0
readonly property real _defaultHeading: 0
......
......@@ -39,8 +39,8 @@ FlightMap {
id: flightMap
anchors.fill: parent
mapName: _mapName
latitude: root._defaultCoordinate.latitude
longitude: root._defaultCoordinate.longitude
latitude: mainWindow.tabletPosition.latitude
longitude: mainWindow.tabletPosition.longitude
property var rootVehicleCoordinate: _vehicleCoordinate
property bool _followVehicle: true
......
......@@ -43,8 +43,8 @@ import QGroundControl.Mavlink 1.0
Map {
id: _map
property real latitude: 0
property real longitude: 0
property real latitude: 64.154549 //-- If you find yourself here on startup, something went wrong :)
property real longitude: -22.023540
property real heading: 0
property bool interactive: true
property string mapName: 'defaultMap'
......
......@@ -103,7 +103,10 @@ QGCView {
MissionController {
id: controller
Component.onCompleted: start(true /* editMode */)
Component.onCompleted: {
start(true /* editMode */)
}
/*
FIXME: autoSync is temporarily disconnected since it's still buggy
......@@ -142,8 +145,12 @@ QGCView {
id: editorMap
anchors.fill: parent
mapName: "MissionEditor"
latitude: tabletPosition.latitude
longitude: tabletPosition.longitude
latitude: mainWindow.tabletPosition.latitude
longitude: mainWindow.tabletPosition.longitude
Component.onCompleted: {
console.log("Init coordinate " + mainWindow.tabletPosition.latitude)
}
readonly property real animationDuration: 500
......@@ -866,7 +873,7 @@ QGCView {
//-- Zoom Map In
RoundButton {
id: mapZoomPlus
visible: !ScreenTools.isTinyScreen
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomPlus.svg"
z: QGroundControl.zOrderWidgets
onClicked: {
......@@ -879,7 +886,7 @@ QGCView {
//-- Zoom Map Out
RoundButton {
id: mapZoomMinus
visible: !ScreenTools.isTinyScreen
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomMinus.svg"
z: QGroundControl.zOrderWidgets
onClicked: {
......
......@@ -323,7 +323,6 @@ QGCApplication::~QGCApplication()
if (mainWindow) {
delete mainWindow;
}
shutdownVideoStreaming();
delete _toolbox;
}
......
......@@ -30,7 +30,8 @@ Item {
property bool isiOS: ScreenToolsController.isiOS
property bool isMobile: ScreenToolsController.isMobile
property bool isDebug: ScreenToolsController.isDebug
property bool isTinyScreen: (Screen.width / Screen.pixelDensity) < 120 // 120mm
property bool isTinyScreen: (Screen.width / Screen.pixelDensity) < 120 // 120mm
property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example
function mouseX() {
return ScreenToolsController.mouseX()
......
......@@ -47,6 +47,9 @@ Item {
property real avaiableHeight: height - tbHeight
property real menuButtonWidth: (tbButtonWidth * 2) + (tbSpacing * 4) + 1
property var defaultPosition: QtPositioning.coordinate(37.803784, -122.462276)
property var tabletPosition: defaultPosition
Connections {
target: controller
......@@ -86,17 +89,23 @@ Item {
}
//-- Detect tablet position
property var tabletPosition: QtPositioning.coordinate(37.803784, -122.462276)
PositionSource {
id: positionSource
updateInterval: 1000
active: true // ScreenTools.isMobile
active: false
onPositionChanged: {
tabletPosition = positionSource.position.coordinate
flightView.latitude = tabletPosition.latitude
flightView.longitude = tabletPosition.longitude
positionSource.active = false
if(positionSource.valid) {
if(positionSource.position.coordinate.latitude) {
if(Math.abs(positionSource.position.coordinate.latitude) > 0.001) {
if(positionSource.position.coordinate.longitude) {
if(Math.abs(positionSource.position.coordinate.longitude) > 0.001) {
tabletPosition = positionSource.position.coordinate
}
}
}
}
}
positionSource.stop()
}
}
......@@ -146,20 +155,21 @@ Item {
anchors.fill: parent
avaiableHeight: mainWindow.avaiableHeight
visible: true
Component.onCompleted: {
positionSource.start()
}
}
Loader {
id: planViewLoader
anchors.fill: parent
visible: false
property var tabletPosition: mainWindow.tabletPosition
}
Loader {
id: setupViewLoader
anchors.fill: parent
visible: false
property var tabletPosition: mainWindow.tabletPosition
}
}
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