Commit 26139748 authored by dogmaphobic's avatar dogmaphobic

Fixed starting map coordinates.

parent e855eb08
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
<string>6.0</string> <string>6.0</string>
<key>ForAppStore</key> <key>ForAppStore</key>
<string>No</string> <string>No</string>
<key>NSLocationUsageDescription</key>
<string>Ground Station Location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Ground Station Location</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
......
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
<string>6.0</string> <string>6.0</string>
<key>ForAppStore</key> <key>ForAppStore</key>
<string>Yes</string> <string>Yes</string>
<key>NSLocationUsageDescription</key>
<string>Ground Station Location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Ground Station Location</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
......
...@@ -54,10 +54,10 @@ CONFIG += qt \ ...@@ -54,10 +54,10 @@ CONFIG += qt \
thread thread
QT += \ QT += \
network \
concurrent \ concurrent \
gui \ gui \
location \ location \
network \
opengl \ opengl \
positioning \ positioning \
qml \ qml \
......
...@@ -49,7 +49,7 @@ Item { ...@@ -49,7 +49,7 @@ Item {
property var _activeVehicle: multiVehicleManager.activeVehicle 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 _defaultRoll: 0
readonly property real _defaultPitch: 0 readonly property real _defaultPitch: 0
readonly property real _defaultHeading: 0 readonly property real _defaultHeading: 0
......
...@@ -39,8 +39,8 @@ FlightMap { ...@@ -39,8 +39,8 @@ FlightMap {
id: flightMap id: flightMap
anchors.fill: parent anchors.fill: parent
mapName: _mapName mapName: _mapName
latitude: root._defaultCoordinate.latitude latitude: mainWindow.tabletPosition.latitude
longitude: root._defaultCoordinate.longitude longitude: mainWindow.tabletPosition.longitude
property var rootVehicleCoordinate: _vehicleCoordinate property var rootVehicleCoordinate: _vehicleCoordinate
property bool _followVehicle: true property bool _followVehicle: true
......
...@@ -43,8 +43,8 @@ import QGroundControl.Mavlink 1.0 ...@@ -43,8 +43,8 @@ import QGroundControl.Mavlink 1.0
Map { Map {
id: _map id: _map
property real latitude: 0 property real latitude: 64.154549 //-- If you find yourself here on startup, something went wrong :)
property real longitude: 0 property real longitude: -22.023540
property real heading: 0 property real heading: 0
property bool interactive: true property bool interactive: true
property string mapName: 'defaultMap' property string mapName: 'defaultMap'
......
...@@ -103,7 +103,10 @@ QGCView { ...@@ -103,7 +103,10 @@ QGCView {
MissionController { MissionController {
id: controller id: controller
Component.onCompleted: start(true /* editMode */) Component.onCompleted: {
start(true /* editMode */)
}
/* /*
FIXME: autoSync is temporarily disconnected since it's still buggy FIXME: autoSync is temporarily disconnected since it's still buggy
...@@ -142,8 +145,12 @@ QGCView { ...@@ -142,8 +145,12 @@ QGCView {
id: editorMap id: editorMap
anchors.fill: parent anchors.fill: parent
mapName: "MissionEditor" mapName: "MissionEditor"
latitude: tabletPosition.latitude latitude: mainWindow.tabletPosition.latitude
longitude: tabletPosition.longitude longitude: mainWindow.tabletPosition.longitude
Component.onCompleted: {
console.log("Init coordinate " + mainWindow.tabletPosition.latitude)
}
readonly property real animationDuration: 500 readonly property real animationDuration: 500
...@@ -695,6 +702,17 @@ QGCView { ...@@ -695,6 +702,17 @@ QGCView {
} // Item - Home Position Manager } // Item - Home Position Manager
*/ */
//-- Dismiss Drop Down (if any)
MouseArea {
anchors.fill: parent
enabled: _dropButtonsExclusiveGroup.current != null
onClicked: {
if(_dropButtonsExclusiveGroup.current)
_dropButtonsExclusiveGroup.current.checked = false
_dropButtonsExclusiveGroup.current = null
}
}
//-- Help Panel //-- Help Panel
Loader { Loader {
id: helpPanel id: helpPanel
...@@ -705,14 +723,23 @@ QGCView { ...@@ -705,14 +723,23 @@ QGCView {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Item {
id: toolbarSpacer
height: mainWindow.tbHeight
width: 1
}
//-- Vertical Tool Buttons
Column {
id: toolColumn
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.top: toolbarSpacer.bottom
spacing: ScreenTools.defaultFontPixelHeight
RoundButton { RoundButton {
id: addMissionItemsButton id: addMissionItemsButton
anchors.margins: _margin
anchors.left: parent.left
y: (parent.height - (_toolButtonCount * height) - ((_toolButtonCount - 1) * _margin)) / 2
buttonImage: "/qmlimages/MapAddMission.svg" buttonImage: "/qmlimages/MapAddMission.svg"
exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
onCheckedChanged: { onCheckedChanged: {
...@@ -734,14 +761,10 @@ QGCView { ...@@ -734,14 +761,10 @@ QGCView {
RoundButton { RoundButton {
id: deleteMissionItemButton id: deleteMissionItemButton
anchors.margins: _margin
anchors.left: parent.left
anchors.top: addMissionItemsButton.bottom
buttonImage: "/qmlimages/TrashDelete.svg" buttonImage: "/qmlimages/TrashDelete.svg"
exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
onClicked: { onClicked: {
addMissionItemsButton.checked = false
itemDragger.clearItem() itemDragger.clearItem()
controller.deleteCurrentMissionItem() controller.deleteCurrentMissionItem()
checked = false checked = false
...@@ -752,20 +775,14 @@ QGCView { ...@@ -752,20 +775,14 @@ QGCView {
Home Position manager temporarily disable Home Position manager temporarily disable
RoundButton { RoundButton {
id: homePositionManagerButton id: homePositionManagerButton
anchors.margins: _margin
anchors.left: parent.left
anchors.top: deleteMissionItemButton.bottom
buttonImage: "/qmlimages/MapHome.svg" buttonImage: "/qmlimages/MapHome.svg"
exclusiveGroup: _dropButtonsExclusiveGroup //exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
} }
*/ */
DropButton { DropButton {
id: centerMapButton id: centerMapButton
anchors.margins: _margin
anchors.left: parent.left
anchors.top: deleteMissionItemButton.bottom
dropDirection: dropRight dropDirection: dropRight
buttonImage: "/qmlimages/MapCenter.svg" buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
...@@ -808,9 +825,6 @@ QGCView { ...@@ -808,9 +825,6 @@ QGCView {
DropButton { DropButton {
id: syncButton id: syncButton
anchors.margins: _margin
anchors.left: parent.left
anchors.top: centerMapButton.bottom
dropDirection: dropRight dropDirection: dropRight
buttonImage: _syncNeeded ? "/qmlimages/MapSyncChanged.svg" : "/qmlimages/MapSync.svg" buttonImage: _syncNeeded ? "/qmlimages/MapSyncChanged.svg" : "/qmlimages/MapSync.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
...@@ -822,9 +836,6 @@ QGCView { ...@@ -822,9 +836,6 @@ QGCView {
DropButton { DropButton {
id: mapTypeButton id: mapTypeButton
anchors.margins: _margin
anchors.left: parent.left
anchors.top: syncButton.bottom
dropDirection: dropRight dropDirection: dropRight
buttonImage: "/qmlimages/MapType.svg" buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
...@@ -859,16 +870,40 @@ QGCView { ...@@ -859,16 +870,40 @@ QGCView {
} }
} }
//-- Zoom Map In
RoundButton {
id: mapZoomPlus
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomPlus.svg"
z: QGroundControl.zOrderWidgets
onClicked: {
if(editorMap)
editorMap.zoomLevel += 0.5
checked = false
}
}
//-- Zoom Map Out
RoundButton {
id: mapZoomMinus
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomMinus.svg"
z: QGroundControl.zOrderWidgets
onClicked: {
if(editorMap)
editorMap.zoomLevel -= 0.5
checked = false
}
}
RoundButton { RoundButton {
id: helpButton id: helpButton
anchors.margins: _margin
anchors.left: parent.left
anchors.top: mapTypeButton.bottom
buttonImage: "/qmlimages/Help.svg" buttonImage: "/qmlimages/Help.svg"
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
checked: _showHelp checked: _showHelp
} }
}
Rectangle { Rectangle {
id: waypointDistanceDisplay id: waypointDistanceDisplay
......
...@@ -323,7 +323,6 @@ QGCApplication::~QGCApplication() ...@@ -323,7 +323,6 @@ QGCApplication::~QGCApplication()
if (mainWindow) { if (mainWindow) {
delete mainWindow; delete mainWindow;
} }
shutdownVideoStreaming(); shutdownVideoStreaming();
delete _toolbox; delete _toolbox;
} }
......
...@@ -31,6 +31,7 @@ Item { ...@@ -31,6 +31,7 @@ Item {
property bool isMobile: ScreenToolsController.isMobile property bool isMobile: ScreenToolsController.isMobile
property bool isDebug: ScreenToolsController.isDebug 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: (Screen.desktopAvailableHeight / Screen.desktopAvailableWidth) < 0.6 // Nexus 7 for example
function mouseX() { function mouseX() {
return ScreenToolsController.mouseX() return ScreenToolsController.mouseX()
......
...@@ -47,6 +47,9 @@ Item { ...@@ -47,6 +47,9 @@ Item {
property real avaiableHeight: height - tbHeight property real avaiableHeight: height - tbHeight
property real menuButtonWidth: (tbButtonWidth * 2) + (tbSpacing * 4) + 1 property real menuButtonWidth: (tbButtonWidth * 2) + (tbSpacing * 4) + 1
property var defaultPosition: QtPositioning.coordinate(37.803784, -122.462276)
property var tabletPosition: defaultPosition
Connections { Connections {
target: controller target: controller
...@@ -86,17 +89,23 @@ Item { ...@@ -86,17 +89,23 @@ Item {
} }
//-- Detect tablet position //-- Detect tablet position
property var tabletPosition: QtPositioning.coordinate(37.803784, -122.462276)
PositionSource { PositionSource {
id: positionSource id: positionSource
updateInterval: 1000 updateInterval: 1000
active: true // ScreenTools.isMobile active: false
onPositionChanged: { onPositionChanged: {
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 tabletPosition = positionSource.position.coordinate
flightView.latitude = tabletPosition.latitude }
flightView.longitude = tabletPosition.longitude }
positionSource.active = false }
}
}
positionSource.stop()
} }
} }
...@@ -146,20 +155,21 @@ Item { ...@@ -146,20 +155,21 @@ Item {
anchors.fill: parent anchors.fill: parent
avaiableHeight: mainWindow.avaiableHeight avaiableHeight: mainWindow.avaiableHeight
visible: true visible: true
Component.onCompleted: {
positionSource.start()
}
} }
Loader { Loader {
id: planViewLoader id: planViewLoader
anchors.fill: parent anchors.fill: parent
visible: false visible: false
property var tabletPosition: mainWindow.tabletPosition
} }
Loader { Loader {
id: setupViewLoader id: setupViewLoader
anchors.fill: parent anchors.fill: parent
visible: false 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