1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Migrate code to Qt 5.14.2

This commit is contained in:
f4exb 2020-11-04 08:59:16 +01:00
parent 76926ab550
commit 379096cbdd
12 changed files with 41 additions and 48 deletions

View File

@ -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)

View File

@ -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);

View File

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "remotesourcegui.h"
#include <QTime>
#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);

View File

@ -18,7 +18,7 @@
#ifndef PLUGINS_CHANNELTX_REMOTESRC_REMOTESRCGUI_H_
#define PLUGINS_CHANNELTX_REMOTESRC_REMOTESRCGUI_H_
#include <QTime>
#include <QElapsedTimer>
#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);

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -135,7 +135,7 @@ void GLScope::newTraces(std::vector<float *> *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();
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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;