Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotter and waterfall performance enhancements #1383

Merged
merged 17 commits into from
Oct 19, 2024
Merged
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ The following people and organisations have contributed to gqrx:
* Grigory Shipunov
* Gwenhael Goavec-Merou
* Herman Semenov
* James Yuzawa
* Jaroslav Škarvada
* Jeff Long
* Jiawei Chen
Expand Down
5 changes: 1 addition & 4 deletions src/applications/gqrx/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set>
</property>
<property name="unifiedTitleAndToolBarOnMac">
<bool>true</bool>
<bool>false</bool>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -349,9 +349,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
18 changes: 11 additions & 7 deletions src/qtgui/meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CMeter::CMeter(QWidget *parent) : QFrame(parent)

m_dBFS = MIN_DB;
m_Sql = -150.0;
m_font = QFont("Arial");
}

CMeter::~CMeter()
Expand All @@ -71,9 +72,14 @@ QSize CMeter::sizeHint() const

void CMeter::setLevel(float dbfs)
{
const float old = m_dBFS;
float alpha = dbfs < m_dBFS ? ALPHA_DECAY : ALPHA_RISE;
m_dBFS -= alpha * (m_dBFS - dbfs);
update();
// only redraw when the label needs to change
if (qRound(m_dBFS * 10) != qRound(old * 10))
{
update();
}
}

void CMeter::setSqlLevel(float dbfs)
Expand Down Expand Up @@ -116,9 +122,8 @@ void CMeter::draw(QPainter &painter)
painter.drawLine(QLineF(x, hline, x, hline + 8));
}

QFont font("Arial");
font.setPixelSize(height() / 4);
painter.setFont(font);
m_font.setPixelSize(height() / 4);
painter.setFont(m_font);

painter.setPen(QColor(0xDA, 0xDA, 0xDA, 0xFF));
painter.drawText(marg, height() - 2, QString::number((double)m_dBFS, 'f', 1) + " dBFS" );
Expand Down Expand Up @@ -148,9 +153,8 @@ void CMeter::drawOverlay(QPainter &painter)
}

// draw scale text
QFont font("Arial");
font.setPixelSize(height() / 4);
painter.setFont(font);
m_font.setPixelSize(height() / 4);
painter.setFont(m_font);
qreal rwidth = (hstop - marg) / 5.0;
QRectF rect(marg - rwidth / 2, 0, rwidth, majstart);

Expand Down
1 change: 1 addition & 0 deletions src/qtgui/meter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ public slots:

float m_dBFS;
float m_Sql;
QFont m_font;
};
Loading
Loading