@ -7,11 +7,11 @@
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
import QtQuick 2.3
import QtQuick 2.11
import QtQuick . Controls 1. 2
import QtQuick . Controls 2.4
import QtQuick . Controls . Styles 1.4
import QtQuick . Layouts 1.11
import QtQuick . Dialogs 1.3
import QtQuick . Dialogs 1.3
import QtQuick . Layouts 1.2
import QtQuick . Controls . Styles 1.4
import QtLocation 5.3
import QtLocation 5.3
import QtPositioning 5.3
import QtPositioning 5.3
@ -33,10 +33,10 @@ Item {
property string mapKey: "lastMapType"
property string mapKey: "lastMapType"
property var _settingsManager : QGroundControl . settingsManager
property var _settingsManager : QGroundControl . settingsManager
property var _settings : _settingsManager . offlineMapsSettings
property var _settings : _settingsManager ? _settingsManager . offlineMapsSettings : null
property var _fmSettings : _settingsManager . flightMapSettings
property var _fmSettings : _settingsManager ? _settingsManager . flightMapSettings : null
property Fact _mapboxFact : _settingsManager . appSettings . mapboxToken
property Fact _mapboxFact : _settingsManager ? _settingsManager . appSettings.mapboxToken : null
property Fact _esriFact : _settingsManager . appSettings . esriToken
property Fact _esriFact : _settingsManager ? _settingsManager . appSettings.esriToken : null
property string mapType: _fmSettings . mapProvider . enumStringValue + " " + _fmSettings . mapType . enumStringValue
property string mapType: _fmSettings . mapProvider . enumStringValue + " " + _fmSettings . mapType . enumStringValue
property bool isMapInteractive: false
property bool isMapInteractive: false
@ -79,8 +79,6 @@ Item {
}
}
}
}
ExclusiveGroup { id: setGroup }
function handleChanges ( ) {
function handleChanges ( ) {
if ( isMapInteractive ) {
if ( isMapInteractive ) {
var xl = 0
var xl = 0
@ -203,10 +201,6 @@ Item {
_map . zoomLevel = QGroundControl . flightMapZoom
_map . zoomLevel = QGroundControl . flightMapZoom
}
}
ExclusiveGroup {
id: _dropButtonsExclusiveGroup
}
onMapTypeChanged: {
onMapTypeChanged: {
updateMap ( )
updateMap ( )
if ( isMapInteractive ) {
if ( isMapInteractive ) {
@ -222,7 +216,7 @@ Item {
onAcceptedForSave: {
onAcceptedForSave: {
if ( QGroundControl . mapEngineManager . exportSets ( file ) ) {
if ( QGroundControl . mapEngineManager . exportSets ( file ) ) {
rootLoader . sourceComponent = exportToDiskProgress
exportToDiskProgress . open ( )
} else {
} else {
showList ( )
showList ( )
}
}
@ -754,9 +748,6 @@ Item {
model: QGroundControl . mapEngineManager . mapList
model: QGroundControl . mapEngineManager . mapList
onActivated: {
onActivated: {
mapType = textAt ( index )
mapType = textAt ( index )
if ( _dropButtonsExclusiveGroup . current )
_dropButtonsExclusiveGroup . current . checked = false
_dropButtonsExclusiveGroup . current = null
}
}
Component.onCompleted: {
Component.onCompleted: {
var index = mapCombo . find ( mapType )
var index = mapCombo . find ( mapType )
@ -806,18 +797,15 @@ Item {
anchors.left: parent . left
anchors.left: parent . left
anchors.right: parent . right
anchors.right: parent . right
height: sliderTouchArea * 1.25
height: sliderTouchArea * 1.25
minimumValue : minZoomLevel
fro m: minZoomLevel
maximumValue: maxZoomLevel
to: maxZoomLevel
stepSize: 1
stepSize: 1
updateValueWhileDragging: true
live: true
property bool _updateSetting : false
property bool _updateSetting : false
Component.onCompleted: {
Component.onCompleted: {
sliderMinZoom . value = _settings . minZoomLevelDownload . rawValue
sliderMinZoom . value = _settings . minZoomLevelDownload . rawValue
_updateSetting = true
_updateSetting = true
}
}
onValueChanged: {
onValueChanged: {
if ( sliderMinZoom . value > sliderMaxZoom . value ) {
if ( sliderMinZoom . value > sliderMaxZoom . value ) {
sliderMaxZoom . value = sliderMinZoom . value
sliderMaxZoom . value = sliderMinZoom . value
@ -828,28 +816,21 @@ Item {
}
}
handleChanges ( )
handleChanges ( )
}
}
style: SliderStyle {
handle: Rectangle {
groove: Rectangle {
x: sliderMinZoom . leftPadding + sliderMinZoom . visualPosition * ( sliderMinZoom . availableWidth - width )
implicitWidth: sliderMinZoom . width
y: sliderMinZoom . topPadding + sliderMinZoom . availableHeight * 0.5 - height * 0.5
implicitHeight: 4
implicitWidth: sliderTouchArea
color: qgcPal . colorBlue
implicitHeight: sliderTouchArea
radius: 4
radius: sliderTouchArea * 0.5
}
color: qgcPal . button
handle: Rectangle {
border.width: 1
anchors.centerIn: parent
border.color: qgcPal . buttonText
color: qgcPal . button
Label {
border.color: qgcPal . buttonText
text: sliderMinZoom . value
border.width: 1
anchors.centerIn: parent
implicitWidth: sliderTouchArea
font.family: ScreenTools . normalFontFamily
implicitHeight: sliderTouchArea
font.pointSize: ScreenTools . smallFontPointSize
radius: sliderTouchArea * 0.5
color: qgcPal . buttonText
Label {
text: sliderMinZoom . value
anchors.centerIn: parent
font.family: ScreenTools . normalFontFamily
font.pointSize: ScreenTools . smallFontPointSize
color: qgcPal . buttonText
}
}
}
}
}
} / / S l i d e r - m i n z o o m
} / / S l i d e r - m i n z o o m
@ -859,18 +840,15 @@ Item {
anchors.left: parent . left
anchors.left: parent . left
anchors.right: parent . right
anchors.right: parent . right
height: sliderTouchArea * 1.25
height: sliderTouchArea * 1.25
minimumValue : minZoomLevel
fro m: minZoomLevel
maximumValue: maxZoomLevel
to: maxZoomLevel
stepSize: 1
stepSize: 1
updateValueWhileDragging: true
live: true
property bool _updateSetting : false
property bool _updateSetting : false
Component.onCompleted: {
Component.onCompleted: {
sliderMaxZoom . value = _settings . maxZoomLevelDownload . rawValue
sliderMaxZoom . value = _settings . maxZoomLevelDownload . rawValue
_updateSetting = true
_updateSetting = true
}
}
onValueChanged: {
onValueChanged: {
if ( sliderMaxZoom . value < sliderMinZoom . value ) {
if ( sliderMaxZoom . value < sliderMinZoom . value ) {
sliderMinZoom . value = sliderMaxZoom . value
sliderMinZoom . value = sliderMaxZoom . value
@ -881,28 +859,21 @@ Item {
}
}
handleChanges ( )
handleChanges ( )
}
}
style: SliderStyle {
handle: Rectangle {
groove: Rectangle {
x: sliderMaxZoom . leftPadding + sliderMaxZoom . visualPosition * ( sliderMaxZoom . availableWidth - width )
implicitWidth: sliderMaxZoom . width
y: sliderMaxZoom . topPadding + sliderMaxZoom . availableHeight * 0.5 - height * 0.5
implicitHeight: 4
implicitWidth: sliderTouchArea
color: qgcPal . colorBlue
implicitHeight: sliderTouchArea
radius: 4
radius: sliderTouchArea * 0.5
}
color: qgcPal . button
handle: Rectangle {
border.width: 1
anchors.centerIn: parent
border.color: qgcPal . buttonText
color: qgcPal . button
Label {
border.color: qgcPal . buttonText
text: sliderMaxZoom . value
border.width: 1
anchors.centerIn: parent
implicitWidth: sliderTouchArea
font.family: ScreenTools . normalFontFamily
implicitHeight: sliderTouchArea
font.pointSize: ScreenTools . smallFontPointSize
radius: sliderTouchArea * 0.5
color: qgcPal . buttonText
Label {
text: sliderMaxZoom . value
anchors.centerIn: parent
font.family: ScreenTools . normalFontFamily
font.pointSize: ScreenTools . smallFontPointSize
color: qgcPal . buttonText
}
}
}
}
}
} / / S l i d e r - m a x z o o m
} / / S l i d e r - m a x z o o m
@ -977,22 +948,24 @@ Item {
anchors.left: parent . left
anchors.left: parent . left
anchors.right: parent . right
anchors.right: parent . right
contentHeight: _cacheList . height
contentHeight: _cacheList . height
ButtonGroup {
id: buttonGroup
buttons: _cacheList . children
}
Column {
Column {
id: _cacheList
id: _cacheList
width: Math . min ( _tileSetList . width , ( ScreenTools . defaultFontPixelWidth * 50 ) . toFixed ( 0 ) )
width: Math . min ( _tileSetList . width , ( ScreenTools . defaultFontPixelWidth * 50 ) . toFixed ( 0 ) )
spacing: ScreenTools . defaultFontPixelHeight * 0.5
spacing: ScreenTools . defaultFontPixelHeight * 0.5
anchors.horizontalCenter: parent . horizontalCenter
anchors.horizontalCenter: parent . horizontalCenter
ExclusiveGroup { id: selectionGroup }
OfflineMapButton {
OfflineMapButton {
id: firstButton
id: firstButton
text: qsTr ( "Add New Set" )
text: qsTr ( "Add New Set" )
width: _cacheList . width
width: _cacheList . width
height: ScreenTools . defaultFontPixelHeight * ( ScreenTools . isMobile ? 3 : 2 )
height: ScreenTools . defaultFontPixelHeight * ( ScreenTools . isMobile ? 3 : 2 )
currentSet: _currentSelection
currentSet: _currentSelection
exclusiveGroup: selectionGroup
onClicked: {
onClicked: {
offlineMapView . _currentSelection = null
offlineMapView . _currentSelection = null
checked = true
addNewSet ( )
addNewSet ( )
}
}
}
}
@ -1005,11 +978,11 @@ Item {
complete: object . complete
complete: object . complete
width: firstButton . width
width: firstButton . width
height: ScreenTools . defaultFontPixelHeight * ( ScreenTools . isMobile ? 3 : 2 )
height: ScreenTools . defaultFontPixelHeight * ( ScreenTools . isMobile ? 3 : 2 )
exclusiveGroup: selectionGroup
currentSet: _currentSelection
currentSet: _currentSelection
tileSet: object
tileSet: object
onClicked: {
onClicked: {
offlineMapView . _currentSelection = object
offlineMapView . _currentSelection = object
checked = true
showInfo ( )
showInfo ( )
}
}
}
}
@ -1029,7 +1002,7 @@ Item {
visible: QGroundControl . corePlugin . options . showOfflineMapImport
visible: QGroundControl . corePlugin . options . showOfflineMapImport
onClicked: {
onClicked: {
QGroundControl . mapEngineManager . importAction = QGCMapEngineManager . ActionNone
QGroundControl . mapEngineManager . importAction = QGCMapEngineManager . ActionNone
rootLoader . sourceComponent = importDialog
importDialog . open ( )
}
}
}
}
QGCButton {
QGCButton {
@ -1118,160 +1091,161 @@ Item {
}
}
}
}
Component {
Popup {
id: exportToDiskProgress
id: exportToDiskProgress
Rectangle {
width: mainWindow . width * 0.666
width: mainWindow . width
height: mainWindow . height * 0.333
height: mainWindow . height
modal: true
color: "black"
focus: true
anchors.centerIn: parent
parent: Overlay . overlay
Rectangle {
x: Math . round ( ( mainWindow . width - width ) * 0.5 )
width: parent . width * 0.5
y: Math . round ( ( mainWindow . height - height ) * 0.5 )
height: exportCol . height * 1.25
closePolicy: Popup . NoAutoClose
radius: ScreenTools . defaultFontPixelWidth
background: Rectangle {
color: qgcPal . windowShadeDark
anchors.fill: parent
border. color: qgcPal . text
color: qgcPal . windowShadeDark
anchors.centerIn: paren t
border.color: qgcPal . tex t
Column {
radius: ScreenTools . defaultFontPixelWidth
id: exportCol
}
spacing: ScreenTools . defaultFontPixelHeight
Column {
width: parent . width
id: exportCol
anchors.centerIn: paren t
spacing: ScreenTools . defaultFontPixelHeigh t
QGCLabel {
width: parent . width
text: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionExporting ? qsTr ( "Tile Set Export Progress" ) : qsTr ( "Tile Set Export Completed" )
anchors.centerIn: parent
font.family: ScreenTools . demiboldFontFamily
QGCLabel {
font.pointSize: ScreenTools . mediumFontPointSize
text: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionExporting ? qsTr ( "Tile Set Export Progress" ) : qsTr ( "Tile Set Export Completed" )
anchors.horizontalCenter: parent . horizontalCenter
font.family: ScreenTools . demiboldFontFamily
}
font.pointSize: ScreenTools . mediumFontPointSize
ProgressBar {
anchors.horizontalCenter: parent . horizontalCenter
id: progressBar
}
width: parent . width * 0.45
ProgressBar {
maximumValue: 100
width: parent . width * 0.45
value: QGroundControl . mapEngineManager . actionProgress
from: 0
anchors.horizontalCenter: parent . horizontalCenter
to: 100
}
value: QGroundControl . mapEngineManager . actionProgress
BusyIndicator {
anchors.horizontalCenter: parent . horizontalCenter
visible: QGroundControl . mapEngineManager ? QGroundControl . mapEngineManager . importAction === QGCMapEngineManager.ActionExporting : false
}
running: QGroundControl . mapEngineManager ? QGroundControl . mapEngineManager . importAction === QGCMapEngineManager.ActionExporting : false
BusyIndicator {
width: exportCloseButton . height
visible: QGroundControl . mapEngineManager ? QGroundControl . mapEngineManager . importAction === QGCMapEngineManager.ActionExporting : false
height: exportCloseButton . height
running: QGroundControl . mapEngineManager ? QGroundControl . mapEngineManager . importAction === QGCMapEngineManager.ActionExporting : false
anchors.horizontalCenter: parent . horizontalCenter
width: exportCloseButton . height
}
height: exportCloseButton . height
QGCButton {
anchors.horizontalCenter: parent . horizontalCenter
id: exportCloseButton
}
text: qsTr ( "Close" )
QGCButton {
width: _buttonSize
id: exportCloseButton
visible: ! QGroundControl . mapEngineManager . exporting
text: qsTr ( "Close" )
anchors.horizontalCenter: parent . horizontalCenter
width: _buttonSize
onClicked: {
visible: ! QGroundControl . mapEngineManager . exporting
rootLoader . sourceComponent = null
anchors.horizontalCenter: parent . horizontalCenter
}
onClicked: {
}
exportToDiskProgress . close ( )
}
}
}
}
}
}
}
}
Component {
Popup {
id: importDialog
id: importDialog
Rectangle {
width: mainWindow . width * 0.666
width: mainWindow . width
height: importCol . height * 1.5
height: mainWindow . height
modal: true
color: "black"
focus: true
anchors.centerIn: parent
parent: Overlay . overlay
Rectangle {
x: Math . round ( ( mainWindow . width - width ) * 0.5 )
width: parent . width * 0.5
y: Math . round ( ( mainWindow . height - height ) * 0.5 )
height: importCol . height * 1.5
closePolicy: Popup . NoAutoClose
radius: ScreenTools . defaultFontPixelWidth
background: Rectangle {
color: qgcPal . windowShadeDark
anchors.fill: parent
border.color: qgcPal . text
color: qgcPal . windowShadeDark
anchors.centerIn: parent
border.color: qgcPal . text
Column {
radius: ScreenTools . defaultFontPixelWidth
id: importCol
}
spacing: ScreenTools . defaultFontPixelHeight
Column {
width: parent . width
id: importCol
anchors.centerIn: parent
spacing: ScreenTools . defaultFontPixelHeight
QGCLabel {
width: parent . width
text: {
anchors.centerIn: parent
if ( QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone ) {
QGCLabel {
return qsTr ( "Map Tile Set Import" ) ;
text: {
} else if ( QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting ) {
if ( QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone ) {
return qsTr ( "Map Tile Set Import Progress" ) ;
return qsTr ( "Map Tile Set Import" ) ;
} else {
} else if ( QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting ) {
return qsTr ( "Map Tile Set Import Completed" ) ;
return qsTr ( "Map Tile Set Import Progress" ) ;
}
} else {
}
return qsTr ( "Map Tile Set Import Completed" ) ;
font.family: ScreenTools . demiboldFontFamily
font.pointSize: ScreenTools . mediumFontPointSize
anchors.horizontalCenter: parent . horizontalCenter
}
ProgressBar {
id: progressBar
width: parent . width * 0.45
maximumValue: 100
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting
value: QGroundControl . mapEngineManager . actionProgress
anchors.horizontalCenter: parent . horizontalCenter
}
BusyIndicator {
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting
running: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting
width: ScreenTools . defaultFontPixelWidth * 2
height: width
anchors.horizontalCenter: parent . horizontalCenter
}
ExclusiveGroup { id: radioGroup }
Column {
spacing: ScreenTools . defaultFontPixelHeight
width: ScreenTools . defaultFontPixelWidth * 24
anchors.horizontalCenter: parent . horizontalCenter
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr ( "Append to existing set" )
checked: ! QGroundControl . mapEngineManager . importReplace
onClicked: QGroundControl . mapEngineManager . importReplace = ! checked
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr ( "Replace existing set" )
checked: QGroundControl . mapEngineManager . importReplace
onClicked: QGroundControl . mapEngineManager . importReplace = checked
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone
}
}
}
QGCButton {
}
text: qsTr ( "Close" )
font.family: ScreenTools . demiboldFontFamily
width: _bigButtonSize * 1.25
font.pointSize: ScreenTools . mediumFontPointSize
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionDone
anchors.horizontalCenter: parent . horizontalCenter
anchors.horizontalCenter: parent . horizontalCenter
}
onClicked: {
ProgressBar {
showList ( ) ;
width: parent . width * 0.45
rootLoader . sourceComponent = null
from: 0
}
to: 100
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting
value: QGroundControl . mapEngineManager . actionProgress
anchors.horizontalCenter: parent . horizontalCenter
}
BusyIndicator {
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting
running: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionImporting
width: ScreenTools . defaultFontPixelWidth * 2
height: width
anchors.horizontalCenter: parent . horizontalCenter
}
ButtonGroup {
buttons: mapSetButtons . children
}
Column {
id: mapSetButtons
spacing: ScreenTools . defaultFontPixelHeight
width: ScreenTools . defaultFontPixelWidth * 24
anchors.horizontalCenter: parent . horizontalCenter
QGCRadioButton {
text: qsTr ( "Append to existing set" )
checked: ! QGroundControl . mapEngineManager . importReplace
onClicked: QGroundControl . mapEngineManager . importReplace = ! checked
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone
}
QGCRadioButton {
text: qsTr ( "Replace existing set" )
checked: QGroundControl . mapEngineManager . importReplace
onClicked: QGroundControl . mapEngineManager . importReplace = checked
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone
}
}
QGCButton {
text: qsTr ( "Close" )
width: _bigButtonSize * 1.25
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionDone
anchors.horizontalCenter: parent . horizontalCenter
onClicked: {
showList ( ) ;
importDialog . close ( )
}
}
Row {
spacing: _margins
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone
anchors.horizontalCenter: parent . horizontalCenter
QGCButton {
text: qsTr ( "Import" )
width: _bigButtonSize * 1.25
onClicked: {
importDialog . close ( )
fileDialog . title = qsTr ( "Import Tile Set" )
fileDialog . selectExisting = true
fileDialog . openForLoad ( )
}
}
Row {
}
spacing: _margins
QGCButton {
visible: QGroundControl . mapEngineManager . importAction === QGCMapEngineManager . ActionNone
text: qsTr ( "Cancel" )
anchors.horizontalCenter: parent . horizontalCenter
width: _bigButtonSize * 1.25
QGCButton {
onClicked: {
text: qsTr ( "Import" )
showList ( ) ;
width: _bigButtonSize * 1.25
importDialog . close ( )
onClicked: {
rootLoader . sourceComponent = null
fileDialog . title = qsTr ( "Import Tile Set" )
fileDialog . selectExisting = true
fileDialog . openForLoad ( )
}
}
QGCButton {
text: qsTr ( "Cancel" )
width: _bigButtonSize * 1.25
onClicked: {
showList ( ) ;
rootLoader . sourceComponent = null
}
}
}
}
}
}
}
}