1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-05-14 13:22:16 -04:00

Improve freqdisplay polling diagnostics and font sizing guards

Agent-Logs-Url: https://github.com/srcejon/sdrangel/sessions/3b53c052-7f2b-4597-b509-d7cc17f3b0b0

Co-authored-by: srcejon <57259258+srcejon@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-18 15:18:50 +00:00 committed by GitHub
parent 3d6815c9d2
commit 965e647e2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,8 +11,8 @@
#include "freqdisplaygui.h"
namespace {
// Derived empirically to keep the rendered frequency text large and readable while
// avoiding clipping in typical feature window sizes.
// For typical feature windows this keeps the text close to ~22% of the smallest
// widget dimension, which yields large readable digits without clipping.
constexpr double frequencyFontScale = 0.22;
constexpr const char* rxTxKinds = "RT";
constexpr int pollIntervalMs = 1000;
@ -217,13 +217,18 @@ void FreqDisplayGUI::updateFrequencyText()
double centerFrequencyHz = 0.0;
int offsetHz = 0;
if (!ChannelWebAPIUtils::getCenterFrequency(selectedChannel.m_superIndex, centerFrequencyHz)
|| !ChannelWebAPIUtils::getFrequencyOffset(selectedChannel.m_superIndex, selectedChannel.m_index, offsetHz))
if (!ChannelWebAPIUtils::getCenterFrequency(selectedChannel.m_superIndex, centerFrequencyHz))
{
ui->frequencyValue->setText(tr("Frequency unavailable"));
updateFrequencyFont();
return;
}
if (!ChannelWebAPIUtils::getFrequencyOffset(selectedChannel.m_superIndex, selectedChannel.m_index, offsetHz))
{
ui->frequencyValue->setText(tr("Offset unavailable"));
updateFrequencyFont();
return;
}
const qint64 centerFrequencyRounded = qRound64(centerFrequencyHz);
const qint64 channelOffset = static_cast<qint64>(offsetHz);
@ -235,6 +240,9 @@ void FreqDisplayGUI::updateFrequencyText()
void FreqDisplayGUI::updateFrequencyFont()
{
const int minDimension = qMin(ui->frequencyValue->width(), ui->frequencyValue->height());
if (minDimension <= 0) {
return;
}
const int pointSize = qMax(minimumFrequencyFontPointSize, static_cast<int>(minDimension * frequencyFontScale));
QFont font = ui->frequencyValue->font();