mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-21 19:58:39 -04:00
Fixed Qt version checks
This commit is contained in:
parent
19ecf12c22
commit
a9d09e30a8
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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()),
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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)));
|
||||
|
@ -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())
|
||||
|
@ -16,6 +16,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -16,6 +16,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
#include <QMutexLocker>
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
#include <QFontDatabase>
|
||||
#include <QMouseEvent>
|
||||
@ -135,7 +136,11 @@ void GLScope::newTraces(std::vector<float *> *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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user