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 @@
...
@@ -100,7 +100,9 @@
<file alias="QGroundControl/FlightControls/qmldir">src/ui/qmlcommon/qmldir</file>
<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/QGCAltitudeWidget.qml">src/ui/qmlcommon/QGCAltitudeWidget.qml</file>
<file alias="QGroundControl/FlightControls/QGCAttitudeWidget.qml">src/ui/qmlcommon/QGCAttitudeWidget.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/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/QGCCurrentAltitude.qml">src/ui/qmlcommon/QGCCurrentAltitude.qml</file>
<file alias="QGroundControl/FlightControls/QGCCurrentSpeed.qml">src/ui/qmlcommon/QGCCurrentSpeed.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>
<file alias="QGroundControl/FlightControls/QGCMapBackground.qml">src/ui/qmlcommon/QGCMapBackground.qml</file>
...
@@ -109,19 +111,24 @@
...
@@ -109,19 +111,24 @@
<file alias="QGroundControl/FlightControls/QGCSlider.qml">src/ui/qmlcommon/QGCSlider.qml</file>
<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/QGCWaypointEditor.qml">src/ui/qmlcommon/QGCWaypointEditor.qml</file>
<file alias="QGroundControl/FlightControls/QGCMapToolButton.qml">src/ui/qmlcommon/QGCMapToolButton.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 -->
<!-- QML Main UI Resources -->
<file alias="compass.svg">src/ui/qmlcommon/compass.svg</file>
<file alias="compass.svg">src/ui/qmlcommon/compass.svg</file>
<file alias="compassNeedle.svg">src/ui/qmlcommon/compassNeedle.svg</file>
<file alias="compassNeedle.svg">src/ui/qmlcommon/compassNeedle.svg</file>
<file alias="crossHair.svg">src/ui/qmlcommon/crossHair.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="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="rollPointerWhite.svg">src/ui/qmlcommon/rollPointerWhite.svg</file>
<file alias="scale.png">src/ui/qmlcommon/scale.png</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="scale_end.png">src/ui/qmlcommon/scale_end.png</file>
<file alias="buttonLeft.svg">src/ui/qmlcommon/buttonLeft.svg</file>
<file alias="buttonLeft.svg">src/ui/qmlcommon/buttonLeft.svg</file>
<file alias="buttonRight.svg">src/ui/qmlcommon/buttonRight.svg</file>
<file alias="buttonRight.svg">src/ui/qmlcommon/buttonRight.svg</file>
<file alias="buttonHome.svg">src/ui/qmlcommon/buttonHome.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>
<qresource prefix="/AutoPilotPlugins/PX4">
<qresource prefix="/AutoPilotPlugins/PX4">
...
...
src/QtLocationPlugin/OpenPilotMaps.h
View file @
9075dbb3
...
@@ -38,6 +38,8 @@ This file is part of the QGROUNDCONTROL project
...
@@ -38,6 +38,8 @@ This file is part of the QGROUNDCONTROL project
#include
<QNetworkReply>
#include
<QNetworkReply>
#include
<QMutex>
#include
<QMutex>
#define MAX_MAP_ZOOM (20.0)
namespace
OpenPilot
{
namespace
OpenPilot
{
enum
MapType
enum
MapType
...
...
src/QtLocationPlugin/qgeomapreplyqgc.cpp
View file @
9075dbb3
...
@@ -53,9 +53,17 @@ QGeoMapReplyQGC::QGeoMapReplyQGC(QNetworkReply *reply, const QGeoTileSpec &spec,
...
@@ -53,9 +53,17 @@ QGeoMapReplyQGC::QGeoMapReplyQGC(QNetworkReply *reply, const QGeoTileSpec &spec,
:
QGeoTiledMapReply
(
spec
,
parent
)
:
QGeoTiledMapReply
(
spec
,
parent
)
,
m_reply
(
reply
)
,
m_reply
(
reply
)
{
{
connect
(
m_reply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
networkReplyFinished
()));
if
(
!
reply
)
connect
(
m_reply
,
SIGNAL
(
error
(
QNetworkReply
::
NetworkError
)),
this
,
SLOT
(
networkReplyError
(
QNetworkReply
::
NetworkError
)));
{
connect
(
m_reply
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
replyDestroyed
()));
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
()
QGeoMapReplyQGC
::~
QGeoMapReplyQGC
()
...
...
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.cpp
View file @
9075dbb3
...
@@ -59,7 +59,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
...
@@ -59,7 +59,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
{
{
QGeoCameraCapabilities
cameraCaps
;
QGeoCameraCapabilities
cameraCaps
;
cameraCaps
.
setMinimumZoomLevel
(
2.0
);
cameraCaps
.
setMinimumZoomLevel
(
2.0
);
cameraCaps
.
setMaximumZoomLevel
(
20.0
);
cameraCaps
.
setMaximumZoomLevel
(
MAX_MAP_ZOOM
);
cameraCaps
.
setSupportsBearing
(
true
);
cameraCaps
.
setSupportsBearing
(
true
);
setCameraCapabilities
(
cameraCaps
);
setCameraCapabilities
(
cameraCaps
);
...
...
src/ui/flightdisplay/FlightDisplay.qml
View file @
9075dbb3
...
@@ -40,6 +40,10 @@ Rectangle {
...
@@ -40,6 +40,10 @@ Rectangle {
property
real
roll
:
isNaN
(
flightDisplay
.
roll
)
?
0
:
flightDisplay
.
roll
property
real
roll
:
isNaN
(
flightDisplay
.
roll
)
?
0
:
flightDisplay
.
roll
property
real
pitch
:
isNaN
(
flightDisplay
.
pitch
)
?
0
:
flightDisplay
.
pitch
property
real
pitch
:
isNaN
(
flightDisplay
.
pitch
)
?
0
:
flightDisplay
.
pitch
property
bool
showPitchIndicator
:
true
property
bool
showAttitudeIndicator
:
true
property
bool
showCompass
:
true
function
getBool
(
value
)
{
function
getBool
(
value
)
{
return
value
===
'
0
'
?
false
:
true
;
return
value
===
'
0
'
?
false
:
true
;
}
}
...
@@ -48,65 +52,141 @@ Rectangle {
...
@@ -48,65 +52,141 @@ Rectangle {
return
value
?
"
1
"
:
"
0
"
;
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
:
Component.onCompleted
:
{
{
mapBackground
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showMapBackground
"
,
"
0
"
));
mapBackground
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showMapBackground
"
,
"
0
"
));
mapBackground
.
alwaysNorth
=
getBool
(
flightDisplay
.
loadSetting
(
"
mapAlwaysPointsNorth
"
,
"
0
"
));
mapBackground
.
alwaysNorth
=
getBool
(
flightDisplay
.
loadSetting
(
"
mapAlwaysPointsNorth
"
,
"
0
"
));
a
ttitude
Widget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAttitude
Widget
"
,
"
1
"
));
showA
ttitude
Indicator
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAttitude
Indicator
"
,
"
1
"
));
attitudeWidget
.
displayBackground
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
AttitudeBackground
"
,
"
1
"
));
showPitchIndicator
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
PitchIndicator
"
,
"
1
"
));
pitchWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
PitchWidget
"
,
"
1
"
));
showCompass
=
getBool
(
flightDisplay
.
loadSetting
(
"
show
Compass
"
,
"
1
"
));
altitudeWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAltitudeWidget
"
,
"
1
"
));
altitudeWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showAltitudeWidget
"
,
"
1
"
));
speedWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showSpeedWidget
"
,
"
1
"
));
speedWidget
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showSpeedWidget
"
,
"
1
"
));
compassIndicator
.
visible
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCompassIndicator
"
,
"
1
"
));
currentSpeed
.
showAirSpeed
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentAirSpeed
"
,
"
1
"
));
currentSpeed
.
showAirSpeed
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentAirSpeed
"
,
"
1
"
));
currentSpeed
.
showGroundSpeed
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentGroundSpeed
"
,
"
1
"
));
currentSpeed
.
showGroundSpeed
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentGroundSpeed
"
,
"
1
"
));
currentAltitude
.
showClimbRate
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentClimbRate
"
,
"
1
"
));
currentAltitude
.
showClimbRate
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentClimbRate
"
,
"
1
"
));
currentAltitude
.
showAltitude
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentAltitude
"
,
"
1
"
));
currentAltitude
.
showAltitude
=
getBool
(
flightDisplay
.
loadSetting
(
"
showCurrentAltitude
"
,
"
1
"
));
mapTypeMenu
.
update
();
mapTypeMenu
.
update
();
}
adjustSizes
();
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
}
}
Menu
{
Menu
{
id
:
contextMenu
id
:
contextMenu
MenuItem
{
MenuItem
{
text
:
"
Ma
in Attitude Indicators
"
text
:
"
Ma
p Background
"
checkable
:
true
checkable
:
true
checked
:
attitudeWidget
.
visible
checked
:
mapBackground
.
visible
onTriggered
:
onTriggered
:
{
{
attitudeWidget
.
visible
=
!
attitudeWidget
.
visible
;
mapBackground
.
visible
=
!
mapBackground
.
visible
;
flightDisplay
.
saveSetting
(
"
show
AttitudeWidget
"
,
setBool
(
attitudeWidget
.
visible
));
flightDisplay
.
saveSetting
(
"
show
MapBackground
"
,
setBool
(
mapBackground
.
visible
));
}
}
}
}
/*
MenuItem {
MenuItem {
text
:
"
Display Attitude Background
"
text: "
Map Always Points North
"
checkable: true
checkable: true
checked
:
attitudeWidget
.
displayBackground
checked:
mapBackground.alwaysNorth
onTriggered:
onTriggered:
{
{
attitudeWidget
.
displayBackground
=
!
attitudeWidget
.
displayBackground
;
mapBackground.alwaysNorth = !mapBackground.alwaysNorth;
flightDisplay
.
saveSetting
(
"
showAttitudeBackground
"
,
setBool
(
attitudeWidget
.
displayBackground
));
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
{
MenuItem
{
text
:
"
Pitch Indicator
"
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
checkable
:
true
checked
:
pitchWidget
.
visible
checked
:
showCompass
onTriggered
:
onTriggered
:
{
{
pitchWidget
.
visible
=
!
pitchWidget
.
visible
;
showCompass
=
!
showCompass
;
flightDisplay
.
saveSetting
(
"
show
PitchWidget
"
,
setBool
(
pitchWidget
.
visible
));
flightDisplay
.
saveSetting
(
"
show
Compass
"
,
setBool
(
showCompass
));
}
}
}
}
...
@@ -176,91 +256,18 @@ Rectangle {
...
@@ -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
{}
MenuSeparator
{}
MenuItem
{
MenuItem
{
text
:
"
Restore Defaults
"
text
:
"
Restore Defaults
"
onTriggered
:
onTriggered
:
{
{
attitudeWidget
.
visible
=
true
;
showPitchIndicator
=
true
;
flightDisplay
.
saveSetting
(
"
show
AttitudeWidget
"
,
setBool
(
attitudeWidget
.
visible
));
flightDisplay
.
saveSetting
(
"
show
PitchIndicator
"
,
setBool
(
showPitchIndicator
));
a
ttitude
Widget
.
displayBackground
=
true
;
showA
ttitude
Indicator
=
true
;
flightDisplay
.
saveSetting
(
"
showAttitude
Background
"
,
setBool
(
a
ttitude
Widget
.
displayBackground
));
flightDisplay
.
saveSetting
(
"
showAttitude
Indicator
"
,
setBool
(
showA
ttitude
Indicator
));
pitchWidget
.
visible
=
true
;
showCompass
=
true
;
flightDisplay
.
saveSetting
(
"
show
PitchWidget
"
,
setBool
(
pitchWidget
.
visible
));
flightDisplay
.
saveSetting
(
"
show
Compass
"
,
setBool
(
showCompass
));
altitudeWidget
.
visible
=
true
;
altitudeWidget
.
visible
=
true
;
flightDisplay
.
saveSetting
(
"
showAltitudeWidget
"
,
setBool
(
altitudeWidget
.
visible
));
flightDisplay
.
saveSetting
(
"
showAltitudeWidget
"
,
setBool
(
altitudeWidget
.
visible
));
currentAltitude
.
showAltitude
=
true
;
currentAltitude
.
showAltitude
=
true
;
...
@@ -273,8 +280,6 @@ Rectangle {
...
@@ -273,8 +280,6 @@ Rectangle {
flightDisplay
.
saveSetting
(
"
showCurrentAirSpeed
"
,
setBool
(
currentSpeed
.
showAirSpeed
));
flightDisplay
.
saveSetting
(
"
showCurrentAirSpeed
"
,
setBool
(
currentSpeed
.
showAirSpeed
));
currentSpeed
.
showGroundSpeed
=
true
;
currentSpeed
.
showGroundSpeed
=
true
;
flightDisplay
.
saveSetting
(
"
showCurrentGroundSpeed
"
,
setBool
(
currentSpeed
.
showGroundSpeed
));
flightDisplay
.
saveSetting
(
"
showCurrentGroundSpeed
"
,
setBool
(
currentSpeed
.
showGroundSpeed
));
compassIndicator
.
visible
=
true
;
flightDisplay
.
saveSetting
(
"
showCompassIndicator
"
,
setBool
(
compassIndicator
.
visible
));
mapBackground
.
visible
=
false
;
mapBackground
.
visible
=
false
;
flightDisplay
.
saveSetting
(
"
showMapBackground
"
,
setBool
(
mapBackground
.
visible
));
flightDisplay
.
saveSetting
(
"
showMapBackground
"
,
setBool
(
mapBackground
.
visible
));
mapBackground
.
alwaysNorth
=
false
;
mapBackground
.
alwaysNorth
=
false
;
...
@@ -285,13 +290,13 @@ Rectangle {
...
@@ -285,13 +290,13 @@ Rectangle {
}
}
QGCMapBackground
{
QGCMapBackground
{
id
:
mapBackground
id
:
mapBackground
anchors.fill
:
parent
anchors.fill
:
parent
visible
:
false
heading
:
0
// isNaN(flightDisplay.heading) ? 0 : flightDisplay.heading
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
latitude
:
mapBackground
.
visible
?
((
flightDisplay
.
latitude
===
0
)
?
37.803784
:
flightDisplay
.
latitude
)
:
37.803784
l
at
itude
:
flightDisplay
.
latitude
l
ong
itude
:
mapBackground
.
visible
?
((
flightDisplay
.
longitude
===
0
)
?
-
122.462276
:
flightDisplay
.
longitude
)
:
-
122.462276
longitude
:
flightDisplay
.
longitude
interactive
:
!
flightDisplay
.
mavPresent
z
:
5
z
:
10
}
}
QGCAttitudeWidget
{
QGCAttitudeWidget
{
...
@@ -299,44 +304,36 @@ Rectangle {
...
@@ -299,44 +304,36 @@ Rectangle {
anchors.centerIn
:
parent
anchors.centerIn
:
parent
rollAngle
:
roll
rollAngle
:
roll
pitchAngle
:
pitch
pitchAngle
:
pitch
useWhite
:
!
mapBackground
.
visible
showAttitude
:
showAttitudeIndicator
backgroundOpacity
:
mapBackground
.
visible
?
0.25
:
1.0
visible
:
!
mapBackground
.
visible
z
:
10
z
:
10
}
}
QGCPitchWidget
{
QGCPitchWidget
{
id
:
pitchWidget
id
:
pitchWidget
visible
:
showPitchIndicator
&&
!
mapBackground
.
visible
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
pitchAngle
:
pitch
pitchAngle
:
pitch
rollAngle
:
roll
rollAngle
:
roll
color
:
mapBackground
.
visible
?
Qt
.
rgba
(
0
,
0
,
0
,
0.5
)
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
opacity
:
mapBackground
.
visible
?
1
:
0.75
size
:
120
z
:
mapBackground
.
visible
?
20
:
25
z
:
30
}
Image
{
anchors.centerIn
:
parent
source
:
"
/qml/crossHair.svg
"
mipmap
:
true
width
:
260
fillMode
:
Image
.
PreserveAspectFit
z
:
mapBackground
.
visible
?
25
:
20
}
}
QGCAltitudeWidget
{
QGCAltitudeWidget
{
id
:
altitudeWidget
id
:
altitudeWidget
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
width
:
60
width
:
60
altitude
:
flightDisplay
.
altitudeWGS84
altitude
:
flightDisplay
.
altitudeWGS84
z
:
30
z
:
30
}
}
QGCSpeedWidget
{
QGCSpeedWidget
{
id
:
speedWidget
id
:
speedWidget
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
width
:
60
width
:
60
speed
:
flightDisplay
.
groundSpeed
speed
:
flightDisplay
.
groundSpeed
z
:
40
z
:
40
}
}
QGCCurrentSpeed
{
QGCCurrentSpeed
{
...
@@ -364,22 +361,69 @@ Rectangle {
...
@@ -364,22 +361,69 @@ Rectangle {
}
}
QGCCompass
{
QGCCompass
{
id
:
compassIndicator
id
:
compassIndicator
y
:
root
.
height
*
0.7
y
:
root
.
height
*
0.7
anchors.horizontalCenter
:
parent
.
horizontalCenter
x
:
root
.
width
*
0.5
-
60
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
width
:
120
z
:
70
height
:
120
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
visible
:
!
mapBackground
.
visible
&&
showCompass
z
:
70
}
}
MouseArea
{
QGCCompassInstrument
{
anchors.fill
:
parent
id
:
compassInstrument
acceptedButtons
:
Qt
.
RightButton
y
:
5
onClicked
:
{
x
:
85
if
(
mouse
.
button
==
Qt
.
RightButton
)
size
:
160
{
heading
:
isNaN
(
flightDisplay
.
heading
)
?
0
:
flightDisplay
.
heading
contextMenu
.
popup
()
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)
...
@@ -67,8 +67,8 @@ QGCFlightDisplay::QGCFlightDisplay(QWidget *parent)
if
(
pl
)
{
if
(
pl
)
{
pl
->
setContentsMargins
(
0
,
0
,
0
,
0
);
pl
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
}
setMinimumWidth
(
27
0
);
setMinimumWidth
(
38
0
);
setMinimumHeight
(
3
0
0
);
setMinimumHeight
(
3
6
0
);
setContextPropertyObject
(
"flightDisplay"
,
this
);
setContextPropertyObject
(
"flightDisplay"
,
this
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/FlightDisplay.qml"
));
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/FlightDisplay.qml"
));
setVisible
(
true
);
setVisible
(
true
);
...
@@ -114,6 +114,7 @@ void QGCFlightDisplay::_forgetUAS(UASInterface* uas)
...
@@ -114,6 +114,7 @@ void QGCFlightDisplay::_forgetUAS(UASInterface* uas)
disconnect
(
_mav
,
&
UASInterface
::
NavigationControllerDataChanged
,
this
,
&
QGCFlightDisplay
::
_updateNavigationControllerData
);
disconnect
(
_mav
,
&
UASInterface
::
NavigationControllerDataChanged
,
this
,
&
QGCFlightDisplay
::
_updateNavigationControllerData
);
}
}
_mav
=
NULL
;
_mav
=
NULL
;
emit
mavPresentChanged
();
}
}
void
QGCFlightDisplay
::
_setActiveUAS
(
UASInterface
*
uas
)
void
QGCFlightDisplay
::
_setActiveUAS
(
UASInterface
*
uas
)
...
@@ -136,6 +137,7 @@ void QGCFlightDisplay::_setActiveUAS(UASInterface* uas)
...
@@ -136,6 +137,7 @@ void QGCFlightDisplay::_setActiveUAS(UASInterface* uas)
// Set new UAS
// Set new UAS
_mav
=
uas
;
_mav
=
uas
;
}
}
emit
mavPresentChanged
();
}
}
void
QGCFlightDisplay
::
_updateAttitude
(
UASInterface
*
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
)
void
QGCFlightDisplay
::
_updateAttitude
(
UASInterface
*
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
)
...
...
src/ui/flightdisplay/QGCFlightDisplay.h
View file @
9075dbb3
...
@@ -53,6 +53,7 @@ public:
...
@@ -53,6 +53,7 @@ public:
Q_PROPERTY
(
bool
repaintRequested
READ
repaintRequested
NOTIFY
repaintRequestedChanged
)
Q_PROPERTY
(
bool
repaintRequested
READ
repaintRequested
NOTIFY
repaintRequestedChanged
)
Q_PROPERTY
(
float
latitude
READ
latitude
NOTIFY
latitudeChanged
)
Q_PROPERTY
(
float
latitude
READ
latitude
NOTIFY
latitudeChanged
)
Q_PROPERTY
(
float
longitude
READ
longitude
NOTIFY
longitudeChanged
)
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
void
saveSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
Q_INVOKABLE
QString
loadSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
...
@@ -69,6 +70,7 @@ public:
...
@@ -69,6 +70,7 @@ public:
float
latitude
()
{
return
_latitude
;
}
float
latitude
()
{
return
_latitude
;
}
float
longitude
()
{
return
_longitude
;
}
float
longitude
()
{
return
_longitude
;
}
bool
repaintRequested
()
{
return
true
;
}
bool
repaintRequested
()
{
return
true
;
}
bool
mavPresent
()
{
return
_mav
!=
NULL
;
}
/** @brief Start updating widget */
/** @brief Start updating widget */
void
showEvent
(
QShowEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
...
@@ -88,6 +90,7 @@ signals:
...
@@ -88,6 +90,7 @@ signals:
void
repaintRequestedChanged
();
void
repaintRequestedChanged
();
void
latitudeChanged
();
void
latitudeChanged
();
void
longitudeChanged
();
void
longitudeChanged
();
void
mavPresentChanged
();
private
slots
:
private
slots
:
/** @brief Attitude from main autopilot / system state */
/** @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
...
@@ -33,6 +33,7 @@ import QtQuick.Controls.Styles 1.2
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Layouts
1.1
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightControls
1.0
import
QGroundControl
.
FlightControls
1.0
Rectangle
{
Rectangle
{
...
...
src/ui/qmlcommon/QGCAltitudeWidget.qml
View file @
9075dbb3
...
@@ -27,9 +27,8 @@ This file is part of the QGROUNDCONTROL project
...
@@ -27,9 +27,8 @@ This file is part of the QGROUNDCONTROL project
* @author Gus Grubba <mavlink@grubba.com>
* @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
QtQuick
2.4
import
QGroundControl
.
Controls
1.0
Rectangle
{
Rectangle
{
id
:
root
id
:
root
...
@@ -63,9 +62,7 @@ Rectangle {
...
@@ -63,9 +62,7 @@ Rectangle {
}
}
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
height
:
parent
.
height
*
0.65
>
280
?
280
:
parent
.
height
*
0.65
height
:
parent
.
height
*
0.75
>
280
?
280
:
parent
.
height
*
0.75
clip
:
true
smooth
:
true
smooth
:
true
radius
:
5
radius
:
5
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.25
)
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.25
)
...
@@ -74,34 +71,42 @@ Rectangle {
...
@@ -74,34 +71,42 @@ Rectangle {
GradientStop
{
position
:
0.5
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
GradientStop
{
position
:
0.5
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
GradientStop
{
position
:
1.0
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
}
GradientStop
{
position
:
1.0
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
}
}
}
Column
{
Rectangle
{
id
:
col
id
:
clipRect
width
:
parent
.
width
height
:
parent
.
height
-
5
width
:
parent
.
width
clip
:
true
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
);
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
_reticleSpacing
Column
{
Repeater
{
id
:
col
model
:
_speedArray
width
:
parent
.
width
anchors.left
:
parent
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
Rectangle
{
spacing
:
_reticleSpacing
property
int
_alt
:
modelData
Repeater
{
width
:
(
_alt
%
10
===
0
)
?
10
:
15
model
:
_speedArray
height
:
_reticleHeight
anchors.left
:
parent
.
left
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
Rectangle
{
Text
{
property
int
_alt
:
modelData
visible
:
(
_alt
%
10
===
0
)
width
:
(
_alt
%
10
===
0
)
?
10
:
15
x
:
20
height
:
_reticleHeight
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
antialiasing
:
true
QGCLabel
{
font.weight
:
Font
.
DemiBold
visible
:
(
_alt
%
10
===
0
)
text
:
_alt
x
:
20
color
:
_alt
<
0
?
"
#f8983a
"
:
"
white
"
anchors.verticalCenter
:
parent
.
verticalCenter
style
:
Text
.
Outline
antialiasing
:
true
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
font.weight
:
Font
.
DemiBold
text
:
_alt
color
:
_alt
<
0
?
"
#f8983a
"
:
"
white
"
style
:
Text
.
Outline
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
}
}
}
}
}
transform
:
Translate
{
transform
:
Translate
{
y
:
((
altitude
-
_currentCenter
)
*
_reticleSlot
/
5
)
-
(
_reticleSlot
/
2
)
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
...
@@ -23,7 +23,7 @@ This file is part of the QGROUNDCONTROL project
/**
/**
* @file
* @file
* @brief QGC
Main Flight Display
* @brief QGC
Attitude Widget
* @author Gus Grubba <mavlink@grubba.com>
* @author Gus Grubba <mavlink@grubba.com>
*/
*/
...
@@ -31,88 +31,49 @@ import QtQuick 2.4
...
@@ -31,88 +31,49 @@ import QtQuick 2.4
Item
{
Item
{
id
:
root
id
:
root
property
real
rollAngle
:
0
property
real
rollAngle
:
0
property
real
pitchAngle
:
0
property
real
pitchAngle
:
0
property
real
backgroundOpacity
:
1
property
bool
showAttitude
:
true
property
bool
displayBackground
:
true
property
bool
useWhite
:
true
anchors.fill
:
parent
anchors.fill
:
parent
Item
{
QGCArtificialHorizon
{
id
:
background
rollAngle
:
root
.
rollAngle
width
:
parent
.
width
*
4
pitchAngle
:
root
.
pitchAngle
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
}]
}
}
}
Image
{
Image
{
id
:
rollDial
id
:
rollDial
visible
:
root
.
showAttitude
anchors
{
bottom
:
root
.
verticalCenter
;
horizontalCenter
:
parent
.
horizontalCenter
}
anchors
{
bottom
:
root
.
verticalCenter
;
horizontalCenter
:
parent
.
horizontalCenter
}
source
:
useWhite
?
"
/qml/rollDialWhite.svg
"
:
"
/qml/rollDial.svg
"
source
:
"
/qml/rollDialWhite.svg
"
mipmap
:
true
mipmap
:
true
width
:
260
width
:
260
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
transform
:
Rotation
{
transform
:
Rotation
{
origin.x
:
rollDial
.
width
/
2
origin.x
:
rollDial
.
width
/
2
origin.y
:
rollDial
.
height
origin.y
:
rollDial
.
height
angle
:
-
rollAngle
angle
:
-
rollAngle
}
}
}
}
Image
{
Image
{
id
:
pointer
id
:
pointer
visible
:
root
.
showAttitude
anchors
{
bottom
:
root
.
verticalCenter
;
horizontalCenter
:
parent
.
horizontalCenter
}
anchors
{
bottom
:
root
.
verticalCenter
;
horizontalCenter
:
parent
.
horizontalCenter
}
source
:
useWhite
?
"
/qml/rollPointerWhite.svg
"
:
"
/qml/rollPointer.svg
"
source
:
"
/qml/rollPointerWhite.svg
"
smooth
:
true
mipmap
:
true
width
:
rollDial
.
width
width
:
rollDial
.
width
fillMode
:
Image
.
PreserveAspectFit
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
...
@@ -28,11 +28,10 @@ This file is part of the QGROUNDCONTROL project
*/
*/
import
QtQuick
2.4
import
QtQuick
2.4
import
QGroundControl
.
Controls
1.0
Item
{
Item
{
id
:
root
id
:
root
width
:
120
height
:
width
property
real
heading
:
0
property
real
heading
:
0
Image
{
Image
{
id
:
compass
id
:
compass
...
@@ -62,7 +61,7 @@ Item {
...
@@ -62,7 +61,7 @@ Item {
height
:
25
height
:
25
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.15
)
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.15
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
Text
{
QGCLabel
{
text
:
heading
.
toFixed
(
0
)
text
:
heading
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
color
:
"
white
"
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
...
@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
*/
*/
import
QtQuick
2.1
import
QtQuick
2.1
import
QGroundControl
.
Controls
1.0
Rectangle
{
Rectangle
{
id
:
root
id
:
root
...
@@ -44,14 +45,14 @@ Rectangle {
...
@@ -44,14 +45,14 @@ Rectangle {
Column
{
Column
{
anchors.centerIn
:
parent
anchors.centerIn
:
parent
spacing
:
4
spacing
:
4
Text
{
QGCLabel
{
text
:
'
h:
'
+
altitude
.
toFixed
(
0
)
text
:
'
h:
'
+
altitude
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
color
:
"
white
"
color
:
"
white
"
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
visible
:
showAltitude
visible
:
showAltitude
}
}
Text
{
QGCLabel
{
text
:
'
vZ:
'
+
vertZ
.
toFixed
(
0
)
text
:
'
vZ:
'
+
vertZ
.
toFixed
(
0
)
color
:
"
white
"
color
:
"
white
"
font.weight
:
showAltitude
?
Font
.
Normal
:
Font
.
DemiBold
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
...
@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
*/
*/
import
QtQuick
2.1
import
QtQuick
2.1
import
QGroundControl
.
Controls
1.0
Rectangle
{
Rectangle
{
id
:
root
id
:
root
...
@@ -44,14 +45,14 @@ Rectangle {
...
@@ -44,14 +45,14 @@ Rectangle {
Column
{
Column
{
anchors.centerIn
:
parent
anchors.centerIn
:
parent
spacing
:
4
spacing
:
4
Text
{
QGCLabel
{
text
:
'
GS:
'
+
groundspeed
.
toFixed
(
0
)
text
:
'
GS:
'
+
groundspeed
.
toFixed
(
0
)
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
color
:
"
white
"
color
:
"
white
"
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
visible
:
showGroundSpeed
visible
:
showGroundSpeed
}
}
Text
{
QGCLabel
{
text
:
'
AS:
'
+
airspeed
.
toFixed
(
0
)
text
:
'
AS:
'
+
airspeed
.
toFixed
(
0
)
color
:
"
white
"
color
:
"
white
"
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
...
...
src/ui/qmlcommon/QGCMapBackground.qml
View file @
9075dbb3
...
@@ -31,15 +31,17 @@ import QtQuick 2.4
...
@@ -31,15 +31,17 @@ import QtQuick 2.4
import
QtPositioning
5.3
import
QtPositioning
5.3
import
QtLocation
5.3
import
QtLocation
5.3
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightControls
1.0
import
QGroundControl
.
FlightControls
1.0
Rectangle
{
Rectangle
{
id
:
root
id
:
root
property
real
latitude
:
37.803784
property
real
latitude
:
37.803784
property
real
longitude
:
-
122.462276
property
real
longitude
:
-
122.462276
property
real
zoomLevel
:
1
5
property
real
zoomLevel
:
1
8
property
real
heading
:
0
property
real
heading
:
0
property
bool
alwaysNorth
:
true
property
bool
alwaysNorth
:
true
property
bool
interactive
:
true
property
alias
mapItem
:
map
property
alias
mapItem
:
map
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
...
@@ -95,8 +97,11 @@ Rectangle {
...
@@ -95,8 +97,11 @@ Rectangle {
height
:
1
height
:
1
zoomLevel
:
root
.
zoomLevel
zoomLevel
:
root
.
zoomLevel
anchors.centerIn
:
parent
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 {
transform: Rotation {
origin.x: map.width / 2
origin.x: map.width / 2
origin.y: map.height / 2
origin.y: map.height / 2
...
@@ -104,7 +109,7 @@ Rectangle {
...
@@ -104,7 +109,7 @@ Rectangle {
}
}
*/
*/
gesture.flickDeceleration
:
3000
gesture.flickDeceleration
:
3000
gesture.enabled
:
tru
e
gesture.enabled
:
root
.
interactiv
e
onWidthChanged
:
{
onWidthChanged
:
{
scaleTimer
.
restart
()
scaleTimer
.
restart
()
...
@@ -118,6 +123,10 @@ Rectangle {
...
@@ -118,6 +123,10 @@ Rectangle {
scaleTimer
.
restart
()
scaleTimer
.
restart
()
}
}
Component.onCompleted
:
{
map
.
zoomLevel
=
18
}
function
calculateScale
()
{
function
calculateScale
()
{
var
coord1
,
coord2
,
dist
,
text
,
f
var
coord1
,
coord2
,
dist
,
text
,
f
f
=
0
f
=
0
...
@@ -170,13 +179,14 @@ Rectangle {
...
@@ -170,13 +179,14 @@ Rectangle {
Item
{
Item
{
id
:
scale
id
:
scale
parent
:
zoomSlider
.
parent
parent
:
zoomSlider
.
parent
visible
:
scaleText
.
text
!=
"
0 m
"
visible
:
scaleText
.
text
!=
=
"
0 m
"
z
:
map
.
z
+
2
z
:
map
.
z
+
2
opacity
:
1
opacity
:
1
anchors
{
anchors
{
bottom
:
zoomSlider
.
top
;
bottom
:
zoomSlider
.
top
;
bottomMargin
:
8
;
bottomMargin
:
8
;
left
:
zoomSlider
.
left
left
:
zoomSlider
.
left
leftMargin
:
4
}
}
Image
{
Image
{
id
:
scaleImageLeft
id
:
scaleImageLeft
...
@@ -196,14 +206,14 @@ Rectangle {
...
@@ -196,14 +206,14 @@ Rectangle {
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.left
:
scaleImage
.
right
anchors.left
:
scaleImage
.
right
}
}
Text
{
QGCLabel
{
id
:
scaleText
id
:
scaleText
color
:
"
white
"
color
:
"
white
"
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
horizontalAlignment
:
Text
.
AlignHCenter
horizontalAlignment
:
Text
.
AlignHCenter
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.bottomMargin
:
8
anchors.bottomMargin
:
10
text
:
"
0 m
"
text
:
"
0 m
"
}
}
Component.onCompleted
:
{
Component.onCompleted
:
{
...
...
src/ui/qmlcommon/QGCPitchWidget.qml
View file @
9075dbb3
...
@@ -28,15 +28,22 @@ This file is part of the QGROUNDCONTROL project
...
@@ -28,15 +28,22 @@ This file is part of the QGROUNDCONTROL project
*/
*/
import
QtQuick
2.1
import
QtQuick
2.1
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
Rectangle
{
Rectangle
{
property
real
pitchAngle
:
0
property
ScreenTools
screenTools
:
ScreenTools
{
}
property
real
rollAngle
:
0
property
real
pitchAngle
:
0
property
real
_reticleHeight
:
1
property
real
rollAngle
:
0
property
real
_reticleSpacing
:
17
property
real
size
:
120
property
real
_reticleSlot
:
_reticleSpacing
+
_reticleHeight
property
real
_reticleHeight
:
1
height
:
110
property
real
_reticleSpacing
:
size
*
0.15
width
:
120
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
radius
:
8
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
@@ -53,27 +60,29 @@ Rectangle {
...
@@ -53,27 +60,29 @@ Rectangle {
Rectangle
{
Rectangle
{
property
int
_pitch
:
-
(
modelData
*
5
-
90
)
property
int
_pitch
:
-
(
modelData
*
5
-
90
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
(
_pitch
%
10
)
===
0
?
50
:
30
width
:
(
_pitch
%
10
)
===
0
?
_longDash
:
_shortDash
height
:
_reticleHeight
height
:
_reticleHeight
color
:
"
white
"
color
:
"
white
"
antialiasing
:
true
antialiasing
:
true
smooth
:
true
smooth
:
true
Text
{
QGCLabel
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenterOffset
:
-
40
anchors.horizontalCenterOffset
:
-
(
_longDash
*
0.8
)
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
smooth
:
true
smooth
:
true
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
font.pointSize
:
_fontSize
<
1
?
1
:
_fontSize
;
text
:
_pitch
text
:
_pitch
color
:
"
white
"
color
:
"
white
"
visible
:
(
_pitch
!=
0
)
&&
((
_pitch
%
10
)
===
0
)
visible
:
(
_pitch
!=
0
)
&&
((
_pitch
%
10
)
===
0
)
}
}
Text
{
QGCLabel
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenterOffset
:
40
anchors.horizontalCenterOffset
:
(
_longDash
*
0.8
)
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
smooth
:
true
smooth
:
true
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
font.pointSize
:
_fontSize
<
1
?
1
:
_fontSize
;
text
:
_pitch
text
:
_pitch
color
:
"
white
"
color
:
"
white
"
visible
:
(
_pitch
!=
0
)
&&
((
_pitch
%
10
)
===
0
)
visible
:
(
_pitch
!=
0
)
&&
((
_pitch
%
10
)
===
0
)
...
@@ -87,7 +96,7 @@ Rectangle {
...
@@ -87,7 +96,7 @@ Rectangle {
}
}
transform
:
[
transform
:
[
Rotation
{
Rotation
{
origin.x
:
width
/
2
origin.x
:
width
/
2
origin.y
:
height
/
2
origin.y
:
height
/
2
angle
:
-
rollAngle
angle
:
-
rollAngle
}
}
...
...
src/ui/qmlcommon/QGCSlider.qml
View file @
9075dbb3
...
@@ -38,78 +38,76 @@
...
@@ -38,78 +38,76 @@
**
**
****************************************************************************/
****************************************************************************/
import
QtQuick
2.0
import
QtQuick
2.1
import
QGroundControl
.
Controls
1.0
Item
{
Item
{
id
:
slider
;
id
:
slider
;
height
:
1
0
height
:
1
2
property
real
value
// value is read/write.
property
real
value
// value is read/write.
property
real
minimum
:
0
property
real
minimum
:
0
property
real
maximum
:
1
property
real
maximum
:
1
property
int
length
:
width
-
handle
.
width
property
int
length
:
width
-
handle
.
width
Rectangle
{
Rectangle
{
anchors.fill
:
parent
anchors.fill
:
parent
border.width
:
1
;
radius
:
6
border.color
:
"
lightgrey
"
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
);
radius
:
8
color
:
"
white
"
opacity
:
1
}
}
Rectangle
{
Rectangle
{
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.leftMargin
:
4
anchors.leftMargin
:
4
anchors.top
:
parent
.
top
radius
:
4
anchors.topMargin
:
(
parent
.
height
-
height
)
/
2
height
:
4
height
:
3
width
:
handle
.
x
-
x
width
:
handle
.
x
-
x
color
:
"
#69bb17
"
color
:
"
#1c94fc
"
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Rectangle
{
Rectangle
{
id
:
labelRect
id
:
labelRect
width
:
label
.
width
width
:
label
.
width
height
:
label
.
height
+
4
height
:
label
.
height
+
4
radius
:
4
radius
:
4
smooth
:
true
smooth
:
true
color
:
"
white
"
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.75
);
border.color
:
"
lightgrey
"
border.color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.45
);
anchors.bottom
:
handle
.
top
anchors.bottom
:
handle
.
top
anchors.bottomMargin
:
4
anchors.bottomMargin
:
4
x
:
Math
.
max
(
Math
.
min
(
handle
.
x
+
(
handle
.
width
-
width
)
/
2
,
slider
.
width
-
width
),
0
)
visible
:
mouseRegion
.
pressed
visible
:
mouseRegion
.
pressed
Text
{
x
:
Math
.
max
(
Math
.
min
(
handle
.
x
+
(
handle
.
width
-
width
)
/
2
,
slider
.
width
-
width
),
0
)
id
:
label
QGCLabel
{
color
:
"
darkgrey
"
id
:
label
text
:
slider
.
value
.
toFixed
(
2
)
color
:
"
black
"
width
:
font
.
pointSize
*
3.5
text
:
slider
.
value
.
toFixed
(
2
)
anchors.horizontalCenter
:
labelRect
.
horizontalCenter
width
:
font
.
pointSize
*
3.5
horizontalAlignment
:
Text
.
AlignHCenter
anchors.horizontalCenter
:
labelRect
.
horizontalCenter
anchors.baseline
:
parent
.
bottom
horizontalAlignment
:
Text
.
AlignHCenter
anchors.baselineOffset
:
-
6
anchors.verticalCenter
:
labelRect
.
verticalCenter
font.pixelSize
:
14
//anchors.baseline: parent.bottom
//anchors.baselineOffset: -6
}
}
}
}
Rectangle
{
Rectangle
{
id
:
handle
;
id
:
handle
;
smooth
:
true
smooth
:
true
width
:
26
;
width
:
26
;
y
:
(
slider
.
height
-
height
)
/
2
;
y
:
(
slider
.
height
-
height
)
/
2
;
x
:
(
slider
.
value
-
slider
.
minimum
)
*
slider
.
length
/
(
slider
.
maximum
-
slider
.
minimum
)
x
:
(
slider
.
value
-
slider
.
minimum
)
*
slider
.
length
/
(
slider
.
maximum
-
slider
.
minimum
)
height
:
width
;
radius
:
width
/
2
height
:
width
gradient
:
normalGradient
radius
:
width
/
2
gradient
:
normalGradient
border.width
:
2
border.width
:
2
border.color
:
"
white
"
border.color
:
"
white
"
Gradient
{
Gradient
{
id
:
normalGradient
id
:
normalGradient
GradientStop
{
position
:
0.0
;
color
:
"
#b0b0b0
"
}
GradientStop
{
position
:
0.0
;
color
:
"
#b0b0b0
"
}
GradientStop
{
position
:
0.66
;
color
:
"
#909090
"
}
GradientStop
{
position
:
0.66
;
color
:
"
#909090
"
}
GradientStop
{
position
:
1.0
;
color
:
"
#545454
"
}
GradientStop
{
position
:
1.0
;
color
:
"
#545454
"
}
}
}
MouseArea
{
MouseArea
{
...
...
src/ui/qmlcommon/QGCSpeedWidget.qml
View file @
9075dbb3
...
@@ -29,6 +29,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -29,6 +29,7 @@ This file is part of the QGROUNDCONTROL project
import
QtQuick
2.4
import
QtQuick
2.4
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
Rectangle
{
Rectangle
{
id
:
root
id
:
root
...
@@ -37,12 +38,9 @@ Rectangle {
...
@@ -37,12 +38,9 @@ Rectangle {
property
real
_reticleSpacing
:
10
property
real
_reticleSpacing
:
10
property
real
_reticleHeight
:
2
property
real
_reticleHeight
:
2
property
real
_reticleSlot
:
_reticleSpacing
+
_reticleHeight
property
real
_reticleSlot
:
_reticleSpacing
+
_reticleHeight
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
z
:
10
z
:
10
height
:
parent
.
height
*
0.75
>
280
?
280
:
parent
.
height
*
0.75
height
:
parent
.
height
*
0.65
>
280
?
280
:
parent
.
height
*
0.65
clip
:
true
smooth
:
true
smooth
:
true
radius
:
5
radius
:
5
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.25
)
border.color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.25
)
...
@@ -51,35 +49,43 @@ Rectangle {
...
@@ -51,35 +49,43 @@ Rectangle {
GradientStop
{
position
:
0.5
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
GradientStop
{
position
:
0.5
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
GradientStop
{
position
:
1.0
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
}
GradientStop
{
position
:
1.0
;
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.65
)
}
}
}
Column
{
Rectangle
{
id
:
col
id
:
clipRect
width
:
parent
.
width
height
:
parent
.
height
-
5
width
:
parent
.
width
clip
:
true
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
);
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
_reticleSpacing
Column
{
Repeater
{
id
:
col
model
:
40
width
:
parent
.
width
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
property
int
_speed
:
-
(
index
-
20
)
spacing
:
_reticleSpacing
width
:
(
_speed
%
5
===
0
)
?
10
:
15
Repeater
{
anchors.right
:
parent
.
right
model
:
40
height
:
_reticleHeight
Rectangle
{
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
property
int
_speed
:
-
(
index
-
20
)
Text
{
width
:
(
_speed
%
5
===
0
)
?
10
:
15
visible
:
(
_speed
%
5
===
0
)
anchors.right
:
parent
.
right
anchors.horizontalCenter
:
parent
.
horizontalCenter
height
:
_reticleHeight
anchors.horizontalCenterOffset
:
-
30
color
:
Qt
.
rgba
(
1
,
1
,
1
,
0.35
)
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
antialiasing
:
true
visible
:
(
_speed
%
5
===
0
)
font.weight
:
Font
.
DemiBold
anchors.horizontalCenter
:
parent
.
horizontalCenter
text
:
_speed
anchors.horizontalCenterOffset
:
-
30
color
:
_speed
<
0
?
"
#f8983a
"
:
"
white
"
anchors.verticalCenter
:
parent
.
verticalCenter
style
:
Text
.
Outline
antialiasing
:
true
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
font.weight
:
Font
.
DemiBold
text
:
_speed
color
:
_speed
<
0
?
"
#f8983a
"
:
"
white
"
style
:
Text
.
Outline
styleColor
:
Qt
.
rgba
(
0
,
0
,
0
,
0.25
)
}
}
}
}
}
}
transform
:
Translate
{
transform
:
Translate
{
y
:
(
speed
*
_reticleSlot
)
-
(
_reticleSlot
/
2
)
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