mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
Spectrum markers dialog (2)
This commit is contained in:
parent
1decb23fac
commit
a49a88d67c
@ -1178,6 +1178,7 @@ void GLSpectrum::drawMarkers()
|
||||
{
|
||||
ypoint.ry() =
|
||||
(m_powerScale.getRangeMax() - m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin]) / m_powerScale.getRange();
|
||||
ypoint.ry() = ypoint.ry() > 1 ? 1 : ypoint.ry();
|
||||
powerStr = displayScaledF(
|
||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin],
|
||||
m_linear ? 'e' : 'f',
|
||||
@ -1227,11 +1228,14 @@ void GLSpectrum::drawMarkers()
|
||||
float poweri = m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin] :
|
||||
m_linear ? m_histogramMarkers.at(i).m_power : CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
||||
QString deltaPowerStr = displayScaledF(
|
||||
poweri - power0,
|
||||
m_linear ? 'e' : 'f',
|
||||
m_linear ? 3 : 1,
|
||||
false);
|
||||
QString deltaPowerStr;
|
||||
|
||||
if (m_linear) {
|
||||
deltaPowerStr = displayScaledF(poweri - power0, 'e', 3, false);
|
||||
} else {
|
||||
deltaPowerStr = QString::number(poweri - power0, 'f', 1);
|
||||
}
|
||||
|
||||
drawTextOverlay(
|
||||
m_histogramMarkers.at(i).m_deltaFrequencyStr,
|
||||
QColor(255, 255, 255, 192),
|
||||
|
@ -50,10 +50,11 @@ void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0)
|
||||
{
|
||||
ui->markerText->setText("-");
|
||||
ui->marker->setEnabled(false);
|
||||
ui->markerFrequency->setEnabled(false);
|
||||
ui->powerMode->setEnabled(false);
|
||||
ui->fixedPower->setEnabled(false);
|
||||
ui->markerText->setText("-");
|
||||
ui->fixedPower->setValue(0);
|
||||
ui->fixedPowerText->setText(tr("0.0"));
|
||||
}
|
||||
@ -61,10 +62,12 @@ void SpectrumMarkersDialog::displayHistogramMarker()
|
||||
{
|
||||
ui->marker->setEnabled(true);
|
||||
ui->markerFrequency->setEnabled(true);
|
||||
ui->powerMode->setEnabled(true);
|
||||
ui->fixedPower->setEnabled(true);
|
||||
ui->markerText->setText(tr("%1").arg(m_histogramMarkerIndex));
|
||||
ui->markerFrequency->setValue(m_histogramMarkers[m_histogramMarkerIndex].m_frequency);
|
||||
ui->powerMode->setCurrentIndex((int) m_histogramMarkers[m_histogramMarkerIndex].m_markerType);
|
||||
float powerDB = CalcDb::dbPower(m_histogramMarkers[m_histogramMarkerIndex].m_power);
|
||||
ui->fixedPower->setEnabled(true);
|
||||
ui->fixedPower->setValue(powerDB*10);
|
||||
ui->fixedPowerText->setText(QString::number(powerDB, 'f', 1));
|
||||
}
|
||||
@ -114,6 +117,21 @@ void SpectrumMarkersDialog::on_marker_valueChanged(int value)
|
||||
displayHistogramMarker();
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_setReference_clicked(bool checked)
|
||||
{
|
||||
(void) checked;
|
||||
|
||||
if ((m_histogramMarkerIndex == 0) || (m_histogramMarkers.size() < 2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpectrumHistogramMarker marker0 = m_histogramMarkers.at(0);
|
||||
m_histogramMarkers[0] = m_histogramMarkers[m_histogramMarkerIndex];
|
||||
m_histogramMarkers[m_histogramMarkerIndex] = marker0;
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_markerAdd_clicked(bool checked)
|
||||
{
|
||||
(void) checked;
|
||||
@ -146,3 +164,13 @@ void SpectrumMarkersDialog::on_markerDel_clicked(bool checked)
|
||||
displayHistogramMarker();
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
||||
void SpectrumMarkersDialog::on_powerMode_currentIndexChanged(int index)
|
||||
{
|
||||
if (m_histogramMarkers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = (SpectrumHistogramMarkerType) index;
|
||||
m_histogramMarkersChanged = true;
|
||||
}
|
||||
|
@ -60,8 +60,10 @@ private slots:
|
||||
void on_markerFrequency_changed(qint64 value);
|
||||
void on_fixedPower_valueChanged(int value);
|
||||
void on_marker_valueChanged(int value);
|
||||
void on_setReference_clicked(bool checked);
|
||||
void on_markerAdd_clicked(bool checked);
|
||||
void on_markerDel_clicked(bool checked);
|
||||
void on_powerMode_currentIndexChanged(int index);
|
||||
void accept();
|
||||
void reject();
|
||||
};
|
||||
|
@ -155,6 +155,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="setReference">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set marker as reference (index 0)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>R</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="markerAddRemoveLayout">
|
||||
<property name="spacing">
|
||||
|
Loading…
Reference in New Issue
Block a user