1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

GPS Display gadget: also display SNR above each satellite bar in the display gadget.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2203 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-12-08 17:22:55 +00:00 committed by edouard
parent 970b155870
commit d8db3087ca
3 changed files with 718 additions and 692 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>376</height>
<width>579</width>
<height>379</height>
</rect>
</property>
<property name="sizePolicy">
@ -587,6 +587,11 @@
<height>95</height>
</size>
</property>
<property name="toolTip">
<string>Displays the SNR for each detected sat.
Satellite number (PRN) is displayed inside the green bar.
Sat SNR is displayed above (in dBHz)</string>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>

View File

@ -21,6 +21,11 @@ GpsSnrWidget::GpsSnrWidget(QWidget *parent) :
satTexts[i] = new QGraphicsSimpleTextItem("##",boxes[i]);
satTexts[i]->setBrush(QColor("Black"));
satTexts[i]->setFont(QFont("Courier"));
satSNRs[i] = new QGraphicsSimpleTextItem("##",boxes[i]);
satSNRs[i]->setBrush(QColor("Black"));
satSNRs[i]->setFont(QFont("Courier"));
}
}
@ -108,6 +113,21 @@ void GpsSnrWidget::drawSat(int index) {
matrix.scale(scale,scale);
matrix.translate(-textRect.width()/2,-textRect.height());
satTexts[index]->setTransform(matrix,false);
QString snrString = QString().number(snr);
if (snrString.length() ==1) { // Will probably never happen!
snrString = "0" + snrString;
}
satSNRs[index]->setText(snrString);
textRect = satSNRs[index]->boundingRect();
matrix.reset();
scale = 0.85 * (boxRect.width() / textRect.width());
matrix.translate( boxRect.width()/2,0);
matrix.scale(scale,scale);
matrix.translate(-textRect.width()/2,-textRect.height());
satSNRs[index]->setTransform(matrix,false);
} else {
boxes[index]->hide();
}

View File

@ -22,6 +22,7 @@ private:
QGraphicsScene *scene;
QGraphicsRectItem *boxes[MAX_SATTELITES];
QGraphicsSimpleTextItem* satTexts[MAX_SATTELITES];
QGraphicsSimpleTextItem* satSNRs[MAX_SATTELITES];
void drawSat(int index);