mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-1005 Adds configurable units for velocity/speed and altitude in QML PFD. Units are configured in settings panel.
OP-1015 Reduces precision of the PDOP value in the PFD display to 3 decimals.
This commit is contained in:
parent
d28609349f
commit
a6ac956127
@ -24,10 +24,10 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// The altitude scale represents 30 meters,
|
||||
// move it in 0..5m range
|
||||
anchors.verticalCenterOffset: -height/30 * (PositionActual.Down-Math.floor(PositionActual.Down/5)*5)
|
||||
anchors.verticalCenterOffset: -height/30 * (PositionActual.Down-Math.floor(PositionActual.Down/5*qmlWidget.altitudeFactor)*5)
|
||||
anchors.left: parent.left
|
||||
|
||||
property int topNumber: 15-Math.floor(PositionActual.Down/5)*5
|
||||
property int topNumber: 15-Math.floor(PositionActual.Down/5*qmlWidget.altitudeFactor)*5
|
||||
|
||||
// Altitude numbers
|
||||
Column {
|
||||
@ -52,7 +52,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SvgElementImage {
|
||||
id: altitude_window
|
||||
clip: true
|
||||
@ -69,7 +68,7 @@ Item {
|
||||
|
||||
Text {
|
||||
id: altitude_text
|
||||
text: Math.floor(-PositionActual.Down).toFixed()
|
||||
text: Math.floor(-PositionActual.Down * qmlWidget.altitudeFactor).toFixed()
|
||||
color: "white"
|
||||
font {
|
||||
family: "Arial"
|
||||
@ -78,4 +77,26 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
SvgElementImage {
|
||||
id: altitude_unit
|
||||
elementName: "altitude-unit"
|
||||
sceneSize: sceneItem.sceneSize
|
||||
clip: true
|
||||
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
|
||||
Text {
|
||||
id: altitude_unit_text
|
||||
text: qmlWidget.altitudeUnit
|
||||
color: "white"
|
||||
font {
|
||||
family: "Arial"
|
||||
pixelSize: parent.height
|
||||
}
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ Item {
|
||||
|
||||
Text {
|
||||
id: gps_text
|
||||
text: "GPS: " + GPSPosition.Satellites + "\nPDP: " + GPSPosition.PDOP
|
||||
text: "GPS: " + GPSPosition.Satellites + "\nPDP: " + Math.round(GPSPosition.PDOP*1000)/1000
|
||||
color: "white"
|
||||
font.family: "Arial"
|
||||
font.pixelSize: telemetry_status.height * 0.75
|
||||
|
@ -3,7 +3,7 @@ import Qt 4.7
|
||||
Item {
|
||||
id: sceneItem
|
||||
property variant sceneSize
|
||||
property real groundSpeed : Math.sqrt(Math.pow(VelocityActual.North,2)+
|
||||
property real groundSpeed : qmlWidget.speedFactor * Math.sqrt(Math.pow(VelocityActual.North,2)+
|
||||
Math.pow(VelocityActual.East,2))
|
||||
|
||||
SvgElementImage {
|
||||
@ -58,7 +58,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SvgElementImage {
|
||||
id: speed_window
|
||||
clip: true
|
||||
@ -82,4 +81,25 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
SvgElementImage {
|
||||
id: speed_unit
|
||||
elementName: "speed-unit"
|
||||
sceneSize: sceneItem.sceneSize
|
||||
clip: true
|
||||
|
||||
x: Math.floor(scaledBounds.x * sceneItem.width)
|
||||
y: Math.floor(scaledBounds.y * sceneItem.height)
|
||||
|
||||
Text {
|
||||
id: speed_unit_text
|
||||
text: qmlWidget.speedUnit
|
||||
color: "white"
|
||||
font {
|
||||
family: "Arial"
|
||||
pixelSize: parent.height
|
||||
}
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
height="707.56323"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="pfd-11.svg"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="pfd.svg"
|
||||
style="display:inline"
|
||||
inkscape:export-filename="C:\Users\Nuno\Desktop\OpenPilot\PFD\PFD-4.png"
|
||||
inkscape:export-xdpi="71.993568"
|
||||
@ -1616,15 +1616,15 @@
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.1617336"
|
||||
inkscape:cx="415.72223"
|
||||
inkscape:cy="353.78162"
|
||||
inkscape:cx="613.40088"
|
||||
inkscape:cy="388.21292"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:current-layer="foreground"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-4"
|
||||
inkscape:window-y="-4"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
showguides="false"
|
||||
inkscape:guide-bbox="true"
|
||||
@ -1953,8 +1953,7 @@
|
||||
id="layer3"
|
||||
inkscape:label="foreground"
|
||||
style="display:inline"
|
||||
transform="translate(230.4171,-2.5493479)"
|
||||
sodipodi:insensitive="true">
|
||||
transform="translate(230.4171,-2.5493479)">
|
||||
<g
|
||||
id="g4306"
|
||||
transform="translate(101.68019,0)">
|
||||
@ -1980,7 +1979,7 @@
|
||||
</g>
|
||||
<g
|
||||
id="g4314"
|
||||
transform="translate(19.192898,-0.66496591)">
|
||||
transform="translate(19.192898,0)">
|
||||
<rect
|
||||
transform="translate(-230.4171,2.5493479)"
|
||||
y="567.56323"
|
||||
@ -2003,7 +2002,7 @@
|
||||
</g>
|
||||
<g
|
||||
id="g4322"
|
||||
transform="translate(184.16754,-1.0101525)">
|
||||
transform="translate(184.16754,0)">
|
||||
<rect
|
||||
transform="translate(-230.4171,2.5493479)"
|
||||
y="567.56323"
|
||||
@ -2048,6 +2047,14 @@
|
||||
height="450"
|
||||
x="-147.23766"
|
||||
y="131.33096" />
|
||||
<rect
|
||||
inkscape:label="#rect3715"
|
||||
y="582.7168"
|
||||
x="-146.92119"
|
||||
height="18"
|
||||
width="109.31937"
|
||||
id="speed-unit"
|
||||
style="fill:none;stroke:none" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:label="#rect6927"
|
||||
@ -2068,6 +2075,21 @@
|
||||
x="-163.69627"
|
||||
y="131.33096" />
|
||||
</g>
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc"
|
||||
id="altitude-window"
|
||||
d="m 725.72624,337.87741 -94.64401,0 0,9.26319 -12.72112,9.26318 12.72112,9.26318 -0.10207,9.26319 94.7461,0 0,-37.05274 z"
|
||||
style="fill:#000000;fill-opacity:0.78431373;stroke:#ffffff;stroke-width:2.18486142;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline"
|
||||
inkscape:label="#rect6927" />
|
||||
<rect
|
||||
inkscape:label="#rect3715"
|
||||
y="583.00885"
|
||||
x="617.78217"
|
||||
height="18"
|
||||
width="109.31937"
|
||||
id="altitude-unit"
|
||||
style="fill:none;stroke:none;display:inline" />
|
||||
<path
|
||||
style="fill:#000000;fill-opacity:0.15686275;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
|
||||
d="m -15.423661,592.19188 0,96.40626 88.90625,0 0.50508,0.007 430.628851,0 0.17857,0 88.6875,0 0,-96.41369 -65.125,0 -23.78125,23.78125 0.23331,-0.70982 -432.045811,0 0,0 -23.0625,-23.071 -65.125,0 z"
|
||||
@ -2080,7 +2102,7 @@
|
||||
transform="matrix(0.53532208,0,0,0.53532208,250.40617,503.97463)">
|
||||
<path
|
||||
transform="translate(0.08444214,0)"
|
||||
d="m 589.99999,195.93361 a 20.714285,20.714285 0 1 1 -41.42857,0 20.714285,20.714285 0 1 1 41.42857,0 z"
|
||||
d="m 589.99999,195.93361 c 0,11.44018 -9.2741,20.71428 -20.71428,20.71428 -11.44019,0 -20.71429,-9.2741 -20.71429,-20.71428 0,-11.44018 9.2741,-20.71429 20.71429,-20.71429 11.44018,0 20.71428,9.27411 20.71428,20.71429 z"
|
||||
sodipodi:ry="20.714285"
|
||||
sodipodi:rx="20.714285"
|
||||
sodipodi:cy="195.93361"
|
||||
@ -2142,7 +2164,7 @@
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
transform="translate(-2.6785714,0.71428572)"
|
||||
d="m 591.60716,426.20148 a 5.8035712,5.8035712 0 1 1 -11.60714,0 5.8035712,5.8035712 0 1 1 11.60714,0 z"
|
||||
d="m 591.60716,426.20148 c 0,3.20522 -2.59835,5.80357 -5.80357,5.80357 -3.20523,0 -5.80357,-2.59835 -5.80357,-5.80357 0,-3.20523 2.59834,-5.80357 5.80357,-5.80357 3.20522,0 5.80357,2.59834 5.80357,5.80357 z"
|
||||
sodipodi:ry="5.8035712"
|
||||
sodipodi:rx="5.8035712"
|
||||
sodipodi:cy="426.20148"
|
||||
@ -2167,16 +2189,9 @@
|
||||
inkscape:label="#path7548"
|
||||
style="fill:#525652;fill-opacity:1;stroke:#262020;stroke-width:0.28871548px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
|
||||
d="m 272.8475,677.71861 0,2.67964 9.06747,0 0,1.41651 0,0.0271 0,1.41651 -9.06747,0 0,2.67964 -4.11419,-4.11419 4.11419,-4.10518 z"
|
||||
id="path5386"
|
||||
id="path5386-1"
|
||||
sodipodi:nodetypes="cccccccccc"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc"
|
||||
id="altitude-window"
|
||||
d="m 725.72624,337.87741 -94.64401,0 0,9.26319 -12.72112,9.26318 12.72112,9.26318 -0.10207,9.26319 94.7461,0 0,-37.05274 z"
|
||||
style="fill:#000000;fill-opacity:0.78431373;stroke:#ffffff;stroke-width:2.18486142;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline"
|
||||
inkscape:label="#rect6927" />
|
||||
<g
|
||||
id="g5266">
|
||||
<circle
|
||||
@ -2263,30 +2278,6 @@
|
||||
x="651.09412"
|
||||
y="122.98123"
|
||||
style="font-size:22px;font-weight:bold;fill:#ffffff;stroke:none;-inkscape-font-specification:Sans Bold">ALT</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:14px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
|
||||
x="-67.905884"
|
||||
y="596.9812"
|
||||
id="text3699-9"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3701-4"
|
||||
x="-67.905884"
|
||||
y="596.9812"
|
||||
style="font-size:18px;font-weight:normal;fill:#ffffff;stroke:none;-inkscape-font-specification:Sans">m/s</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:14px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
|
||||
x="710.81567"
|
||||
y="595.98126"
|
||||
id="text3699-8"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3701-8"
|
||||
x="710.81567"
|
||||
y="595.98126"
|
||||
style="font-size:18px;font-weight:normal;fill:#ffffff;stroke:none;-inkscape-font-specification:Sans">m</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
@ -4706,7 +4697,8 @@
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer24"
|
||||
inkscape:label="rect2816">
|
||||
inkscape:label="rect2816"
|
||||
style="display:inline">
|
||||
<path
|
||||
style="fill:#453e3e;fill-opacity:1;stroke:#000000;stroke-width:4.08031273;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
|
||||
d="m -115.54603,-47.690063 c -2.50791,0 -4.54785,1.99743 -4.54785,4.50534 l 0,807.009363 c 0,2.5079 2.03994,4.54785 4.54785,4.54785 l 807.00936,0 c 2.5079,0 4.50534,-2.03995 4.50534,-4.54785 l 0,-807.009363 c 0,-2.50791 -1.99744,-4.50534 -4.50534,-4.50534 l -807.00936,0 z M 289.34,11.395529 c 150.15374,0 271.88009,59.618653 272.02085,133.162711 l 0.21252,48.57516 -0.38253,374.99409 C 556.30557,639.62843 436.47945,673.69951 289.34,673.69951 c -147.13944,0 -266.965554,-34.07108 -271.850844,-105.57202 l -0.21251,0 0,-374.99409 0.0425,-48.58122 C 17.459906,71.008112 139.18627,11.395529 289.34,11.395529 z"
|
||||
|
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 188 KiB |
@ -46,6 +46,10 @@ void PfdQmlGadget::loadConfiguration(IUAVGadgetConfiguration *config)
|
||||
m_widget->setLatitude(m->latitude());
|
||||
m_widget->setLongitude(m->longitude());
|
||||
m_widget->setAltitude(m->altitude());
|
||||
m_widget->setSpeedFactor(m->speedFactor());
|
||||
m_widget->setSpeedUnit(m->speedUnit());
|
||||
m_widget->setAltitudeFactor(m->altitudeFactor());
|
||||
m_widget->setAltitudeUnit(m->altitudeUnit());
|
||||
|
||||
// setting OSGEARTH_CACHE_ONLY seems to work the most reliably
|
||||
// between osgEarth versions I tried
|
||||
|
@ -31,8 +31,19 @@ PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings
|
||||
m_latitude(0),
|
||||
m_longitude(0),
|
||||
m_altitude(0),
|
||||
m_cacheOnly(false)
|
||||
m_cacheOnly(false),
|
||||
m_speedFactor(1.0),
|
||||
m_altitudeFactor(1.0)
|
||||
{
|
||||
|
||||
m_speedMap[1.0] = "m/s";
|
||||
m_speedMap[3.6] = "km/h";
|
||||
m_speedMap[2.2369] = "mph";
|
||||
m_speedMap[1.9438] = "knots";
|
||||
|
||||
m_altitudeMap[1.0] = "m";
|
||||
m_altitudeMap[3.2808] = "ft";
|
||||
|
||||
// if a saved configuration exists load it
|
||||
if (qSettings != 0) {
|
||||
m_qmlFile = qSettings->value("qmlFile").toString();
|
||||
@ -48,6 +59,8 @@ PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings
|
||||
m_longitude = qSettings->value("longitude").toDouble();
|
||||
m_altitude = qSettings->value("altitude").toDouble();
|
||||
m_cacheOnly = qSettings->value("cacheOnly").toBool();
|
||||
m_speedFactor = qSettings->value("speedFactor").toDouble();
|
||||
m_altitudeFactor = qSettings->value("altitudeFactor").toDouble();
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,6 +81,8 @@ IUAVGadgetConfiguration *PfdQmlGadgetConfiguration::clone()
|
||||
m->m_longitude = m_longitude;
|
||||
m->m_altitude = m_altitude;
|
||||
m->m_cacheOnly = m_cacheOnly;
|
||||
m->m_speedFactor = m_speedFactor;
|
||||
m->m_altitudeFactor = m_altitudeFactor;
|
||||
|
||||
return m;
|
||||
}
|
||||
@ -91,4 +106,6 @@ void PfdQmlGadgetConfiguration::saveConfig(QSettings *qSettings) const
|
||||
qSettings->setValue("longitude", m_longitude);
|
||||
qSettings->setValue("altitude", m_altitude);
|
||||
qSettings->setValue("cacheOnly", m_cacheOnly);
|
||||
qSettings->setValue("speedFactor", m_speedFactor);
|
||||
qSettings->setValue("altitudeFactor", m_altitudeFactor);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define PFDQMLGADGETCONFIGURATION_H
|
||||
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include <QMap>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
@ -62,6 +63,14 @@ public:
|
||||
{
|
||||
m_cacheOnly = flag;
|
||||
}
|
||||
void setSpeedFactor(double factor)
|
||||
{
|
||||
m_speedFactor = factor;
|
||||
}
|
||||
void setAltitudeFactor(double factor)
|
||||
{
|
||||
m_altitudeFactor = factor;
|
||||
}
|
||||
|
||||
QString qmlFile() const
|
||||
{
|
||||
@ -99,6 +108,34 @@ public:
|
||||
{
|
||||
return m_cacheOnly;
|
||||
}
|
||||
double speedFactor() const
|
||||
{
|
||||
return m_speedFactor;
|
||||
}
|
||||
double altitudeFactor() const
|
||||
{
|
||||
return m_altitudeFactor;
|
||||
}
|
||||
|
||||
QString speedUnit() const
|
||||
{
|
||||
return m_speedMap[m_speedFactor];
|
||||
}
|
||||
|
||||
QString altitudeUnit() const
|
||||
{
|
||||
return m_altitudeMap[m_altitudeFactor];
|
||||
}
|
||||
|
||||
QMapIterator<double, QString> speedMapIterator()
|
||||
{
|
||||
return QMapIterator<double, QString>(m_speedMap);
|
||||
}
|
||||
|
||||
QMapIterator<double, QString> altitudeMapIterator()
|
||||
{
|
||||
return QMapIterator<double, QString>(m_altitudeMap);
|
||||
}
|
||||
|
||||
void saveConfig(QSettings *settings) const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
@ -113,6 +150,10 @@ private:
|
||||
double m_longitude;
|
||||
double m_altitude;
|
||||
bool m_cacheOnly;
|
||||
double m_speedFactor;
|
||||
double m_altitudeFactor;
|
||||
QMap<double, QString> m_speedMap;
|
||||
QMap<double, QString> m_altitudeMap;
|
||||
};
|
||||
|
||||
#endif // PfdQmlGADGETCONFIGURATION_H
|
||||
|
@ -62,6 +62,23 @@ QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
|
||||
options_page->altitude->setText(QString::number(m_config->altitude()));
|
||||
options_page->useOnlyCache->setChecked(m_config->cacheOnly());
|
||||
|
||||
//Setup units combos
|
||||
QMapIterator<double, QString> iter = m_config->speedMapIterator();
|
||||
while(iter.hasNext())
|
||||
{
|
||||
iter.next();
|
||||
options_page->speedUnitCombo->addItem(iter.value(), iter.key());
|
||||
}
|
||||
options_page->speedUnitCombo->setCurrentIndex(options_page->speedUnitCombo->findData(m_config->speedFactor()));
|
||||
|
||||
iter = m_config->altitudeMapIterator();
|
||||
while(iter.hasNext())
|
||||
{
|
||||
iter.next();
|
||||
options_page->altUnitCombo->addItem(iter.value(), iter.key());
|
||||
}
|
||||
options_page->altUnitCombo->setCurrentIndex(options_page->altUnitCombo->findData(m_config->altitudeFactor()));
|
||||
|
||||
#ifndef USE_OSG
|
||||
options_page->showTerrain->setChecked(false);
|
||||
options_page->showTerrain->setVisible(false);
|
||||
@ -93,6 +110,9 @@ void PfdQmlGadgetOptionsPage::apply()
|
||||
m_config->setLongitude(options_page->longitude->text().toDouble());
|
||||
m_config->setAltitude(options_page->altitude->text().toDouble());
|
||||
m_config->setCacheOnly(options_page->useOnlyCache->isChecked());
|
||||
|
||||
m_config->setSpeedFactor(options_page->speedUnitCombo->itemData(options_page->speedUnitCombo->currentIndex()).toDouble());
|
||||
m_config->setAltitudeFactor(options_page->altUnitCombo->itemData(options_page->altUnitCombo->currentIndex()).toDouble());
|
||||
}
|
||||
|
||||
void PfdQmlGadgetOptionsPage::finish()
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>436</height>
|
||||
<width>636</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,11 +19,11 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
@ -39,15 +39,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>436</height>
|
||||
<width>636</width>
|
||||
<height>558</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
@ -77,7 +77,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useOpenGL">
|
||||
<property name="text">
|
||||
<string>Use OpenGL</string>
|
||||
@ -87,7 +87,45 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Speed Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Altitude Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="speedUnitCombo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="altUnitCombo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="showTerrain">
|
||||
<property name="title">
|
||||
<string>Show Terrain:</string>
|
||||
@ -223,7 +261,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -39,7 +39,11 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
|
||||
m_actualPositionUsed(false),
|
||||
m_latitude(46.671478),
|
||||
m_longitude(10.158932),
|
||||
m_altitude(2000)
|
||||
m_altitude(2000),
|
||||
m_speedUnit("m/s"),
|
||||
m_speedFactor(1.0),
|
||||
m_altitudeUnit("m"),
|
||||
m_altitudeFactor(1.0)
|
||||
{
|
||||
setMinimumSize(64, 64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
@ -121,6 +125,38 @@ void PfdQmlGadgetWidget::setTerrainEnabled(bool arg)
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setSpeedUnit(QString unit)
|
||||
{
|
||||
if (m_speedUnit != unit) {
|
||||
m_speedUnit = unit;
|
||||
emit speedUnitChanged(unit);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setSpeedFactor(double factor)
|
||||
{
|
||||
if (m_speedFactor != factor) {
|
||||
m_speedFactor = factor;
|
||||
emit speedFactorChanged(factor);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setAltitudeUnit(QString unit)
|
||||
{
|
||||
if (m_altitudeUnit != unit) {
|
||||
m_altitudeUnit = unit;
|
||||
emit altitudeUnitChanged(unit);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setAltitudeFactor(double factor)
|
||||
{
|
||||
if (m_altitudeFactor != factor) {
|
||||
m_altitudeFactor = factor;
|
||||
emit altitudeFactorChanged(factor);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setOpenGLEnabled(bool arg)
|
||||
{
|
||||
if (m_openGLEnabled != arg) {
|
||||
|
@ -26,6 +26,11 @@ class PfdQmlGadgetWidget : public QDeclarativeView {
|
||||
|
||||
Q_PROPERTY(bool actualPositionUsed READ actualPositionUsed WRITE setActualPositionUsed NOTIFY actualPositionUsedChanged)
|
||||
|
||||
Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged)
|
||||
Q_PROPERTY(double speedFactor READ speedFactor WRITE setSpeedFactor NOTIFY speedFactorChanged)
|
||||
Q_PROPERTY(QString altitudeUnit READ altitudeUnit WRITE setAltitudeUnit NOTIFY altitudeUnitChanged)
|
||||
Q_PROPERTY(double altitudeFactor READ altitudeFactor WRITE setAltitudeFactor NOTIFY altitudeFactorChanged)
|
||||
|
||||
// pre-defined fallback position
|
||||
Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged)
|
||||
Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged)
|
||||
@ -45,6 +50,23 @@ public:
|
||||
return m_terrainEnabled && m_openGLEnabled;
|
||||
}
|
||||
|
||||
QString speedUnit() const
|
||||
{
|
||||
return m_speedUnit;
|
||||
}
|
||||
double speedFactor() const
|
||||
{
|
||||
return m_speedFactor;
|
||||
}
|
||||
QString altitudeUnit() const
|
||||
{
|
||||
return m_altitudeUnit;
|
||||
}
|
||||
double altitudeFactor() const
|
||||
{
|
||||
return m_altitudeFactor;
|
||||
}
|
||||
|
||||
bool actualPositionUsed() const
|
||||
{
|
||||
return m_actualPositionUsed;
|
||||
@ -65,6 +87,12 @@ public:
|
||||
public slots:
|
||||
void setEarthFile(QString arg);
|
||||
void setTerrainEnabled(bool arg);
|
||||
|
||||
void setSpeedUnit(QString unit);
|
||||
void setSpeedFactor(double factor);
|
||||
void setAltitudeUnit(QString unit);
|
||||
void setAltitudeFactor(double factor);
|
||||
|
||||
void setOpenGLEnabled(bool arg);
|
||||
|
||||
void setLatitude(double arg);
|
||||
@ -82,6 +110,11 @@ signals:
|
||||
void longitudeChanged(double arg);
|
||||
void altitudeChanged(double arg);
|
||||
|
||||
void speedUnitChanged(QString arg);
|
||||
void speedFactorChanged(double arg);
|
||||
void altitudeUnitChanged(QString arg);
|
||||
void altitudeFactorChanged(double arg);
|
||||
|
||||
private:
|
||||
QString m_qmlFileName;
|
||||
QString m_earthFile;
|
||||
@ -92,6 +125,11 @@ private:
|
||||
double m_latitude;
|
||||
double m_longitude;
|
||||
double m_altitude;
|
||||
|
||||
QString m_speedUnit;
|
||||
double m_speedFactor;
|
||||
QString m_altitudeUnit;
|
||||
double m_altitudeFactor;
|
||||
};
|
||||
|
||||
#endif /* PFDQMLGADGETWIDGET_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user