1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 18:15:45 -05:00

Spectrum: format top line info

This commit is contained in:
f4exb 2021-02-16 22:26:13 +01:00
parent 20da400b21
commit 8f09cdd80e

View File

@ -34,7 +34,7 @@
MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportSampleRate, Message) MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportSampleRate, Message)
MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportWaterfallShare, Message) MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportWaterfallShare, Message)
const float GLSpectrum::m_maxFrequencyZoom = 4.0f; const float GLSpectrum::m_maxFrequencyZoom = 10.0f;
GLSpectrum::GLSpectrum(QWidget* parent) : GLSpectrum::GLSpectrum(QWidget* parent) :
QGLWidget(parent), QGLWidget(parent),
@ -1892,7 +1892,7 @@ void GLSpectrum::applyChanges()
painter.drawRect(m_leftMargin, 0, width() - m_leftMargin, m_infoHeight); painter.drawRect(m_leftMargin, 0, width() - m_leftMargin, m_infoHeight);
painter.setPen(QColor(0xf0, 0xf0, 0xff)); painter.setPen(QColor(0xf0, 0xf0, 0xff));
painter.setFont(font()); painter.setFont(font());
painter.drawText(QPointF(m_leftMargin, fm.height() + fm.ascent() / 2 - 1), infoText); painter.drawText(QPointF(m_leftMargin, fm.height() + fm.ascent() / 2 - 2), infoText);
} }
m_glShaderInfo.initTexture(m_infoPixmap.toImage()); m_glShaderInfo.initTexture(m_infoPixmap.toImage());
@ -2135,7 +2135,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
m_histogramMarkers.back().m_frequencyStr = displayScaled( m_histogramMarkers.back().m_frequencyStr = displayScaled(
frequency, frequency,
'f', 'f',
getPrecision(m_centerFrequency/m_sampleRate), getPrecision((m_centerFrequency*1000)/m_sampleRate),
false); false);
m_histogramMarkers.back().m_power = power; m_histogramMarkers.back().m_power = power;
m_histogramMarkers.back().m_powerStr = displayScaledF( m_histogramMarkers.back().m_powerStr = displayScaledF(
@ -2179,7 +2179,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
m_waterfallMarkers.back().m_frequencyStr = displayScaled( m_waterfallMarkers.back().m_frequencyStr = displayScaled(
frequency, frequency,
'f', 'f',
getPrecision(m_centerFrequency/m_sampleRate), getPrecision((m_centerFrequency*1000)/m_sampleRate),
false); false);
m_waterfallMarkers.back().m_time = time; m_waterfallMarkers.back().m_time = time;
m_waterfallMarkers.back().m_timeStr = displayScaledF( m_waterfallMarkers.back().m_timeStr = displayScaledF(
@ -2603,4 +2603,12 @@ void GLSpectrum::formatTextInfo(QString& info)
if (m_frequencyZoomFactor != 1.0f) { if (m_frequencyZoomFactor != 1.0f) {
info.append(tr("%1x ").arg(QString::number(m_frequencyZoomFactor, 'f', 1))); info.append(tr("%1x ").arg(QString::number(m_frequencyZoomFactor, 'f', 1)));
} }
int64_t centerFrequency;
int frequencySpan;
getFrequencyZoom(centerFrequency, frequencySpan);
info.append(tr("CF:%1 ").arg(displayScaled(centerFrequency, 'f', getPrecision(centerFrequency/frequencySpan), true)));
info.append(tr("SP:%1 ").arg(displayScaled(frequencySpan, 'f', getPrecision(frequencySpan/100), true)));
} }