diff --git a/app/main.cpp b/app/main.cpp index deb75b6d5..32e1a2f70 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -37,7 +37,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo QCoreApplication::setApplicationName(APPLICATION_NAME); QCoreApplication::setApplicationVersion(SDRANGEL_VERSION); -#if QT_VERSION >= 0x050600 +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps #endif @@ -102,7 +102,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo MainParser parser; parser.parse(*qApp); -#if QT_VERSION >= 0x050400 +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld", qPrintable(qApp->applicationName()), qPrintable(qApp->applicationVersion()), diff --git a/appbench/main.cpp b/appbench/main.cpp index 743ccc49e..0c91a875c 100644 --- a/appbench/main.cpp +++ b/appbench/main.cpp @@ -71,7 +71,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo ParserBench parser; parser.parse(a); -#if QT_VERSION >= 0x050400 +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld", qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationVersion()), diff --git a/appsrv/main.cpp b/appsrv/main.cpp index d74735362..78f4c3a7b 100644 --- a/appsrv/main.cpp +++ b/appsrv/main.cpp @@ -70,7 +70,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo MainParser parser; parser.parse(a); -#if QT_VERSION >= 0x050400 +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld", qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationVersion()), diff --git a/httpserver/httpconnectionhandler.h b/httpserver/httpconnectionhandler.h index 00cdd943d..5ced8ca76 100644 --- a/httpserver/httpconnectionhandler.h +++ b/httpserver/httpconnectionhandler.h @@ -23,7 +23,7 @@ namespace qtwebapp { /** Alias type definition, for compatibility to different Qt versions */ -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) typedef qintptr tSocketDescriptor; #else typedef int tSocketDescriptor; diff --git a/logging/logger.cpp b/logging/logger.cpp index fca4a307f..a608fad54 100644 --- a/logging/logger.cpp +++ b/logging/logger.cpp @@ -73,7 +73,7 @@ void Logger::msgHandler(const QtMsgType type, const QString &message, const QStr } -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) void Logger::msgHandler5(const QtMsgType type, const QMessageLogContext &context, const QString &message) { (void)(context); // suppress "unused parameter" warning @@ -91,7 +91,7 @@ Logger::~Logger() { if (defaultLogger==this) { -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) qInstallMessageHandler(0); #else qInstallMsgHandler(0); @@ -111,7 +111,7 @@ void Logger::write(const LogMessage* logMessage) void Logger::installMsgHandler() { defaultLogger=this; -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) qInstallMessageHandler(msgHandler5); #else qInstallMsgHandler(msgHandler4); diff --git a/sdrbase/commands/command.cpp b/sdrbase/commands/command.cpp index 9f558267c..a6b83dff8 100644 --- a/sdrbase/commands/command.cpp +++ b/sdrbase/commands/command.cpp @@ -67,7 +67,7 @@ Command::~Command() { if (m_currentProcess) { -#if QT_VERSION < 0x051000 +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) disconnect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); #else disconnect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); @@ -193,7 +193,7 @@ void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex) m_isInError = false; m_hasExited = false; -#if QT_VERSION < 0x051000 +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) connect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); #else connect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); @@ -266,7 +266,7 @@ void Command::processError(QProcess::ProcessError error) { m_log = m_currentProcess->readAllStandardOutput(); -#if QT_VERSION < 0x051000 +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) disconnect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); #else disconnect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); @@ -288,7 +288,7 @@ void Command::processFinished(int exitCode, QProcess::ExitStatus exitStatus) m_hasExited = true; m_log = m_currentProcess->readAllStandardOutput(); -#if QT_VERSION < 0x051000 +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) disconnect(m_currentProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); #else disconnect(m_currentProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); diff --git a/sdrbase/maincore.cpp b/sdrbase/maincore.cpp index be6186d79..fed2c4f9a 100644 --- a/sdrbase/maincore.cpp +++ b/sdrbase/maincore.cpp @@ -85,7 +85,7 @@ void MainCore::setLoggingOptions() if (m_settings.getUseLogFile()) { -#if QT_VERSION >= 0x050400 +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) QString appInfoStr(QString("%1 %2 Qt %3 %4b %5 %6 DSP Rx:%7b Tx:%8b PID %9") .arg(QCoreApplication::applicationName()) .arg(QCoreApplication::applicationVersion()) diff --git a/sdrbase/util/syncmessenger.cpp b/sdrbase/util/syncmessenger.cpp index 97e18ef2f..53459a672 100644 --- a/sdrbase/util/syncmessenger.cpp +++ b/sdrbase/util/syncmessenger.cpp @@ -16,6 +16,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include + #include "util/syncmessenger.h" #include "util/message.h" @@ -34,14 +36,23 @@ int SyncMessenger::sendWait(Message& message, unsigned long msPollTime) { m_message = &message; m_mutex.lock(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) m_complete.storeRelaxed(0); +#else + m_complete.store(0); +#endif emit messageSent(); - while (!m_complete.loadRelaxed()) - { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + while (!m_complete.loadRelaxed()) { m_waitCondition.wait(&m_mutex, msPollTime); } +#else + while (!m_complete.load()) { + m_waitCondition.wait(&m_mutex, msPollTime); + } +#endif int result = m_result; m_mutex.unlock(); @@ -52,7 +63,11 @@ int SyncMessenger::sendWait(Message& message, unsigned long msPollTime) void SyncMessenger::done(int result) { m_result = result; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) m_complete.storeRelaxed(1); +#else + m_complete.store(1); +#endif m_waitCondition.wakeAll(); } diff --git a/sdrbase/webapi/webapiadapter.cpp b/sdrbase/webapi/webapiadapter.cpp index 4a7cbc9bb..04f1be848 100644 --- a/sdrbase/webapi/webapiadapter.cpp +++ b/sdrbase/webapi/webapiadapter.cpp @@ -102,7 +102,7 @@ int WebAPIAdapter::instanceSummary( response.setDspRxBits(SDR_RX_SAMP_SZ); response.setDspTxBits(SDR_TX_SAMP_SZ); response.setPid(qApp->applicationPid()); -#if QT_VERSION >= 0x050400 +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) *response.getArchitecture() = QString(QSysInfo::currentCpuArchitecture()); *response.getOs() = QString(QSysInfo::prettyProductName()); #endif diff --git a/sdrgui/dsp/scopevis.cpp b/sdrgui/dsp/scopevis.cpp index 9d5faa3e3..a39e2f66c 100644 --- a/sdrgui/dsp/scopevis.cpp +++ b/sdrgui/dsp/scopevis.cpp @@ -16,6 +16,7 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include #include #include @@ -619,15 +620,27 @@ 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 QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) if (m_glScope->getProcessingTraceIndex().loadRelaxed() < 0) { m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes); } +#else + if (m_glScope->getProcessingTraceIndex().load() < 0) { + m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes); + } +#endif } // switch to next buffer only if it is not being processed by the scope +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) if (m_glScope->getProcessingTraceIndex().loadRelaxed() != (((int) m_traces.currentBufferIndex() + 1) % 2)) { m_traces.switchBuffer(); } +#else + if (m_glScope->getProcessingTraceIndex().load() != (((int) m_traces.currentBufferIndex() + 1) % 2)) { + m_traces.switchBuffer(); + } +#endif return end - begin; // return remainder count } diff --git a/sdrgui/gui/glscope.cpp b/sdrgui/gui/glscope.cpp index 9d0c0d630..9d1aa27e9 100644 --- a/sdrgui/gui/glscope.cpp +++ b/sdrgui/gui/glscope.cpp @@ -16,6 +16,7 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include #include #include #include @@ -135,7 +136,11 @@ void GLScope::newTraces(std::vector *traces, int traceIndex, std::vecto if (m_dataChanged.testAndSetOrdered(0, 1)) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) m_processingTraceIndex.storeRelaxed(traceIndex); +#else + m_processingTraceIndex.store(traceIndex); +#endif m_traces = &traces[traceIndex]; m_projectionTypes = projectionTypes; } @@ -834,8 +839,13 @@ void GLScope::paintGL() drawMarkers(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) m_dataChanged.storeRelaxed(0); m_processingTraceIndex.storeRelaxed(-1); +#else + m_dataChanged.store(0); + m_processingTraceIndex.store(-1); +#endif m_mutex.unlock(); } @@ -2012,9 +2022,15 @@ void GLScope::drawTextOverlay( void GLScope::tick() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) if (m_dataChanged.loadRelaxed()) { update(); } +#else + if (m_dataChanged.load()) { + update(); + } +#endif } void GLScope::connectTimer(const QTimer &timer) diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 6828c8906..ed0462fc2 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -743,7 +743,7 @@ void MainWindow::saveCommandSettings() void MainWindow::createStatusBar() { QString qtVersionStr = QString("Qt %1 ").arg(QT_VERSION_STR); -#if QT_VERSION >= 0x050400 +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr + QSysInfo::currentCpuArchitecture() + " " + QSysInfo::prettyProductName(), this); #else