Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
9075dbb3
Commit
9075dbb3
authored
Apr 16, 2015
by
Don Gagne
Browse files
Merge pull request #1462 from dogmaphobic/flightView
Finalizing Primary Flight Control
parents
81e22ad4
167813ba
Changes
29
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.qrc
View file @
9075dbb3
...
...
@@ -100,7 +100,9 @@
<file alias="QGroundControl/FlightControls/qmldir">src/ui/qmlcommon/qmldir</file>
<file alias="QGroundControl/FlightControls/QGCAltitudeWidget.qml">src/ui/qmlcommon/QGCAltitudeWidget.qml</file>
<file alias="QGroundControl/FlightControls/QGCAttitudeWidget.qml">src/ui/qmlcommon/QGCAttitudeWidget.qml</file>
<file alias="QGroundControl/FlightControls/QGCAttitudeInstrument.qml">src/ui/qmlcommon/QGCAttitudeInstrument.qml</file>
<file alias="QGroundControl/FlightControls/QGCCompass.qml">src/ui/qmlcommon/QGCCompass.qml</file>
<file alias="QGroundControl/FlightControls/QGCCompassInstrument.qml">src/ui/qmlcommon/QGCCompassInstrument.qml</file>
<file alias="QGroundControl/FlightControls/QGCCurrentAltitude.qml">src/ui/qmlcommon/QGCCurrentAltitude.qml</file>
<file alias="QGroundControl/FlightControls/QGCCurrentSpeed.qml">src/ui/qmlcommon/QGCCurrentSpeed.qml</file>
<file alias="QGroundControl/FlightControls/QGCMapBackground.qml">src/ui/qmlcommon/QGCMapBackground.qml</file>
...
...
@@ -109,19 +111,24 @@
<file alias="QGroundControl/FlightControls/QGCSlider.qml">src/ui/qmlcommon/QGCSlider.qml</file>
<file alias="QGroundControl/FlightControls/QGCWaypointEditor.qml">src/ui/qmlcommon/QGCWaypointEditor.qml</file>
<file alias="QGroundControl/FlightControls/QGCMapToolButton.qml">src/ui/qmlcommon/QGCMapToolButton.qml</file>
<file alias="QGroundControl/FlightControls/QGCArtificialHorizon.qml">src/ui/qmlcommon/QGCArtificialHorizon.qml</file>
<!-- QML Main UI Resources -->
<file alias="compass.svg">src/ui/qmlcommon/compass.svg</file>
<file alias="compassNeedle.svg">src/ui/qmlcommon/compassNeedle.svg</file>
<file alias="crossHair.svg">src/ui/qmlcommon/crossHair.svg</file>
<file alias="rollDial.svg">src/ui/qmlcommon/rollDial.svg</file>
<file alias="rollDialWhite.svg">src/ui/qmlcommon/rollDialWhite.svg</file>
<file alias="rollPointer.svg">src/ui/qmlcommon/rollPointer.svg</file>
<file alias="rollPointerWhite.svg">src/ui/qmlcommon/rollPointerWhite.svg</file>
<file alias="scale.png">src/ui/qmlcommon/scale.png</file>
<file alias="scale_end.png">src/ui/qmlcommon/scale_end.png</file>
<file alias="buttonLeft.svg">src/ui/qmlcommon/buttonLeft.svg</file>
<file alias="buttonRight.svg">src/ui/qmlcommon/buttonRight.svg</file>
<file alias="buttonHome.svg">src/ui/qmlcommon/buttonHome.svg</file>
<file alias="buttonMore.svg">src/ui/qmlcommon/buttonMore.svg</file>
<file alias="attitudeInstrument.svg">src/ui/qmlcommon/attitudeInstrument.svg</file>
<file alias="attitudeDial.svg">src/ui/qmlcommon/attitudeDial.svg</file>
<file alias="attitudePointer.svg">src/ui/qmlcommon/attitudePointer.svg</file>
<file alias="compassInstrumentAirplane.svg">src/ui/qmlcommon/compassInstrumentAirplane.svg</file>
<file alias="compassInstrumentDial.svg">src/ui/qmlcommon/compassInstrumentDial.svg</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
...
...
src/QtLocationPlugin/OpenPilotMaps.h
View file @
9075dbb3
...
...
@@ -38,6 +38,8 @@ This file is part of the QGROUNDCONTROL project
#include
<QNetworkReply>
#include
<QMutex>
#define MAX_MAP_ZOOM (20.0)
namespace
OpenPilot
{
enum
MapType
...
...
src/QtLocationPlugin/qgeomapreplyqgc.cpp
View file @
9075dbb3
...
...
@@ -53,9 +53,17 @@ QGeoMapReplyQGC::QGeoMapReplyQGC(QNetworkReply *reply, const QGeoTileSpec &spec,
:
QGeoTiledMapReply
(
spec
,
parent
)
,
m_reply
(
reply
)
{
connect
(
m_reply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
networkReplyFinished
()));
connect
(
m_reply
,
SIGNAL
(
error
(
QNetworkReply
::
NetworkError
)),
this
,
SLOT
(
networkReplyError
(
QNetworkReply
::
NetworkError
)));
connect
(
m_reply
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
replyDestroyed
()));
if
(
!
reply
)
{
setError
(
QGeoTiledMapReply
::
UnknownError
,
"Invalid tile request"
);
setFinished
(
true
);
}
else
{
connect
(
m_reply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
networkReplyFinished
()));
connect
(
m_reply
,
SIGNAL
(
error
(
QNetworkReply
::
NetworkError
)),
this
,
SLOT
(
networkReplyError
(
QNetworkReply
::
NetworkError
)));
connect
(
m_reply
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
replyDestroyed
()));
}
}
QGeoMapReplyQGC
::~
QGeoMapReplyQGC
()
...
...
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.cpp
View file @
9075dbb3
...
...
@@ -59,7 +59,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
{
QGeoCameraCapabilities
cameraCaps
;
cameraCaps
.
setMinimumZoomLevel
(
2.0
);
cameraCaps
.
setMaximumZoomLevel
(
20.0
);
cameraCaps
.
setMaximumZoomLevel
(
MAX_MAP_ZOOM
);
cameraCaps
.
setSupportsBearing
(
true
);
setCameraCapabilities
(
cameraCaps
);
...
...
src/ui/flightdisplay/FlightDisplay.qml
View file @
9075dbb3
...
...
@@ -40,6 +40,10 @@ Rectangle {
property
real
roll
:
isNaN
(
flightDisplay
.
roll
)
?
0
:
flightDisplay
.
roll
property
real
pitch
:
isNaN
(
flightDisplay
.
pitch
)
?
0
:
flightDisplay
.
pitch
property
bool
showPitchIndicator
:
true
property
bool
showAttitudeIndicator
:
true
property
bool
showCompass
:
true
function
getBool
(
value
)
{
return
value
===
'
0
'
?
false
:
true
;
}
...
...
@@ -48,65 +52,141 @@ Rectangle {
return
value
?
"
1
"
:
"
0
"
;
}
function
adjustSizes
()
{
var
dist
=
85
var
wide
=
160
var
minw
=
496
if
(
root
.
width
>
minw
)
{
attitudeInstrument
.
size
=
wide
;
attitudeInstrument
.
x
=
dist
compassInstrument
.
size
=
wide
;
compassInstrument
.
x
=
root
.
width
-
wide
-
dist
}
else
{
var
factor
=
(
root
.
width
/
minw
);
var
ndist
=
dist
*
factor
;
var
nwide
=
wide
*
factor
;
if
(
ndist
<
0
)
ndist
=
0
;
attitudeInstrument
.
size
=
nwide
;
compassInstrument
.
size
=
nwide
;
attitudeInstrument
.
x
=
ndist
;
compassInstrument
.
x
=
root
.
width
-
nwide
-
ndist
;
}
}
Component.onCompleted
:
{
mapBackground
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showMapBackground
"
,
"
0
"
));
mapBackground
.
alwaysNorth
=
getBool
(
flightDisplay
.
loadSetting
(
"
mapAlwaysPointsNorth
"
,
"
0
"
));
a
ttitude
Widget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAttitude
Widget
"
,
"
1
"
));
attitudeWidget
.
displayBackground
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
AttitudeBackground
"
,
"
1
"
));
pitchWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
PitchWidget
"
,
"
1
"
));
showA
ttitude
Indicator
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAttitude
Indicator
"
,
"
1
"
));
showPitchIndicator
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
PitchIndicator
"
,
"
1
"
));
showCompass
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
Compass
"
,
"
1
"
));
altitudeWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAltitudeWidget
"
,
"
1
"
));
speedWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showSpeedWidget
"
,
"
1
"
));
compassIndicator
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCompassIndicator
"
,
"
1
"
));
currentSpeed
.
showAirSpeed
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentAirSpeed
"
,
"
1
"
));
currentSpeed
.
showGroundSpeed
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentGroundSpeed
"
,
"
1
"
));
currentAltitude
.
showClimbRate
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentClimbRate
"
,
"
1
"
));
currentAltitude
.
showAltitude
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentAltitude
"
,
"
1
"
));
mapTypeMenu
.
update
();
}
Rectangle
{
id
:
windowBackground
anchors.fill
:
parent
anchors.centerIn
:
parent
visible
:
!
attitudeWidget
.
visible
&&
!
mapBackground
.
visible
color
:
Qt
.
hsla
(
0.25
,
0.5
,
0.45
)
z
:
0
adjustSizes
();
}
Menu
{
id
:
contextMenu
MenuItem
{
text
:
"
Ma
in Attitude Indicators
"
text
:
"
Ma
p Background
"
checkable
:
true
checked
:
attitudeWidget
.
visible
checked
:
mapBackground
.
visible
onTriggered
:
{
attitudeWidget
.
visible
=
!
attitudeWidget
.
visible
;
flightDisplay
.
saveSetting
(
"
show
AttitudeWidget
"
,
setBool
(
attitudeWidget
.
visible
));
mapBackground
.
visible
=
!
mapBackground
.
visible
;
flightDisplay
.
saveSetting
(
"
show
MapBackground
"
,
setBool
(
mapBackground
.
visible
));
}
}
/*
MenuItem {
text
:
"
Display Attitude Background
"
text: "
Map Always Points North
"
checkable: true
checked
:
attitudeWidget
.
displayBackground
checked:
mapBackground.alwaysNorth
onTriggered:
{
attitudeWidget
.
displayBackground
=
!
attitudeWidget
.
displayBackground
;
flightDisplay
.
saveSetting
(
"
showAttitudeBackground
"
,
setBool
(
attitudeWidget
.
displayBackground
));
mapBackground.alwaysNorth = !mapBackground.alwaysNorth;
flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
}
}
*/
Menu
{
id
:
mapTypeMenu
title
:
"
Map Type...
"
ExclusiveGroup
{
id
:
currentMapType
}
function
setCurrentMap
(
map
)
{
for
(
var
i
=
0
;
i
<
mapBackground
.
mapItem
.
supportedMapTypes
.
length
;
i
++
)
{
if
(
map
===
mapBackground
.
mapItem
.
supportedMapTypes
[
i
].
name
)
{
mapBackground
.
mapItem
.
activeMapType
=
mapBackground
.
mapItem
.
supportedMapTypes
[
i
]
flightDisplay
.
saveSetting
(
"
currentMapType
"
,
map
);
return
;
}
}
}
function
addMap
(
map
,
checked
)
{
var
mItem
=
mapTypeMenu
.
addItem
(
map
);
mItem
.
checkable
=
true
mItem
.
checked
=
checked
mItem
.
exclusiveGroup
=
currentMapType
var
menuSlot
=
function
()
{
setCurrentMap
(
map
);};
mItem
.
triggered
.
connect
(
menuSlot
);
}
function
update
()
{
clear
()
var
map
=
''
if
(
mapBackground
.
mapItem
.
supportedMapTypes
.
length
>
0
)
map
=
mapBackground
.
mapItem
.
activeMapType
.
name
;
map
=
flightDisplay
.
loadSetting
(
"
currentMapType
"
,
map
);
for
(
var
i
=
0
;
i
<
mapBackground
.
mapItem
.
supportedMapTypes
.
length
;
i
++
)
{
var
name
=
mapBackground
.
mapItem
.
supportedMapTypes
[
i
].
name
;
addMap
(
name
,
map
===
name
);
}
if
(
map
!=
''
)
setCurrentMap
(
map
);
}
}
MenuSeparator
{}
MenuItem
{
text
:
"
Pitch Indicator
"
checkable
:
true
checked
:
showPitchIndicator
onTriggered
:
{
showPitchIndicator
=
!
showPitchIndicator
;
flightDisplay
.
saveSetting
(
"
showPitchIndicator
"
,
setBool
(
showPitchIndicator
));
}
}
MenuItem
{
text
:
"
Attitude Indicator
"
checkable
:
true
checked
:
showAttitudeIndicator
onTriggered
:
{
showAttitudeIndicator
=
!
showAttitudeIndicator
;
flightDisplay
.
saveSetting
(
"
showAttitudeIndicator
"
,
setBool
(
showAttitudeIndicator
));
}
}
MenuItem
{
text
:
"
Compass
"
checkable
:
true
checked
:
pitchWidget
.
visible
checked
:
showCompass
onTriggered
:
{
pitchWidget
.
visible
=
!
pitchWidget
.
visible
;
flightDisplay
.
saveSetting
(
"
show
PitchWidget
"
,
setBool
(
pitchWidget
.
visible
));
showCompass
=
!
showCompass
;
flightDisplay
.
saveSetting
(
"
show
Compass
"
,
setBool
(
showCompass
));
}
}
...
...
@@ -176,91 +256,18 @@ Rectangle {
}
}
MenuItem
{
text
:
"
Compass
"
checkable
:
true
checked
:
compassIndicator
.
visible
onTriggered
:
{
compassIndicator
.
visible
=
!
compassIndicator
.
visible
;
flightDisplay
.
saveSetting
(
"
showCompassIndicator
"
,
setBool
(
compassIndicator
.
visible
));
}
}
MenuSeparator
{}
MenuItem
{
text
:
"
Map Background
"
checkable
:
true
checked
:
mapBackground
.
visible
onTriggered
:
{
mapBackground
.
visible
=
!
mapBackground
.
visible
;
flightDisplay
.
saveSetting
(
"
showMapBackground
"
,
setBool
(
mapBackground
.
visible
));
}
}
/*
MenuItem {
text: "Map Always Points North"
checkable: true
checked: mapBackground.alwaysNorth
onTriggered:
{
mapBackground.alwaysNorth = !mapBackground.alwaysNorth;
flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
}
}
*/
Menu
{
id
:
mapTypeMenu
title
:
"
Map Type...
"
ExclusiveGroup
{
id
:
currentMapType
}
function
setCurrentMap
(
map
)
{
for
(
var
i
=
0
;
i
<
mapBackground
.
mapItem
.
supportedMapTypes
.
length
;
i
++
)
{
if
(
map
===
mapBackground
.
mapItem
.
supportedMapTypes
[
i
].
name
)
{
mapBackground
.
mapItem
.
activeMapType
=
mapBackground
.
mapItem
.
supportedMapTypes
[
i
]
flightDisplay
.
saveSetting
(
"
currentMapType
"
,
map
);
return
;
}
}
}
function
addMap
(
map
,
checked
)
{
var
mItem
=
mapTypeMenu
.
addItem
(
map
);
mItem
.
checkable
=
true
mItem
.
checked
=
checked
mItem
.
exclusiveGroup
=
currentMapType
var
menuSlot
=
function
()
{
setCurrentMap
(
map
);};
mItem
.
triggered
.
connect
(
menuSlot
);
}
function
update
()
{
clear
()
var
map
=
''
if
(
mapBackground
.
mapItem
.
supportedMapTypes
.
length
>
0
)
map
=
mapBackground
.
mapItem
.
activeMapType
.
name
;
map
=
flightDisplay
.
loadSetting
(
"
currentMapType
"
,
map
);
for
(
var
i
=
0
;
i
<
mapBackground
.
mapItem
.
supportedMapTypes
.
length
;
i
++
)
{
var
name
=
mapBackground
.
mapItem
.
supportedMapTypes
[
i
].
name
;
addMap
(
name
,
map
===
name
);
}
if
(
map
!=
''
)
setCurrentMap
(
map
);
}
}
MenuSeparator
{}
MenuItem
{
text
:
"
Restore Defaults
"
onTriggered
:
{
attitudeWidget
.
visible
=
true
;
flightDisplay
.
saveSetting
(
"
show
AttitudeWidget
"
,
setBool
(
attitudeWidget
.
visible
));
a
ttitude
Widget
.
displayBackground
=
true
;
flightDisplay
.
saveSetting
(
"
showAttitude
Background
"
,
setBool
(
a
ttitude
Widget
.
displayBackground
));
pitchWidget
.
visible
=
true
;
flightDisplay
.
saveSetting
(
"
show
PitchWidget
"
,
setBool
(
pitchWidget
.
visible
));
showPitchIndicator
=
true
;
flightDisplay
.
saveSetting
(
"
show
PitchIndicator
"
,
setBool
(
showPitchIndicator
));
showA
ttitude
Indicator
=
true
;
flightDisplay
.
saveSetting
(
"
showAttitude
Indicator
"
,
setBool
(
showA
ttitude
Indicator
));
showCompass
=
true
;
flightDisplay
.
saveSetting
(
"
show
Compass
"
,
setBool
(
showCompass
));
altitudeWidget
.
visible
=
true
;
flightDisplay
.
saveSetting
(
"
showAltitudeWidget
"
,
setBool
(
altitudeWidget
.
visible
));
currentAltitude
.
showAltitude
=
true
;
...
...
@@ -273,8 +280,6 @@ Rectangle {
flightDisplay
.
saveSetting
(
"
showCurrentAirSpeed
"
,
setBool
(
currentSpeed
.
showAirSpeed
));
currentSpeed
.
showGroundSpeed
=
true
;
flightDisplay
.
saveSetting
(
"
showCurrentGroundSpeed
"
,
setBool
(
currentSpeed
.
showGroundSpeed
));
compassIndicator
.
visible
=
true
;
flightDisplay
.
saveSetting
(
"
showCompassIndicator
"
,
setBool
(
compassIndicator
.
visible
));
mapBackground
.
visible
=
false
;
flightDisplay
.
saveSetting
(
"
showMapBackground
"
,
setBool
(
mapBackground
.
visible
));
mapBackground
.
alwaysNorth
=
false
;
...
...
@@ -285,13 +290,13 @@ Rectangle {
}
QGCMapBackground
{
id
:
mapBackground
anchors.fill
:
parent
visible
:
false
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
l
at
itude
:
flightDisplay
.
latitude
longitude
:
flightDisplay
.
longitude
z
:
5
id
:
mapBackground
anchors.fill
:
parent
heading
:
0
// isNaN(flightDisplay.heading) ? 0 : flightDisplay.heading
latitude
:
mapBackground
.
visible
?
((
flightDisplay
.
latitude
===
0
)
?
37.803784
:
flightDisplay
.
latitude
)
:
37.803784
l
ong
itude
:
mapBackground
.
visible
?
((
flightDisplay
.
longitude
===
0
)
?
-
122.462276
:
flightDisplay
.
longitude
)
:
-
122.462276
interactive
:
!
flightDisplay
.
mavPresent
z
:
10
}
QGCAttitudeWidget
{
...
...
@@ -299,44 +304,36 @@ Rectangle {
anchors.centerIn
:
parent
rollAngle
:
roll
pitchAngle
:
pitch
useWhite
:
!
mapBackground
.
visible
backgroundOpacity
:
mapBackground
.
visible
?
0.25
:
1.0
showAttitude
:
showAttitudeIndicator
visible
:
!
mapBackground
.
visible
z
:
10
}
QGCPitchWidget
{
id
:
pitchWidget
id
:
pitchWidget
visible
:
showPitchIndicator
&&
!
mapBackground
.
visible
anchors.verticalCenter
:
parent
.
verticalCenter
pitchAngle
:
pitch
rollAngle
:
roll
color
:
mapBackground
.
visible
?
Qt
.
rgba
(
0
,
0
,
0
,
0.5
)
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
opacity
:
mapBackground
.
visible
?
1
:
0.75
z
:
mapBackground
.
visible
?
20
:
25
}
Image
{
anchors.centerIn
:
parent
source
:
"
/qml/crossHair.svg
"
mipmap
:
true
width
:
260
fillMode
:
Image
.
PreserveAspectFit
z
:
mapBackground
.
visible
?
25
:
20
pitchAngle
:
pitch
rollAngle
:
roll
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
size
:
120
z
:
30
}
QGCAltitudeWidget
{
id
:
altitudeWidget
anchors.right
:
parent
.
right
width
:
60
altitude
:
flightDisplay
.
altitudeWGS84
z
:
30
id
:
altitudeWidget
anchors.right
:
parent
.
right
width
:
60
altitude
:
flightDisplay
.
altitudeWGS84
z
:
30
}
QGCSpeedWidget
{
id
:
speedWidget
anchors.left
:
parent
.
left
width
:
60
speed
:
flightDisplay
.
groundSpeed
z
:
40
id
:
speedWidget
anchors.left
:
parent
.
left
width
:
60
speed
:
flightDisplay
.
groundSpeed
z
:
40
}
QGCCurrentSpeed
{
...
...
@@ -364,22 +361,69 @@ Rectangle {
}
QGCCompass
{
id
:
compassIndicator
y
:
root
.
height
*
0.7
anchors.horizontalCenter
:
parent
.
horizontalCenter
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
z
:
70
id
:
compassIndicator
y
:
root
.
height
*
0.7
x
:
root
.
width
*
0.5
-
60
width
:
120
height
:
120
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
visible
:
!
mapBackground
.
visible
&&
showCompass
z
:
70
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
RightButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
RightButton
)
{
contextMenu
.
popup
()
QGCCompassInstrument
{
id
:
compassInstrument
y
:
5
x
:
85
size
:
160
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
visible
:
mapBackground
.
visible
&&
showCompass
z
:
70
}
QGCAttitudeInstrument
{
id
:
attitudeInstrument
y
:
5
x
:
root
.
width
-
160
-
85
size
:
160
rollAngle
:
roll
pitchAngle
:
pitch
showPitch
:
showPitchIndicator
visible
:
mapBackground
.
visible
&&
showAttitudeIndicator
z
:
80
}
// Button at upper left corner
Item
{
id
:
optionsButton
x
:
5
y
:
5
width
:
30
height
:
30
opacity
:
0.85
z
:
1000
Image
{
id
:
buttomImg
anchors.fill
:
parent
source
:
"
/qml/buttonMore.svg
"
mipmap
:
true
smooth
:
true
antialiasing
:
true
fillMode
:
Image
.
PreserveAspectFit
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
if
(
mouse
.
button
==
Qt
.
LeftButton
)
{
contextMenu
.
popup
()
}
}
}
z
:
100
}
onWidthChanged
:
{
adjustSizes
();
}
}
src/ui/flightdisplay/QGCFlightDisplay.cc
View file @
9075dbb3
...
...
@@ -67,8 +67,8 @@ QGCFlightDisplay::QGCFlightDisplay(QWidget *parent)
if
(
pl
)
{
pl
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
setMinimumWidth
(
27
0
);
setMinimumHeight
(
3
0
0
);
setMinimumWidth
(
38
0
);
setMinimumHeight
(
3
6
0
);
setContextPropertyObject
(
"flightDisplay"
,
this
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/FlightDisplay.qml"
));
setVisible
(
true
);
...
...
@@ -114,6 +114,7 @@ void QGCFlightDisplay::_forgetUAS(UASInterface* uas)
disconnect
(
_mav
,
&
UASInterface
::
NavigationControllerDataChanged
,
this
,
&
QGCFlightDisplay
::
_updateNavigationControllerData
);
}
_mav
=
NULL
;
emit
mavPresentChanged
();
}
void
QGCFlightDisplay
::
_setActiveUAS
(
UASInterface
*
uas
)
...
...
@@ -136,6 +137,7 @@ void QGCFlightDisplay::_setActiveUAS(UASInterface* uas)
// Set new UAS
_mav
=
uas
;
}
emit
mavPresentChanged
();
}
void
QGCFlightDisplay
::
_updateAttitude
(
UASInterface
*
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
)
...
...
src/ui/flightdisplay/QGCFlightDisplay.h
View file @
9075dbb3
...
...
@@ -53,6 +53,7 @@ public:
Q_PROPERTY
(
bool
repaintRequested
READ
repaintRequested
NOTIFY
repaintRequestedChanged
)
Q_PROPERTY
(
float
latitude
READ
latitude
NOTIFY
latitudeChanged
)
Q_PROPERTY
(
float
longitude
READ
longitude
NOTIFY
longitudeChanged
)
Q_PROPERTY
(
bool
mavPresent
READ
mavPresent
NOTIFY
mavPresentChanged
)
Q_INVOKABLE
void
saveSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
...
...
@@ -69,6 +70,7 @@ public:
float
latitude
()
{
return
_latitude
;
}
float
longitude
()
{
return
_longitude
;
}
bool
repaintRequested
()
{
return
true
;
}
bool
mavPresent
()
{
return
_mav
!=
NULL
;
}
/** @brief Start updating widget */
void
showEvent
(
QShowEvent
*
event
);
...
...
@@ -88,6 +90,7 @@ signals:
void
repaintRequestedChanged
();
void
latitudeChanged
();
void
longitudeChanged
();
void
mavPresentChanged
();
private
slots
:
/** @brief Attitude from main autopilot / system state */
...
...
src/ui/mapdisplay/MapDisplay.qml
View file @
9075dbb3
...
...
@@ -33,6 +33,7 @@ import QtQuick.Controls.Styles 1.2
import
QtQuick
.
Layouts
1.1
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightControls
1.0
Rectangle
{
...
...
src/ui/qmlcommon/QGCAltitudeWidget.qml
View file @
9075dbb3
...
...
@@ -27,9 +27,8 @@ This file is part of the QGROUNDCONTROL project
* @author Gus Grubba <mavlink@grubba.com>
*/
// TODO: This is temporary until I find a better way to display a large range of numbers
import
QtQuick
2.4
import
QGroundControl
.
Controls
1.0
Rectangle
{
id
:
root
...
...
@@ -63,9 +62,7 @@ Rectangle {
}
anchors.verticalCenter
:
parent
.
verticalCenter
height
:
parent
.
height
*
0.75
>
280
?
280
:
parent
.
height
*
0.75
clip
:
true
height
:
parent
.
height
*
0.65
>
280
?
280
:
parent
.
height
*
0.65
smooth
:
true
radius
:
5
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.25
)
...
...
@@ -74,34 +71,42 @@ Rectangle {
GradientStop
{
position
:
0.5
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
GradientStop
{
position
:
1.0
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
}
}
Column
{
id
:
col
width
:
parent
.
width
Rectangle
{
id
:
clipRect
height
:
parent
.
height
-
5
width
:
parent
.
width
clip
:
true
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
);
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
_reticleSpacing
Repeater
{
model
:
_speedArray
anchors.left
:
parent
.
left
Rectangle
{
property
int
_alt
:
modelData
width
:
(
_alt
%
10
===
0
)
?
10
:
15
height
:
_reticleHeight
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
Text
{
visible
:
(
_alt
%
10
===
0
)
x
:
20
anchors.verticalCenter
:
parent
.
verticalCenter
antialiasing
:
true
font.weight
:
Font
.
DemiBold
text
:
_alt
color
:
_alt
<
0
?
"
#f8983a
"
:
"
white
"
style
:
Text
.
Outline
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
Column
{
id
:
col
width
:
parent
.
width
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
_reticleSpacing
Repeater
{
model
:
_speedArray
anchors.left
:
parent
.
left
Rectangle
{
property
int
_alt
:
modelData
width
:
(
_alt
%
10
===
0
)
?
10
:
15
height
:
_reticleHeight
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
QGCLabel
{
visible
:
(
_alt
%
10
===
0
)
x
:
20
anchors.verticalCenter
:
parent
.
verticalCenter
antialiasing
:
true
font.weight
:
Font
.
DemiBold
text
:
_alt
color
:
_alt
<
0
?
"
#f8983a
"
:
"
white
"
style
:
Text
.
Outline
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
}
}
}
transform
:
Translate
{
y
:
((
altitude
-
_currentCenter
)
*
_reticleSlot
/
5
)
-
(
_reticleSlot
/
2
)
transform
:
Translate
{
y
:
((
altitude
-
_currentCenter
)
*
_reticleSlot
/
5
)
-
(
_reticleSlot
/
2
)
}
}
}
}
src/ui/qmlcommon/QGCArtificialHorizon.qml
0 → 100644
View file @
9075dbb3
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Artificial Horizon
* @author Gus Grubba <mavlink@grubba.com>
*/
import
QtQuick
2.4
Item
{
id
:
root
property
real
rollAngle
:
0
property
real
pitchAngle
:
0
clip
:
true
anchors.fill
:
parent
Item
{
id
:
artificialHorizon
width
:
root
.
width
*
4
height
:
root
.
height
*
4
anchors.centerIn
:
parent
Rectangle
{
id
:
sky
anchors.fill
:
parent
smooth
:
true
antialiasing
:
true
gradient
:
Gradient
{
GradientStop
{
position
:
0.25
;
color
:
Qt
.
hsla
(
0.6
,
1.0
,
0.25
)
}
GradientStop
{
position
:
0.5
;
color
:
Qt
.
hsla
(
0.6
,
0.5
,
0.55
)
}
}
}
Rectangle
{
id
:
ground
height
:
sky
.
height
/
2
anchors
{
left
:
sky
.
left
;
right
:
sky
.
right
;
bottom
:
sky
.
bottom
}
smooth
:
true
antialiasing
:
true
gradient
:
Gradient
{
GradientStop
{
position
:
0.0
;
color
:
Qt
.
hsla
(
0.25
,
0.5
,
0.45
)
}
GradientStop
{
position
:
0.25
;
color
:
Qt
.
hsla
(
0.25
,
0.75
,
0.25
)
}
}
}
transform
:
[
Translate
{
y
:
root
.
visible
?
pitchAngle
*
4
:
0
},
Rotation
{
origin.x
:
artificialHorizon
.
width
/
2
origin.y
:
artificialHorizon
.
height
/
2
angle
:
root
.
visible
?
-
rollAngle
:
0
}]
}
}
src/ui/qmlcommon/QGCAttitudeInstrument.qml
0 → 100644
View file @
9075dbb3
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Attitude Instrument
* @author Gus Grubba <mavlink@grubba.com>
*/
import
QtQuick
2.4
Item
{
id
:
root
property
real
rollAngle
:
0
property
real
pitchAngle
:
0
property
real
size
:
100
property
bool
showPitch
:
true
width
:
size
height
:
size
//----------------------------------------------------
//-- Artificial Horizon
QGCArtificialHorizon
{
rollAngle
:
root
.
rollAngle
pitchAngle
:
root
.
pitchAngle
}
//----------------------------------------------------
//-- Pointer
Image
{
id
:
pointer
source
:
"
/qml/attitudePointer.svg
"
width
:
root
.
width
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.bottom
:
parent
.
bottom
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
//----------------------------------------------------
//-- Instrument Dial
Image
{
id
:
instrumentDial
source
:
"
/qml/attitudeDial.svg
"
mipmap
:
true
width
:
root
.
width
fillMode
:
Image
.
PreserveAspectFit
anchors.bottom
:
parent
.
bottom
anchors.horizontalCenter
:
parent
.
horizontalCenter
transform
:
Rotation
{
origin.x
:
root
.
width
/
2
origin.y
:
root
.
height
/
2
angle
:
-
rollAngle
}
}
//----------------------------------------------------
//-- Pitch
QGCPitchWidget
{
id
:
pitchWidget
visible
:
root
.
showPitch
size
:
parent
.
width
*
0.65
anchors.verticalCenter
:
parent
.
verticalCenter
pitchAngle
:
root
.
pitchAngle
rollAngle
:
root
.
rollAngle
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
}
//----------------------------------------------------
//-- Cross Hair
Image
{
id
:
crossHair
anchors.centerIn
:
parent
source
:
"
/qml/crossHair.svg
"
mipmap
:
true
width
:
parent
.
width
*
0.75
fillMode
:
Image
.
PreserveAspectFit
}
//----------------------------------------------------
//-- Instrument Pannel
Image
{
id
:
pannel
width
:
parent
.
width
source
:
"
/qml/attitudeInstrument.svg
"
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.centerIn
:
parent
}
}
src/ui/qmlcommon/QGCAttitudeWidget.qml
View file @
9075dbb3
...
...
@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project
/**
* @file
* @brief QGC
Main Flight Display
* @brief QGC
Attitude Widget
* @author Gus Grubba <mavlink@grubba.com>
*/
...
...
@@ -31,88 +31,49 @@ import QtQuick 2.4
Item
{
id
:
root
property
real
rollAngle
:
0
property
real
pitchAngle
:
0
property
real
backgroundOpacity
:
1
property
bool
displayBackground
:
true
property
bool
useWhite
:
true
property
real
rollAngle
:
0
property
real
pitchAngle
:
0
property
bool
showAttitude
:
true
anchors.fill
:
parent
Item
{
id
:
background
width
:
parent
.
width
*
4
height
:
parent
.
height
*
4
anchors.centerIn
:
parent
Rectangle
{
anchors.fill
:
parent
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
visible
:
displayBackground
Rectangle
{
id
:
sky
visible
:
displayBackground
anchors.fill
:
parent
smooth
:
true
antialiasing
:
true
gradient
:
Gradient
{
GradientStop
{
position
:
0.25
;
color
:
Qt
.
hsla
(
0.6
,
1.0
,
0.25
,
backgroundOpacity
)
}
GradientStop
{
position
:
0.5
;
color
:
Qt
.
hsla
(
0.6
,
0.5
,
0.75
,
backgroundOpacity
)
}
}
}
Rectangle
{
id
:
ground
visible
:
displayBackground
height
:
sky
.
height
/
2
anchors
{
left
:
sky
.
left
;
right
:
sky
.
right
;
bottom
:
sky
.
bottom
}
smooth
:
true
antialiasing
:
true
gradient
:
Gradient
{
GradientStop
{
position
:
0.0
;
color
:
Qt
.
hsla
(
0.25
,
0.5
,
0.45
,
backgroundOpacity
)
}
GradientStop
{
position
:
0.25
;
color
:
Qt
.
hsla
(
0.25
,
0.75
,
0.25
,
backgroundOpacity
)
}
}
}
transform
:
[
Translate
{
y
:
(
root
.
visible
&&
root
.
displayBackground
)
?
pitchAngle
*
4
:
0
},
Rotation
{
origin.x
:
background
.
width
/
2
origin.y
:
background
.
height
/
2
angle
:
(
root
.
visible
&&
root
.
displayBackground
)
?
-
rollAngle
:
0
}]
}
QGCArtificialHorizon
{
rollAngle
:
root
.
rollAngle
pitchAngle
:
root
.
pitchAngle
}
Image
{
id
:
rollDial
visible
:
root
.
showAttitude
anchors
{
bottom
:
root
.
verticalCenter
;
horizontalCenter
:
parent
.
horizontalCenter
}
source
:
useWhite
?
"
/qml/rollDialWhite.svg
"
:
"
/qml/rollDial.svg
"
source
:
"
/qml/rollDialWhite.svg
"
mipmap
:
true
width
:
260
fillMode
:
Image
.
PreserveAspectFit
transform
:
Rotation
{
origin.x
:
rollDial
.
width
/
2
origin.y
:
rollDial
.
height
angle
:
-
rollAngle
angle
:
-
rollAngle
}
}
Image
{
id
:
pointer
visible
:
root
.
showAttitude
anchors
{
bottom
:
root
.
verticalCenter
;
horizontalCenter
:
parent
.
horizontalCenter
}
source
:
useWhite
?
"
/qml/rollPointerWhite.svg
"
:
"
/qml/rollPointer.svg
"
smooth
:
true
width
:
rollDial
.
width
fillMode
:
Image
.
PreserveAspectFit
source
:
"
/qml/rollPointerWhite.svg
"
mipmap
:
true
width
:
rollDial
.
width
fillMode
:
Image
.
PreserveAspectFit
}
Image
{
id
:
crossHair
visible
:
root
.
showAttitude
anchors.centerIn
:
parent
source
:
"
/qml/crossHair.svg
"
mipmap
:
true
width
:
260
fillMode
:
Image
.
PreserveAspectFit
}
}
src/ui/qmlcommon/QGCCompass.qml
View file @
9075dbb3
...
...
@@ -28,11 +28,10 @@ This file is part of the QGROUNDCONTROL project
*/
import
QtQuick
2.4
import
QGroundControl
.
Controls
1.0
Item
{
id
:
root
width
:
120
height
:
width
property
real
heading
:
0
Image
{
id
:
compass
...
...
@@ -62,7 +61,7 @@ Item {
height
:
25
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.15
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
Text
{
QGCLabel
{
text
:
heading
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
color
:
"
white
"
...
...
src/ui/qmlcommon/QGCCompassInstrument.qml
0 → 100644
View file @
9075dbb3
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Compass
* @author Gus Grubba <mavlink@grubba.com>
*/
import
QtQuick
2.4
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
property
ScreenTools
screenTools
:
ScreenTools
{
}
id
:
root
property
real
heading
:
0
property
real
size
:
120
property
real
_fontSize
:
screenTools
.
dpiAdjustedPointSize
(
size
*
12
/
120
)
width
:
size
height
:
size
Rectangle
{
id
:
compassBack
anchors.fill
:
parent
color
:
"
#212121
"
}
Image
{
id
:
pointer
source
:
"
/qml/compassInstrumentAirplane.svg
"
mipmap
:
true
width
:
root
.
width
*
0.75
fillMode
:
Image
.
PreserveAspectFit
anchors.centerIn
:
parent
transform
:
Rotation
{
origin.x
:
pointer
.
width
/
2
origin.y
:
pointer
.
height
/
2
angle
:
-
heading
}
}
Image
{
id
:
compassDial
source
:
"
/qml/compassInstrumentDial.svg
"
mipmap
:
true
width
:
root
.
width
fillMode
:
Image
.
PreserveAspectFit
anchors.centerIn
:
parent
}
Rectangle
{
anchors.centerIn
:
root
width
:
size
*
0.35
height
:
size
*
0.2
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.15
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
QGCLabel
{
text
:
heading
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
font.pointSize
:
_fontSize
<
1
?
1
:
_fontSize
;
color
:
"
white
"
anchors.centerIn
:
parent
}
}
}
src/ui/qmlcommon/QGCCurrentAltitude.qml
View file @
9075dbb3
...
...
@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
*/
import
QtQuick
2.1
import
QGroundControl
.
Controls
1.0
Rectangle
{
id
:
root
...
...
@@ -44,14 +45,14 @@ Rectangle {
Column
{
anchors.centerIn
:
parent
spacing
:
4
Text
{
QGCLabel
{
text
:
'
h:
'
+
altitude
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
color
:
"
white
"
anchors.right
:
parent
.
right
visible
:
showAltitude
}
Text
{
QGCLabel
{
text
:
'
vZ:
'
+
vertZ
.
toFixed
(
0
)
color
:
"
white
"
font.weight
:
showAltitude
?
Font
.
Normal
:
Font
.
DemiBold
...
...
src/ui/qmlcommon/QGCCurrentSpeed.qml
View file @
9075dbb3
...
...
@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
*/
import
QtQuick
2.1
import
QGroundControl
.
Controls
1.0
Rectangle
{
id
:
root
...
...
@@ -44,14 +45,14 @@ Rectangle {
Column
{
anchors.centerIn
:
parent
spacing
:
4
Text
{
QGCLabel
{
text
:
'
GS:
'
+
groundspeed
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
color
:
"
white
"
anchors.right
:
parent
.
right
visible
:
showGroundSpeed
}
Text
{
QGCLabel
{
text
:
'
AS:
'
+
airspeed
.
toFixed
(
0
)
color
:
"
white
"
anchors.right
:
parent
.
right
...
...
src/ui/qmlcommon/QGCMapBackground.qml
View file @
9075dbb3
...
...
@@ -31,15 +31,17 @@ import QtQuick 2.4
import
QtPositioning
5.3
import
QtLocation
5.3
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightControls
1.0
Rectangle
{
id
:
root
property
real
latitude
:
37.803784
property
real
longitude
:
-
122.462276
property
real
zoomLevel
:
1
5
property
real
zoomLevel
:
1
8
property
real
heading
:
0
property
bool
alwaysNorth
:
true
property
bool
interactive
:
true
property
alias
mapItem
:
map
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
...
...
@@ -95,8 +97,11 @@ Rectangle {
height
:
1
zoomLevel
:
root
.
zoomLevel
anchors.centerIn
:
parent
center
:
map
.
visible
?
QtPositioning
.
coordinate
(
lat
,
lon
)
:
QtPositioning
.
coordinate
(
0
,
0
)
center
:
QtPositioning
.
coordinate
(
lat
,
lon
)
/*
// There is a bug currently in Qt where it fails to render a map taller than 6 tiles high. Until
// that's fixed, we can't rotate the map as it would require a larger map, which can easely grow
// larger than 6 tiles high.
transform: Rotation {
origin.x: map.width / 2
origin.y: map.height / 2
...
...
@@ -104,7 +109,7 @@ Rectangle {
}
*/
gesture.flickDeceleration
:
3000
gesture.enabled
:
tru
e
gesture.enabled
:
root
.
interactiv
e
onWidthChanged
:
{
scaleTimer
.
restart
()
...
...
@@ -118,6 +123,10 @@ Rectangle {
scaleTimer
.
restart
()
}
Component.onCompleted
:
{
map
.
zoomLevel
=
18
}
function
calculateScale
()
{
var
coord1
,
coord2
,
dist
,
text
,
f
f
=
0
...
...
@@ -170,13 +179,14 @@ Rectangle {
Item
{
id
:
scale
parent
:
zoomSlider
.
parent
visible
:
scaleText
.
text
!=
"
0 m
"
visible
:
scaleText
.
text
!=
=
"
0 m
"
z
:
map
.
z
+
2
opacity
:
1
anchors
{
bottom
:
zoomSlider
.
top
;
bottomMargin
:
8
;
left
:
zoomSlider
.
left
leftMargin
:
4
}
Image
{
id
:
scaleImageLeft
...
...
@@ -196,14 +206,14 @@ Rectangle {
anchors.bottom
:
parent
.
bottom
anchors.left
:
scaleImage
.
right
}
Text
{
QGCLabel
{
id
:
scaleText
color
:
"
white
"
font.weight
:
Font
.
DemiBold
horizontalAlignment
:
Text
.
AlignHCenter
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
anchors.bottomMargin
:
8
anchors.bottomMargin
:
10
text
:
"
0 m
"
}
Component.onCompleted
:
{
...
...
src/ui/qmlcommon/QGCPitchWidget.qml
View file @
9075dbb3
...
...
@@ -28,15 +28,22 @@ This file is part of the QGROUNDCONTROL project
*/
import
QtQuick
2.1
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
Rectangle
{
property
real
pitchAngle
:
0
property
real
rollAngle
:
0
property
real
_reticleHeight
:
1
property
real
_reticleSpacing
:
17
property
real
_reticleSlot
:
_reticleSpacing
+
_reticleHeight
height
:
110
width
:
120
property
ScreenTools
screenTools
:
ScreenTools
{
}
property
real
pitchAngle
:
0
property
real
rollAngle
:
0
property
real
size
:
120
property
real
_reticleHeight
:
1
property
real
_reticleSpacing
:
size
*
0.15
property
real
_reticleSlot
:
_reticleSpacing
+
_reticleHeight
property
real
_longDash
:
size
*
0.40
property
real
_shortDash
:
size
*
0.25
property
real
_fontSize
:
screenTools
.
dpiAdjustedPointSize
(
size
*
11
/
120
);
height
:
size
*
0.9
width
:
size
radius
:
8
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
...
@@ -53,27 +60,29 @@ Rectangle {
Rectangle
{
property
int
_pitch
:
-
(
modelData
*
5
-
90
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
(
_pitch
%
10
)
===
0
?
50
:
30
width
:
(
_pitch
%
10
)
===
0
?
_longDash
:
_shortDash
height
:
_reticleHeight
color
:
"
white
"
antialiasing
:
true
smooth
:
true
Text
{
QGCLabel
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenterOffset
:
-
40
anchors.horizontalCenterOffset
:
-
(
_longDash
*
0.8
)
anchors.verticalCenter
:
parent
.
verticalCenter
smooth
:
true
font.weight
:
Font
.
DemiBold
font.pointSize
:
_fontSize
<
1
?
1
:
_fontSize
;
text
:
_pitch
color
:
"
white
"
visible
:
(
_pitch
!=
0
)
&&
((
_pitch
%
10
)
===
0
)
}
Text
{
QGCLabel
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenterOffset
:
40
anchors.horizontalCenterOffset
:
(
_longDash
*
0.8
)
anchors.verticalCenter
:
parent
.
verticalCenter
smooth
:
true
font.weight
:
Font
.
DemiBold
font.pointSize
:
_fontSize
<
1
?
1
:
_fontSize
;
text
:
_pitch
color
:
"
white
"
visible
:
(
_pitch
!=
0
)
&&
((
_pitch
%
10
)
===
0
)
...
...
@@ -87,7 +96,7 @@ Rectangle {
}
transform
:
[
Rotation
{
origin.x
:
width
/
2
origin.x
:
width
/
2
origin.y
:
height
/
2
angle
:
-
rollAngle
}
...
...
src/ui/qmlcommon/QGCSlider.qml
View file @
9075dbb3
...
...
@@ -38,78 +38,76 @@
**
****************************************************************************/
import
QtQuick
2.0
import
QtQuick
2.1
import
QGroundControl
.
Controls
1.0
Item
{
id
:
slider
;
height
:
1
0
height
:
1
2
property
real
value
// value is read/write.
property
real
minimum
:
0
property
real
maximum
:
1
property
int
length
:
width
-
handle
.
width
Rectangle
{
anchors.fill
:
parent
border.width
:
1
;
border.color
:
"
lightgrey
"
radius
:
8
color
:
"
white
"
opacity
:
1
anchors.fill
:
parent
radius
:
6
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
);
}
Rectangle
{
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.leftMargin
:
4
anchors.top
:
parent
.
top
anchors.topMargin
:
(
parent
.
height
-
height
)
/
2
height
:
3
width
:
handle
.
x
-
x
color
:
"
#1c94fc
"
radius
:
4
height
:
4
width
:
handle
.
x
-
x
color
:
"
#69bb17
"
anchors.verticalCenter
:
parent
.
verticalCenter
}
Rectangle
{
id
:
labelRect
width
:
label
.
width
height
:
label
.
height
+
4
radius
:
4
smooth
:
true
color
:
"
white
"
border.color
:
"
lightgrey
"
anchors.bottom
:
handle
.
top
id
:
labelRect
width
:
label
.
width
height
:
label
.
height
+
4
radius
:
4
smooth
:
true
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.75
);
border.color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.45
);
anchors.bottom
:
handle
.
top
anchors.bottomMargin
:
4
x
:
Math
.
max
(
Math
.
min
(
handle
.
x
+
(
handle
.
width
-
width
)
/
2
,
slider
.
width
-
width
),
0
)
visible
:
mouseRegion
.
pressed
Text
{
id
:
label
color
:
"
darkgrey
"
text
:
slider
.
value
.
toFixed
(
2
)
width
:
font
.
pointSize
*
3.5
anchors.horizontalCenter
:
labelRect
.
horizontalCenter
horizontalAlignment
:
Text
.
AlignHCenter
anchors.baseline
:
parent
.
bottom
anchors.baselineOffset
:
-
6
font.pixelSize
:
14
x
:
Math
.
max
(
Math
.
min
(
handle
.
x
+
(
handle
.
width
-
width
)
/
2
,
slider
.
width
-
width
),
0
)
QGCLabel
{
id
:
label
color
:
"
black
"
text
:
slider
.
value
.
toFixed
(
2
)
width
:
font
.
pointSize
*
3.5
anchors.horizontalCenter
:
labelRect
.
horizontalCenter
horizontalAlignment
:
Text
.
AlignHCenter
anchors.verticalCenter
:
labelRect
.
verticalCenter
//anchors.baseline: parent.bottom
//anchors.baselineOffset: -6
}
}
Rectangle
{
id
:
handle
;
smooth
:
true
width
:
26
;
y
:
(
slider
.
height
-
height
)
/
2
;
x
:
(
slider
.
value
-
slider
.
minimum
)
*
slider
.
length
/
(
slider
.
maximum
-
slider
.
minimum
)
id
:
handle
;
smooth
:
true
width
:
26
;
y
:
(
slider
.
height
-
height
)
/
2
;
x
:
(
slider
.
value
-
slider
.
minimum
)
*
slider
.
length
/
(
slider
.
maximum
-
slider
.
minimum
)
height
:
width
;
radius
:
width
/
2
gradient
:
normalGradient
height
:
width
radius
:
width
/
2
gradient
:
normalGradient
border.width
:
2
border.color
:
"
white
"
Gradient
{
id
:
normalGradient
GradientStop
{
position
:
0.0
;
color
:
"
#b0b0b0
"
}
GradientStop
{
position
:
0.0
;
color
:
"
#b0b0b0
"
}
GradientStop
{
position
:
0.66
;
color
:
"
#909090
"
}
GradientStop
{
position
:
1.0
;
color
:
"
#545454
"
}
GradientStop
{
position
:
1.0
;
color
:
"
#545454
"
}
}
MouseArea
{
...
...
src/ui/qmlcommon/QGCSpeedWidget.qml
View file @
9075dbb3
...
...
@@ -29,6 +29,7 @@ This file is part of the QGROUNDCONTROL project
import
QtQuick
2.4
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
Rectangle
{
id
:
root
...
...
@@ -37,12 +38,9 @@ Rectangle {
property
real
_reticleSpacing
:
10
property
real
_reticleHeight
:
2
property
real
_reticleSlot
:
_reticleSpacing
+
_reticleHeight
anchors.verticalCenter
:
parent
.
verticalCenter
z
:
10
height
:
parent
.
height
*
0.75
>
280
?
280
:
parent
.
height
*
0.75
clip
:
true
height
:
parent
.
height
*
0.65
>
280
?
280
:
parent
.
height
*
0.65
smooth
:
true
radius
:
5
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.25
)
...
...
@@ -51,35 +49,43 @@ Rectangle {
GradientStop
{
position
:
0.5
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
GradientStop
{
position
:
1.0
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
}
}
Column
{
id
:
col
width
:
parent
.
width
Rectangle
{
id
:
clipRect
height
:
parent
.
height
-
5
width
:
parent
.
width
clip
:
true
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
);
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
_reticleSpacing
Repeater
{
model
:
40
Rectangle
{
property
int
_speed
:
-
(
index
-
20
)
width
:
(
_speed
%
5
===
0
)
?
10
:
15
anchors.right
:
parent
.
right
height
:
_reticleHeight
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
Text
{
visible
:
(
_speed
%
5
===
0
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenterOffset
:
-
30
anchors.verticalCenter
:
parent
.
verticalCenter
antialiasing
:
true
font.weight
:
Font
.
DemiBold
text
:
_speed
color
:
_speed
<
0
?
"
#f8983a
"
:
"
white
"
style
:
Text
.
Outline
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
Column
{
id
:
col
width
:
parent
.
width
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
_reticleSpacing
Repeater
{
model
:
40
Rectangle
{
property
int
_speed
:
-
(
index
-
20
)
width
:
(
_speed
%
5
===
0
)
?
10
:
15
anchors.right
:
parent
.
right
height
:
_reticleHeight
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
QGCLabel
{
visible
:
(
_speed
%
5
===
0
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenterOffset
:
-
30
anchors.verticalCenter
:
parent
.
verticalCenter
antialiasing
:
true
font.weight
:
Font
.
DemiBold
text
:
_speed
color
:
_speed
<
0
?
"
#f8983a
"
:
"
white
"
style
:
Text
.
Outline
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
}
}
}
transform
:
Translate
{
y
:
(
speed
*
_reticleSlot
)
-
(
_reticleSlot
/
2
)
transform
:
Translate
{
y
:
(
speed
*
_reticleSlot
)
-
(
_reticleSlot
/
2
)
}
}
}
}
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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