Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
70c22ab3
Commit
70c22ab3
authored
Sep 09, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1857 from DonLakeFlyer/MapFixes
Map menu fixes
parents
f323f850
82b91759
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
39 deletions
+47
-39
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+21
-6
FlightMap.qml
src/FlightMap/FlightMap.qml
+26
-33
No files found.
src/FlightDisplay/FlightDisplayView.qml
View file @
70c22ab3
...
...
@@ -51,6 +51,9 @@ Item {
readonly
property
real
_defaultAirSpeed
:
0
readonly
property
real
_defaultClimbRate
:
0
readonly
property
string
_mapName
:
"
FlightDisplayView
"
readonly
property
string
_showMapBackgroundKey
:
"
/showMapBackground
"
property
real
_roll
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
roll
)
?
_defaultRoll
:
_activeVehicle
.
roll
)
:
_defaultRoll
property
real
_pitch
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
pitch
)
?
_defaultPitch
:
_activeVehicle
.
pitch
)
:
_defaultPitch
property
real
_heading
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
heading
)
?
_defaultHeading
:
_activeVehicle
.
heading
)
:
_defaultHeading
...
...
@@ -63,7 +66,10 @@ Item {
property
real
_airSpeed
:
_activeVehicle
?
_activeVehicle
.
airSpeed
:
_defaultAirSpeed
property
real
_climbRate
:
_activeVehicle
?
_activeVehicle
.
climbRate
:
_defaultClimbRate
property
bool
_showMap
:
true
property
bool
_showMap
:
getBool
(
multiVehicleManager
.
loadSetting
(
_mapName
+
_showMapBackgroundKey
,
"
1
"
))
// Validate _showMap setting
Component.onCompleted
:
_setShowMap
(
_showMap
)
function
getBool
(
value
)
{
return
value
===
'
0
'
?
false
:
true
;
...
...
@@ -73,10 +79,15 @@ Item {
return
value
?
"
1
"
:
"
0
"
;
}
function
_setShowMap
(
showMap
)
{
_showMap
=
flightDisplay
.
hasVideo
?
showMap
:
true
multiVehicleManager
.
saveSetting
(
_mapName
+
_showMapBackgroundKey
,
setBool
(
_showMap
))
}
FlightMap
{
id
:
flightMap
anchors.fill
:
parent
mapName
:
"
FlightDisplayView
"
mapName
:
_mapName
latitude
:
parent
.
_latitude
longitude
:
parent
.
_longitude
visible
:
_showMap
...
...
@@ -157,7 +168,7 @@ Item {
x
:
root
.
width
*
0.5
-
ScreenTools
.
defaultFontPixelSize
*
(
5
)
width
:
ScreenTools
.
defaultFontPixelSize
*
(
10
)
height
:
ScreenTools
.
defaultFontPixelSize
*
(
10
)
heading
:
root
.
heading
heading
:
_
heading
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
70
}
...
...
@@ -250,8 +261,9 @@ Item {
checkable
:
true
checked
:
_showMap
text
:
"
Show map as background
"
visible
:
flightDisplay
.
hasVideo
onTriggered
:
_s
howMap
=
true
onTriggered
:
_s
etShowMap
(
true
)
}
MenuItem
{
...
...
@@ -260,11 +272,14 @@ Item {
checkable
:
true
checked
:
!
_showMap
text
:
"
Show video as background
"
visible
:
flightDisplay
.
hasVideo
onTriggered
:
_s
howMap
=
false
onTriggered
:
_s
etShowMap
(
false
)
}
MenuSeparator
{
}
MenuSeparator
{
visible
:
flightDisplay
.
hasVideo
&&
_showMap
}
Component.onCompleted
:
flightMap
.
addMapMenuItems
(
optionsMenu
)
}
...
...
src/FlightMap/FlightMap.qml
View file @
70c22ab3
...
...
@@ -63,48 +63,41 @@ Map {
ExclusiveGroup
{
id
:
mapTypeGroup
}
/*
function setCurrentMap(mapID) {
// Map type selection MenuItem
Component
{
id
:
menuItemComponent
MenuItem
{
checkable
:
true
checked
:
text
==
_map
.
activeMapType
.
name
exclusiveGroup
:
mapTypeGroup
visible
:
_map
.
visible
onTriggered
:
setCurrentMap
(
text
)
}
}
// Set the current map type to the specified type name
function
setCurrentMap
(
name
)
{
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
if (
mapID
=== _map.supportedMapTypes[i].name) {
if
(
name
===
_map
.
supportedMapTypes
[
i
].
name
)
{
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
multiVehicleManager.saveSetting(_map.mapName + "/currentMapType",
mapID
);
multiVehicleManager
.
saveSetting
(
_map
.
mapName
+
"
/currentMapType
"
,
name
);
return
;
}
}
}
function addMap(mapID, checked) {
var mItem = mapTypeMenu.addItem(mapID);
mItem.checkable = true
mItem.checked = checked
mItem.exclusiveGroup = currMapType
var menuSlot = function() {setCurrentMap(mapID);};
mItem.triggered.connect(menuSlot);
}
// Add menu map types to the specified menu and sets the current map type from settings
function
addMapMenuItems
(
menu
)
{
var
mapID = ''
if (_map.supportedMapTypes.length > 0)
mapID = _map.activeMapType.name;
mapID = multiVehicleManager.loadSetting(_map.mapName + "/currentMapType", mapID);
var
savedMapName
=
multiVehicleManager
.
loadSetting
(
_map
.
mapName
+
"
/currentMapType
"
,
""
)
setCurrentMap
(
savedMapName
)
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
var name = _map.supportedMapTypes[i].name;
addMap(name, mapID === name);
}
if(mapID != '')
setCurrentMap(mapID);
}
*/
function
addMapMenuItems
(
menu
)
{
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
var
name
=
_map
.
supportedMapTypes
[
i
].
name
;
var
mItem
=
menu
.
addItem
(
name
);
mItem
.
checkable
=
true
mItem
.
exclusiveGroup
=
mapTypeGroup
//var menuSlot = function() {setCurrentMap(mapID);};
//mItem.triggered.connect(menuSlot);
var
menuItem
=
menuItemComponent
.
createObject
()
menuItem
.
text
=
_map
.
supportedMapTypes
[
i
].
name
menu
.
insertItem
(
menu
.
items
.
length
,
menuItem
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment