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
8ff2956f
Commit
8ff2956f
authored
Sep 28, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make DropButton's actually do commands
parent
f50329c1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
73 deletions
+112
-73
qgroundcontrol.qrc
qgroundcontrol.qrc
+4
-0
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+35
-6
FlightMap.qml
src/FlightMap/FlightMap.qml
+11
-34
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+49
-18
DropButton.qml
src/QmlControls/DropButton.qml
+13
-15
No files found.
qgroundcontrol.qrc
View file @
8ff2956f
...
...
@@ -43,6 +43,7 @@
<file alias="PowerComponentBattery_04cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_04cell.svg</file>
<file alias="PowerComponentBattery_05cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_05cell.svg</file>
<file alias="PowerComponentBattery_06cell.svg">src/AutoPilotPlugins/PX4/Images/PowerComponentBattery_06cell.svg</file>
<file alias="attitudeDial.svg">src/FlightMap/Images/attitudeDial.svg</file>
<file alias="attitudeInstrument.svg">src/FlightMap/Images/attitudeInstrument.svg</file>
<file alias="attitudePointer.svg">src//FlightMap/Images/attitudePointer.svg</file>
...
...
@@ -61,6 +62,8 @@
<file alias="scale_end.png">src/FlightMap/Images/scale_end.png</file>
<file alias="airplaneOutline.svg">src/FlightMap/Images/airplaneOutline.svg</file>
<file alias="airplaneOpaque.svg">src/FlightMap/Images/airplaneOpaque.svg</file>
<file alias="MapType.svg">src/FlightMap/Images/MapType.svg</file>
<file alias="MapCenter.svg">src/FlightMap/Images/MapCenter.svg</file>
</qresource>
<qresource prefix="/qml">
<file alias="test.qml">src/test.qml</file>
...
...
@@ -102,6 +105,7 @@
<file alias="QGroundControl/Controls/MissionItemSummary.qml">src/QmlControls/MissionItemSummary.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/DropButton.qml">src/QmlControls/DropButton.qml</file>
<file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<!-- Vehicle Setup -->
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
...
...
src/FlightDisplay/FlightDisplayView.qml
View file @
8ff2956f
...
...
@@ -27,6 +27,7 @@ import QtQuick.Controls.Styles 1.2
import
QtQuick
.
Dialogs
1.2
import
QtLocation
5.3
import
QGroundControl
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
...
...
@@ -66,7 +67,7 @@ Item {
property
real
_airSpeed
:
_activeVehicle
?
_activeVehicle
.
airSpeed
:
_defaultAirSpeed
property
real
_climbRate
:
_activeVehicle
?
_activeVehicle
.
climbRate
:
_defaultClimbRate
property
bool
_showMap
:
getBool
(
multiVehicleManager
.
loadSetting
(
_mapName
+
_showMapBackgroundKey
,
"
1
"
))
property
bool
_showMap
:
getBool
(
QGroundControl
.
flightMapSettings
.
loadMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
"
1
"
))
// Validate _showMap setting
Component.onCompleted
:
_setShowMap
(
_showMap
)
...
...
@@ -81,7 +82,7 @@ Item {
function
_setShowMap
(
showMap
)
{
_showMap
=
flightDisplay
.
hasVideo
?
showMap
:
true
multiVehicleManager
.
saveSetting
(
_mapName
+
_showMapBackgroundKey
,
setBool
(
_showMap
))
QGroundControl
.
flightMapSettings
.
saveMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
setBool
(
_showMap
))
}
FlightMap
{
...
...
@@ -141,7 +142,6 @@ Item {
size
:
ScreenTools
.
defaultFontPixelSize
*
(
13.3
)
heading
:
_heading
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
flightMap
.
z
+
2
}
QGCAttitudeWidget
{
...
...
@@ -152,8 +152,39 @@ Item {
rollAngle
:
_roll
pitchAngle
:
_pitch
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
flightMap
.
z
+
2
}
DropButton
{
id
:
mapTypeButton
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
dropDirection
:
dropDown
buttonImage
:
"
/qmlimages/MapType.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
dropDownComponent
:
Component
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
Repeater
{
model
:
QGroundControl
.
flightMapSettings
.
mapTypes
QGCButton
{
checkable
:
true
checked
:
flightMap
.
mapType
==
text
text
:
modelData
onClicked
:
{
flightMap
.
mapType
=
text
mapTypeButton
.
hideDropDown
()
}
}
}
}
}
}
}
// Flight Map
QGCVideoBackground
{
...
...
@@ -280,8 +311,6 @@ Item {
MenuSeparator
{
visible
:
flightDisplay
.
hasVideo
&&
_showMap
}
Component.onCompleted
:
flightMap
.
addMapMenuItems
(
optionsMenu
)
}
}
}
src/FlightMap/FlightMap.qml
View file @
8ff2956f
...
...
@@ -32,6 +32,7 @@ import QtQuick.Controls 1.3
import
QtLocation
5.3
import
QtPositioning
5.3
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
ScreenTools
1.0
...
...
@@ -47,6 +48,7 @@ Map {
property
real
heading
:
0
property
bool
interactive
:
true
property
string
mapName
:
'
defaultMap
'
property
string
mapType
:
QGroundControl
.
flightMapSettings
.
mapTypeForMapName
(
mapName
)
property
alias
mapWidgets
:
controlWidgets
property
bool
isSatelliteMap
:
false
...
...
@@ -61,45 +63,20 @@ Map {
plugin
:
Plugin
{
name
:
"
QGroundControl
"
}
ExclusiveGroup
{
id
:
mapTypeGroup
}
// 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
)
{
Component.onCompleted
:
onMapTypeChanged
onMapTypeChanged
:
{
QGroundControl
.
flightMapSettings
.
setMapTypeForMapName
(
mapName
,
mapType
)
var
fullMapName
=
QGroundControl
.
flightMapSettings
.
mapProvider
+
"
"
+
mapType
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
if
(
n
ame
===
_map
.
supportedMapTypes
[
i
].
name
)
{
if
(
fullMapN
ame
===
_map
.
supportedMapTypes
[
i
].
name
)
{
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
multiVehicleManager
.
saveSetting
(
_map
.
mapName
+
"
/currentMapType
"
,
name
);
return
;
return
}
}
}
// Add menu map types to the specified menu and sets the current map type from settings
function
addMapMenuItems
(
menu
)
{
var
savedMapName
=
multiVehicleManager
.
loadSetting
(
_map
.
mapName
+
"
/currentMapType
"
,
""
)
setCurrentMap
(
savedMapName
)
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
var
menuItem
=
menuItemComponent
.
createObject
()
menuItem
.
text
=
_map
.
supportedMapTypes
[
i
].
name
menu
.
insertItem
(
menu
.
items
.
length
,
menuItem
)
}
}
/// Map control widgets
Column
{
id
:
controlWidgets
...
...
src/MissionEditor/MissionEditor.qml
View file @
8ff2956f
...
...
@@ -104,7 +104,7 @@ QGCView {
anchors.right
:
mapTypeButton
.
left
anchors.top
:
mapTypeButton
.
top
dropDirection
:
dropDown
label
:
"
C
"
buttonImage
:
"
/qmlimages/MapCenter.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
dropDownComponent
:
Component
{
...
...
@@ -114,14 +114,48 @@ QGCView {
QGCButton
{
text
:
"
Home
"
onClicked
:
centerMapButton
.
hideDropDown
()
onClicked
:
{
centerMapButton
.
hideDropDown
()
editorMap
.
center
=
QtPositioning
.
coordinate
(
_homePositionCoordinate
.
latitude
,
_homePositionCoordinate
.
longitude
)
_showHomePositionManager
=
true
}
}
/*
This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5
QGCButton {
text: "All Items"
onClicked
:
centerMapButton
.
hideDropDown
()
onClicked: {
centerMapButton.hideDropDown()
// Begin with only the home position in the region
var region = QtPositioning.rectangle(QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude),
QtPositioning.coordinate(_homePositionCoordinate.latitude, _homePositionCoordinate.longitude))
// Now expand the region to include all mission items
for (var i=0; i<_missionItems.count; i++) {
var missionItem = _missionItems.get(i)
region.topLeft.latitude = Math.max(missionItem.coordinate.latitude, region.topLeft.latitude)
region.topLeft.longitude = Math.min(missionItem.coordinate.longitude, region.topLeft.longitude)
region.topRight.latitude = Math.max(missionItem.coordinate.latitude, region.topRight.latitude)
region.topRight.longitude = Math.max(missionItem.coordinate.longitude, region.topRight.longitude)
region.bottomLeft.latitude = Math.min(missionItem.coordinate.latitude, region.bottomLeft.latitude)
region.bottomLeft.longitude = Math.min(missionItem.coordinate.longitude, region.bottomLeft.longitude)
region.bottomRight.latitude = Math.min(missionItem.coordinate.latitude, region.bottomRight.latitude)
region.bottomRight.longitude = Math.max(missionItem.coordinate.longitude, region.bottomRight.longitude)
}
editorMap.visibleRegion = region
}
}
*/
}
}
}
...
...
@@ -132,29 +166,26 @@ QGCView {
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
dropDirection
:
dropDown
label
:
"
M
"
buttonImage
:
"
/qmlimages/MapType.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
dropDownComponent
:
Component
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCButton
{
text
:
"
Street
"
onClicked
:
mapTypeButton
.
hideDropDown
()
}
QGCButton
{
text
:
"
Satellite
"
onClicked
:
mapTypeButton
.
hideDropDown
()
}
Repeater
{
model
:
QGroundControl
.
flightMapSettings
.
mapTypes
QGCButton
{
text
:
"
Hybrid
"
QGCButton
{
checkable
:
true
checked
:
editorMap
.
mapType
==
text
text
:
modelData
onClicked
:
mapTypeButton
.
hideDropDown
()
onClicked
:
{
editorMap
.
mapType
=
text
mapTypeButton
.
hideDropDown
()
}
}
}
}
}
...
...
src/QmlControls/DropButton.qml
View file @
8ff2956f
...
...
@@ -8,8 +8,8 @@ import QGroundControl.Palette 1.0
Item
{
id
:
_root
property
alias
label
:
buttonLabel
.
text
property
alias
radius
:
button
.
radius
property
alias
buttonImage
:
button
.
source
property
real
radius
:
(
ScreenTools
.
defaultFontPixelHeight
*
3
)
/
2
property
int
dropDirection
:
dropDown
property
alias
dropDownComponent
:
dropDownLoader
.
sourceComponent
property
real
viewportMargins
:
0
...
...
@@ -144,33 +144,24 @@ Item {
}
// Button
Rectangl
e
{
Imag
e
{
id
:
button
anchors.fill
:
parent
radius
:
(
ScreenTools
.
defaultFontPixelHeight
*
3
)
/
2
color
:
qgcPal
.
button
fillMode
:
Image
.
PreserveAspectFit
opacity
:
_showDropDown
?
1.0
:
0.75
QGCLabel
{
id
:
buttonLabel
anchors.fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
color
:
"
white
"
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
_showDropDown
=
!
_showDropDown
}
}
//
Rectangl
e - button
}
//
Imag
e - button
Item
{
id
:
dropDownItem
visible
:
_showDropDown
Canvas
{
QGC
Canvas
{
id
:
arrowCanvas
anchors.fill
:
parent
...
...
@@ -224,6 +215,13 @@ Item {
id
:
dropDownLoader
x
:
_dropMargin
y
:
_dropMargin
Connections
{
target
:
dropDownLoader
.
item
onWidthChanged
:
_calcPositions
()
onHeightChanged
:
_calcPositions
()
}
}
}
}
// Item - dropDownItem
...
...
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