diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp
index aa317de4e..d699f6389 100644
--- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp
+++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp
@@ -523,8 +523,7 @@ void BFMDemodGUI::tick()
ui->channelPower->setText(QString::number(powDbAvg, 'f', 1));
Real pilotPowDb = CalcDb::dbPower(m_bfmDemod->getPilotLevel());
- QString pilotPowDbStr;
- pilotPowDbStr.sprintf("%+02.1f", pilotPowDb);
+ QString pilotPowDbStr = QString("%1%2").arg(pilotPowDb < 0 ? '-' : '+').arg(pilotPowDb, 3, 'f', 1, QLatin1Char('0'));
ui->pilotPower->setText(pilotPowDbStr);
if (m_bfmDemod->getAudioSampleRate() < 0)
diff --git a/plugins/channelrx/demoddatv/datvdemodgui.cpp b/plugins/channelrx/demoddatv/datvdemodgui.cpp
index 7e0ca3c11..e8170bbd1 100644
--- a/plugins/channelrx/demoddatv/datvdemodgui.cpp
+++ b/plugins/channelrx/demoddatv/datvdemodgui.cpp
@@ -670,19 +670,20 @@ void DATVDemodGUI::on_udpTS_clicked(bool checked)
void DATVDemodGUI::on_StreamMetaDataChanged(DataTSMetaData2 *objMetaData)
{
- QString strMetaData="";
if (objMetaData != nullptr)
{
+ QString strMetaData = "";
+
if (objMetaData->OK_TransportStream == true)
{
- strMetaData.sprintf("PID: %d - Width: %d - Height: %d\r\n%s%s\r\nCodec: %s\r\n",
- objMetaData->PID,
- objMetaData->Width,
- objMetaData->Height,
- objMetaData->Program.toStdString().c_str(),
- objMetaData->Stream.toStdString().c_str(),
- objMetaData->CodecDescription.toStdString().c_str());
+ strMetaData = tr("PID: %1 - Width: %2 - Height: %3\r\n%4%5\r\nCodec: %6\r\n")
+ .arg(objMetaData->PID)
+ .arg(objMetaData->Width)
+ .arg(objMetaData->Height)
+ .arg(objMetaData->Program)
+ .arg(objMetaData->Stream)
+ .arg(objMetaData->CodecDescription);
}
ui->streamInfo->setText(strMetaData);
diff --git a/plugins/channeltx/remotesource/remotesourcegui.cpp b/plugins/channeltx/remotesource/remotesourcegui.cpp
index df8e8af74..b2d23c49e 100644
--- a/plugins/channeltx/remotesource/remotesourcegui.cpp
+++ b/plugins/channeltx/remotesource/remotesourcegui.cpp
@@ -15,7 +15,7 @@
// along with this program. If not, see . //
///////////////////////////////////////////////////////////////////////////////////
-#include "remotesourcegui.h"
+#include
#include "device/deviceapi.h"
#include "device/deviceuiset.h"
@@ -26,6 +26,8 @@
#include "remotesource.h"
#include "ui_remotesourcegui.h"
+#include "remotesourcegui.h"
+
RemoteSourceGUI* RemoteSourceGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
{
RemoteSourceGUI* gui = new RemoteSourceGUI(pluginAPI, deviceUISet, channelTx);
diff --git a/plugins/channeltx/remotesource/remotesourcegui.h b/plugins/channeltx/remotesource/remotesourcegui.h
index 1a4faf9b1..bcd66a805 100644
--- a/plugins/channeltx/remotesource/remotesourcegui.h
+++ b/plugins/channeltx/remotesource/remotesourcegui.h
@@ -18,7 +18,7 @@
#ifndef PLUGINS_CHANNELTX_REMOTESRC_REMOTESRCGUI_H_
#define PLUGINS_CHANNELTX_REMOTESRC_REMOTESRCGUI_H_
-#include
+#include
#include "dsp/channelmarker.h"
#include "channel/channelgui.h"
@@ -69,7 +69,7 @@ private:
uint32_t m_lastSampleCount;
uint64_t m_lastTimestampUs;
bool m_resetCounts;
- QTime m_time;
+ QElapsedTimer m_time;
uint32_t m_tickCount;
explicit RemoteSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0);
diff --git a/plugins/samplesource/sdrplay/sdrplaygui.cpp b/plugins/samplesource/sdrplay/sdrplaygui.cpp
index 1cab3c0c1..a214a0b54 100644
--- a/plugins/samplesource/sdrplay/sdrplaygui.cpp
+++ b/plugins/samplesource/sdrplay/sdrplaygui.cpp
@@ -144,16 +144,14 @@ bool SDRPlayGui::handleMessage(const Message& message)
ui->gainMixer->setChecked(msg.getMixerGain() != 0);
ui->gainBaseband->setValue(msg.getBasebandGain());
- QString gainText;
- gainText.sprintf("%02d", msg.getBasebandGain());
+ QString gainText = QStringLiteral("%1").arg(msg.getBasebandGain(), 2, 10, QLatin1Char('0'));
ui->gainBasebandText->setText(gainText);
}
else
{
ui->gainTuner->setValue(msg.getTunerGain());
- QString gainText;
- gainText.sprintf("%03d", msg.getTunerGain());
+ QString gainText = QStringLiteral("%1").arg(msg.getTunerGain(), 3, 10, QLatin1Char('0'));
ui->gainTunerText->setText(gainText);
}
@@ -241,8 +239,7 @@ void SDRPlayGui::displaySettings()
int gain = m_settings.m_tunerGain;
ui->gainTuner->setValue(gain);
- QString gainText;
- gainText.sprintf("%03d", gain);
+ QString gainText = QStringLiteral("%1").arg(gain, 3, 10, QLatin1Char('0'));
ui->gainTunerText->setText(gainText);
m_settings.m_tunerGain = gain;
}
@@ -258,8 +255,7 @@ void SDRPlayGui::displaySettings()
int gain = m_settings.m_basebandGain;
ui->gainBaseband->setValue(gain);
- QString gainText;
- gainText.sprintf("%02d", gain);
+ QString gainText = QStringLiteral("%1").arg(gain, 2, 10, QLatin1Char('0'));
ui->gainBasebandText->setText(gainText);
}
}
@@ -393,9 +389,7 @@ void SDRPlayGui::on_gainTunerOn_toggled(bool checked)
void SDRPlayGui::on_gainTuner_valueChanged(int value)
{
int gain = value;
- QString gainText;
- gainText.sprintf("%03d", gain);
- ui->gainTunerText->setText(gainText);
+ QString gainText = QStringLiteral("%1").arg(gain, 3, 10, QLatin1Char('0'));
m_settings.m_tunerGain = gain;
sendSettings();
@@ -429,8 +423,7 @@ void SDRPlayGui::on_gainBaseband_valueChanged(int value)
{
m_settings.m_basebandGain = value;
- QString gainText;
- gainText.sprintf("%02d", value);
+ QString gainText = QStringLiteral("%1").arg(value, 2, 10, QLatin1Char('0'));
ui->gainBasebandText->setText(gainText);
sendSettings();
diff --git a/sdrbase/util/syncmessenger.cpp b/sdrbase/util/syncmessenger.cpp
index 9233bbb3c..97e18ef2f 100644
--- a/sdrbase/util/syncmessenger.cpp
+++ b/sdrbase/util/syncmessenger.cpp
@@ -34,11 +34,11 @@ int SyncMessenger::sendWait(Message& message, unsigned long msPollTime)
{
m_message = &message;
m_mutex.lock();
- m_complete.store(0);
+ m_complete.storeRelaxed(0);
emit messageSent();
- while (!m_complete.load())
+ while (!m_complete.loadRelaxed())
{
m_waitCondition.wait(&m_mutex, msPollTime);
}
@@ -52,7 +52,7 @@ int SyncMessenger::sendWait(Message& message, unsigned long msPollTime)
void SyncMessenger::done(int result)
{
m_result = result;
- m_complete.store(1);
+ m_complete.storeRelaxed(1);
m_waitCondition.wakeAll();
}
diff --git a/sdrgui/dsp/scopevis.cpp b/sdrgui/dsp/scopevis.cpp
index a2ffa1856..9d5faa3e3 100644
--- a/sdrgui/dsp/scopevis.cpp
+++ b/sdrgui/dsp/scopevis.cpp
@@ -619,13 +619,13 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa
// display only at trace end if trace time is less than 1 second
if (traceTime < 1.0f)
{
- if (m_glScope->getProcessingTraceIndex().load() < 0) {
+ if (m_glScope->getProcessingTraceIndex().loadRelaxed() < 0) {
m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes);
}
}
// switch to next buffer only if it is not being processed by the scope
- if (m_glScope->getProcessingTraceIndex().load() != (((int) m_traces.currentBufferIndex() + 1) % 2)) {
+ if (m_glScope->getProcessingTraceIndex().loadRelaxed() != (((int) m_traces.currentBufferIndex() + 1) % 2)) {
m_traces.switchBuffer();
}
diff --git a/sdrgui/gui/glscope.cpp b/sdrgui/gui/glscope.cpp
index 3050b1d16..9d0c0d630 100644
--- a/sdrgui/gui/glscope.cpp
+++ b/sdrgui/gui/glscope.cpp
@@ -135,7 +135,7 @@ void GLScope::newTraces(std::vector *traces, int traceIndex, std::vecto
if (m_dataChanged.testAndSetOrdered(0, 1))
{
- m_processingTraceIndex.store(traceIndex);
+ m_processingTraceIndex.storeRelaxed(traceIndex);
m_traces = &traces[traceIndex];
m_projectionTypes = projectionTypes;
}
@@ -834,8 +834,8 @@ void GLScope::paintGL()
drawMarkers();
- m_dataChanged.store(0);
- m_processingTraceIndex.store(-1);
+ m_dataChanged.storeRelaxed(0);
+ m_processingTraceIndex.storeRelaxed(-1);
m_mutex.unlock();
}
@@ -1113,7 +1113,7 @@ void GLScope::applyConfig()
void GLScope::setUniqueDisplays()
{
QFontMetrics fm(font());
- int M = fm.width("-");
+ int M = fm.horizontalAdvance("-");
int scopeHeight = height() - m_topMargin - m_botMargin;
int scopeWidth = width() - m_leftMargin - m_rightMargin;
@@ -1297,7 +1297,7 @@ void GLScope::setUniqueDisplays()
void GLScope::setVerticalDisplays()
{
QFontMetrics fm(font());
- int M = fm.width("-");
+ int M = fm.horizontalAdvance("-");
int scopeHeight = (height() - m_topMargin) / 2 - m_botMargin;
int scopeWidth = width() - m_leftMargin - m_rightMargin;
@@ -1480,7 +1480,7 @@ void GLScope::setVerticalDisplays()
void GLScope::setHorizontalDisplays()
{
QFontMetrics fm(font());
- int M = fm.width("-");
+ int M = fm.horizontalAdvance("-");
int scopeHeight = height() - m_topMargin - m_botMargin;
int scopeWidth = (width() - m_rightMargin) / 2 - m_leftMargin;
@@ -1662,7 +1662,7 @@ void GLScope::setHorizontalDisplays()
void GLScope::setPolarDisplays()
{
QFontMetrics fm(font());
- int M = fm.width("-");
+ int M = fm.horizontalAdvance("-");
int scopeHeight = height() - m_topMargin - m_botMargin;
int scopeWidth = (width() - m_rightMargin) / 2 - m_leftMargin;
int scopeDim = std::min(scopeWidth, scopeHeight);
@@ -2012,7 +2012,7 @@ void GLScope::drawTextOverlay(
void GLScope::tick()
{
- if (m_dataChanged.load()) {
+ if (m_dataChanged.loadRelaxed()) {
update();
}
}
diff --git a/sdrgui/gui/glscopegui.cpp b/sdrgui/gui/glscopegui.cpp
index 3e5d491da..df52e760a 100644
--- a/sdrgui/gui/glscopegui.cpp
+++ b/sdrgui/gui/glscopegui.cpp
@@ -872,8 +872,7 @@ void GLScopeGUI::on_memoryLoad_clicked(bool checked)
void GLScopeGUI::on_mem_valueChanged(int value)
{
- QString text;
- text.sprintf("%02d", value);
+ QString text = QStringLiteral("%1").arg(value, 2, 10, QLatin1Char('0'));
ui->memText->setText(text);
disableLiveMode(value > 0); // live / memory mode toggle
m_scopeVis->setMemoryIndex(value);
@@ -1013,8 +1012,7 @@ void GLScopeGUI::setTraceIndexDisplay()
void GLScopeGUI::setTrigCountDisplay()
{
- QString text;
- text.sprintf("%02d", ui->trigCount->value());
+ QString text = QStringLiteral("%1").arg(ui->trigCount->value(), 2, 10, QLatin1Char('0'));
ui->trigCountText->setText(text);
}
diff --git a/sdrgui/gui/glspectrum.cpp b/sdrgui/gui/glspectrum.cpp
index d539265d0..bb36aabe5 100644
--- a/sdrgui/gui/glspectrum.cpp
+++ b/sdrgui/gui/glspectrum.cpp
@@ -1251,7 +1251,7 @@ void GLSpectrum::applyChanges()
}
QFontMetrics fm(font());
- int M = fm.width("-");
+ int M = fm.horizontalAdvance("-");
m_topMargin = fm.ascent() * 1.5;
m_bottomMargin = fm.ascent() * 1.5;
@@ -1261,7 +1261,7 @@ void GLSpectrum::applyChanges()
int frequencyScaleTop = 0;
int histogramTop = 0;
//int m_leftMargin;
- m_rightMargin = fm.width("000");
+ m_rightMargin = fm.horizontalAdvance("000");
// displays both histogram and waterfall
if (m_displayWaterfall && (m_displayHistogram | m_displayMaxHold | m_displayCurrent))
@@ -1800,7 +1800,7 @@ void GLSpectrum::applyChanges()
shift = 0;
} else { // right half of scale
ftext = ftext + " ";
- shift = - fm.width(ftext);
+ shift = - fm.horizontalAdvance(ftext);
}
painter.drawText(QPointF(m_leftMargin + m_frequencyScale.getPosFromValue(xc) + shift, 2*fm.height() + fm.ascent() / 2 - 1), ftext);
}
diff --git a/sdrgui/gui/valuedial.cpp b/sdrgui/gui/valuedial.cpp
index e5037df0e..3af067f13 100644
--- a/sdrgui/gui/valuedial.cpp
+++ b/sdrgui/gui/valuedial.cpp
@@ -77,7 +77,7 @@ void ValueDial::setFont(const QFont &font)
QWidget::setFont(font);
QFontMetrics fm(font);
- m_digitWidth = fm.width('0');
+ m_digitWidth = fm.horizontalAdvance('0');
m_digitHeight = fm.ascent();
if (m_digitWidth < m_digitHeight) {
m_digitWidth = m_digitHeight;
diff --git a/sdrgui/gui/valuedialz.cpp b/sdrgui/gui/valuedialz.cpp
index 5d9ed8be8..2cc419bf1 100644
--- a/sdrgui/gui/valuedialz.cpp
+++ b/sdrgui/gui/valuedialz.cpp
@@ -79,7 +79,7 @@ void ValueDialZ::setFont(const QFont& font)
QWidget::setFont(font);
QFontMetrics fm(font);
- m_digitWidth = fm.width('0');
+ m_digitWidth = fm.horizontalAdvance('0');
m_digitHeight = fm.ascent();
if(m_digitWidth < m_digitHeight)
m_digitWidth = m_digitHeight;