From f9a51294302d5b606c1b39babb08baa48674a638 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Mon, 6 May 2024 17:24:14 +0200 Subject: [PATCH 1/5] Port application to Qt6 --- Engine/API/Abstract/abstractrhxcontroller.cpp | 2 +- .../API/Synthetic/synthdatablockgenerator.cpp | 2 +- .../DataFileReaders/fileperchannelmanager.cpp | 1 + Engine/Processing/datastreamfifo.cpp | 6 +- Engine/Processing/xmlinterface.cpp | 20 +++---- Engine/Threads/audiothread.cpp | 58 +++++++++---------- Engine/Threads/audiothread.h | 15 +++-- Engine/Threads/usbdatathread.cpp | 4 +- GUI/Dialogs/boardselectdialog.cpp | 3 - GUI/Dialogs/renamechanneldialog.cpp | 7 ++- GUI/Widgets/filterdisplayselector.cpp | 8 +-- GUI/Widgets/pageview.cpp | 6 +- GUI/Widgets/pageview.h | 2 +- GUI/Widgets/testcontrolpanel.cpp | 14 +++-- GUI/Widgets/waveformdisplaycolumn.cpp | 2 +- GUI/Windows/controlwindow.cpp | 16 ++--- GUI/Windows/probemapwindow.cpp | 2 +- IntanRHX.pro | 2 +- contrib/ci/Dockerfile-debian | 2 +- contrib/ci/Dockerfile-ubuntu | 2 +- contrib/ci/install-deps-deb.sh | 7 +-- contrib/debian/changelog | 4 +- contrib/debian/control | 11 ++-- contrib/debian/rules | 2 +- 24 files changed, 99 insertions(+), 99 deletions(-) diff --git a/Engine/API/Abstract/abstractrhxcontroller.cpp b/Engine/API/Abstract/abstractrhxcontroller.cpp index 1af6440..93cf351 100644 --- a/Engine/API/Abstract/abstractrhxcontroller.cpp +++ b/Engine/API/Abstract/abstractrhxcontroller.cpp @@ -62,7 +62,7 @@ AbstractRHXController::AbstractRHXController(ControllerType type_, AmplifierSamp pipeReadErrorCode(0) { usbBufferSize = MaxNumBlocksToRead * BytesPerWord * RHXDataBlock::dataBlockSizeInWords(type, maxNumDataStreams()); - cout << "RHXController: Allocating " << usbBufferSize / 1.0e6 << " MBytes for USB buffer.\n"; + std::cout << "RHXController: Allocating " << usbBufferSize / 1.0e6 << " MBytes for USB buffer." << std::endl; usbBuffer = nullptr; usbBuffer = new uint8_t [usbBufferSize]; numDataStreams = 0; diff --git a/Engine/API/Synthetic/synthdatablockgenerator.cpp b/Engine/API/Synthetic/synthdatablockgenerator.cpp index 5de6fff..f86f95d 100644 --- a/Engine/API/Synthetic/synthdatablockgenerator.cpp +++ b/Engine/API/Synthetic/synthdatablockgenerator.cpp @@ -228,7 +228,7 @@ SynthDataBlockGenerator::SynthDataBlockGenerator(ControllerType type_, double sa { int bufferSizeInWords = MaxNumBlocksToRead * RHXDataBlock::dataBlockSizeInWords(type, AbstractRHXController::maxNumDataStreams(type)); - cout << "SynthDataBlockGenerator: Allocating " << BytesPerWord * bufferSizeInWords / 1.0e6 << " MBytes for synthetic USB data generator.\n"; + std::cout << "SynthDataBlockGenerator: Allocating " << BytesPerWord * bufferSizeInWords / 1.0e6 << " MBytes for synthetic USB data generator." << std::endl; usbWords = nullptr; usbWords = new uint16_t [bufferSizeInWords]; dataBlockPeriodInNsec = 1.0e9 * ((double)RHXDataBlock::samplesPerDataBlock(type)) / sampleRate; diff --git a/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp b/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp index 77dd5ed..f4e0460 100644 --- a/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp +++ b/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp @@ -30,6 +30,7 @@ #include #include +#include #include "rhxglobals.h" #include "datafilereader.h" #include "fileperchannelmanager.h" diff --git a/Engine/Processing/datastreamfifo.cpp b/Engine/Processing/datastreamfifo.cpp index 8fb235c..d97e424 100644 --- a/Engine/Processing/datastreamfifo.cpp +++ b/Engine/Processing/datastreamfifo.cpp @@ -45,7 +45,7 @@ DataStreamFifo::DataStreamFifo(int bufferSize_, int maxReadLength_) : { int bufferSizeWithExtra = bufferSize + maxReadLength; memoryNeededGB = sizeof(uint16_t) * bufferSizeWithExtra / (1024.0 * 1024.0 * 1024.0); - cout << "DataStreamFifo: Allocating " << 2 * bufferSizeWithExtra / 1.0e6 << " MBytes for FIFO buffer." << '\n'; + std::cout << "DataStreamFifo: Allocating " << 2 * bufferSizeWithExtra / 1.0e6 << " MBytes for FIFO buffer." << std::endl; buffer = nullptr; memoryAllocated = true; @@ -53,11 +53,11 @@ DataStreamFifo::DataStreamFifo(int bufferSize_, int maxReadLength_) : buffer = new uint16_t [bufferSizeWithExtra]; } catch (std::bad_alloc&) { memoryAllocated = false; - cerr << "Error: DataStreamFifo constructor could not allocate " << memoryNeededGB << " GB of memory." << '\n'; + std::cerr << "Error: DataStreamFifo constructor could not allocate " << memoryNeededGB << " GB of memory." << std::endl; } if (!buffer) { - cerr << "Error: DataStreamFifo constructor could not allocate " << 2 * bufferSizeWithExtra << " bytes of memory." << '\n'; + std::cerr << "Error: DataStreamFifo constructor could not allocate " << 2 * bufferSizeWithExtra << " bytes of memory." << std::endl; } resetBuffer(); } diff --git a/Engine/Processing/xmlinterface.cpp b/Engine/Processing/xmlinterface.cpp index 84149ab..dc22512 100644 --- a/Engine/Processing/xmlinterface.cpp +++ b/Engine/Processing/xmlinterface.cpp @@ -445,7 +445,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString while (!stream.atEnd()) { // Make sure we enter at least the first SignalGroup element. If we've gone past all the SignalGroups and are at the end of the document, just return - while (stream.name() != "SignalGroup") { + while (stream.name() != QStringLiteral("SignalGroup")) { QXmlStreamReader::TokenType token = stream.readNext(); // Handle if no signal groups at all are present by giving a warning and returning @@ -504,7 +504,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString while (!stream.atEnd()) { // Make sure we enter at least the first Channel element. If we've gone past all the Channels and are at the end of the document, just return. - while (stream.name() != "Channel") { + while (stream.name() != QStringLiteral("Channel")) { QXmlStreamReader::TokenType token = stream.readNext(); if (token == QXmlStreamReader::EndDocument) { @@ -594,7 +594,7 @@ bool XMLInterface::parseGeneralConfig(const QByteArray &byteArray, QString &erro if (!validDocumentStart) return false; // Parse GeneralConfig - while (stream.name() != "GeneralConfig") { + while (stream.name() != QStringLiteral("GeneralConfig")) { stream.readNextStartElement(); if (stream.atEnd()) return true; } @@ -697,7 +697,7 @@ bool XMLInterface::parseSignalGroups(const QByteArray &byteArray, QString &error while (!stream.atEnd()) { // Make sure we enter at least the first SignalGroup element. If we've gone past all the SignalGroups and are at the end of the document, just return. - while (stream.name() != "SignalGroup") { + while (stream.name() != QStringLiteral("SignalGroup")) { QXmlStreamReader::TokenType token = stream.readNext(); if (token == QXmlStreamReader::EndDocument) { return true; @@ -797,7 +797,7 @@ bool XMLInterface::parseSignalGroups(const QByteArray &byteArray, QString &error while (!stream.atEnd()) { // Make sure we enter at least the first Channel element. If we've gone past all the Channels and are at the end of the document, just return. - while (stream.name() != "Channel") { + while (stream.name() != QStringLiteral("Channel")) { QXmlStreamReader::TokenType token = stream.readNext(); if (token == QXmlStreamReader::EndDocument) { return true; @@ -889,7 +889,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err if (!validDocumentStart) return false; // Parse StimParameters. - while (stream.name() != "StimParameters") { + while (stream.name() != QStringLiteral("StimParameters")) { stream.readNextStartElement(); if (stream.atEnd()) return true; } @@ -898,7 +898,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err while (!stream.atEnd()) { // Make sure we enter at least the first StimChannel element. If we've gone past all the StimChannels and are at the end of the document, just return. - while (stream.name() != "StimChannel") { + while (stream.name() != QStringLiteral("StimChannel")) { QXmlStreamReader::TokenType token = stream.readNext(); if (token == QXmlStreamReader::EndDocument) { return true; @@ -911,7 +911,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err // Try to find the StimChannel's name. QString nativeChannelName(""); for (auto attribute : attributes) { - if (attribute.name().toString().toLower() == "nativechannelname") { + if (attribute.name().toString().toLower() == QStringLiteral("nativechannelname")) { nativeChannelName = attribute.value().toString(); break; } @@ -962,7 +962,7 @@ bool XMLInterface::parseStimParameters(const QByteArray &byteArray, QString &err bool XMLInterface::parseStimLegacy(const QByteArray &byteArray, QString &errorMessage) const { QXmlStreamReader stream(byteArray); - if (!stream.readNextStartElement() || stream.name() != "xstim" || stream.attributes().value("", "version").toString() != "1.0") { + if (!stream.readNextStartElement() || stream.name() != QStringLiteral("xstim") || stream.attributes().value("", "version").toString() != "1.0") { errorMessage.append("Error: invalid xstim element and version attribute"); return false; } @@ -971,7 +971,7 @@ bool XMLInterface::parseStimLegacy(const QByteArray &byteArray, QString &errorMe state->holdUpdate(); - while (stream.readNextStartElement() && stream.name() == "channel") { + while (stream.readNextStartElement() && stream.name() == QStringLiteral("channel")) { QString channelName = stream.attributes().value("", "name").toString(); channel = state->signalSources->channelByName(channelName); diff --git a/Engine/Threads/audiothread.cpp b/Engine/Threads/audiothread.cpp index 9de492f..fdb8099 100644 --- a/Engine/Threads/audiothread.cpp +++ b/Engine/Threads/audiothread.cpp @@ -28,10 +28,11 @@ // //------------------------------------------------------------------------------ -#include #include "signalsources.h" #include "audiothread.h" +#include + AudioThread::AudioThread(SystemState *state_, WaveformFifo *waveformFifo_, const double sampleRate_, QObject *parent) : QThread(parent), state(state_), @@ -52,7 +53,6 @@ AudioThread::AudioThread(SystemState *state_, WaveformFifo *waveformFifo_, const void AudioThread::initialize() { // Initialize variables. - mDevice = QAudioDeviceInfo::defaultOutputDevice(); currentValue = 0.0F; nextValue = 0.0F; interpRatio = 0.0; @@ -87,21 +87,19 @@ void AudioThread::initialize() // Set up audio format. mFormat.setSampleRate(44100); mFormat.setChannelCount(1); - mFormat.setSampleSize(16); - mFormat.setCodec("audio/pcm"); - mFormat.setByteOrder(QAudioFormat::LittleEndian); - mFormat.setSampleType(QAudioFormat::SignedInt); - QAudioDeviceInfo info(mDevice); - if (!info.isFormatSupported(mFormat)) { - qWarning() << "Default format not supported - trying to use nearest"; - mFormat = info.nearestFormat(mFormat); + mFormat.setSampleFormat(QAudioFormat::Int16); + + QAudioDevice defaultDevice(QMediaDevices::defaultAudioOutput()); + if (!defaultDevice.isFormatSupported(mFormat)) { + qWarning() << "Default format not supported - trying to use preferred"; + mFormat = defaultDevice.preferredFormat(); + mFormat.setChannelCount(1); } // Create audio IO and output device. - buf = new QByteArray(); - s = new QDataStream(buf, QIODevice::ReadWrite); - mAudioOutput = new QAudioOutput(mDevice, mFormat); - connect(mAudioOutput, SIGNAL(stateChanged(QAudio::State)), this, SLOT(catchError())); + mAudioSink = std::make_unique(defaultDevice, mFormat); + mAudioSink->setBufferSize(NumSoundBytes); + connect(mAudioSink.get(), SIGNAL(stateChanged(QAudio::State)), this, SLOT(catchError())); } void AudioThread::run() @@ -113,8 +111,16 @@ void AudioThread::run() // Any 'start up' code goes here. initialize(); + QDataStream *s = nullptr; while (keepGoing && !stopThread) { + // Start audio (if it's not started already) + if (mAudioSink->state() != QAudio::ActiveState || s == nullptr) { + if (s) + delete s; + s = new QDataStream(mAudioSink->start()); + } + // Wait for samples to arrive from WaveformFifo (enough where, when scaled to 44.1 kHz audio, NumSoundSamples can be written) if (waveformFifo->requestReadNewData(WaveformFifo::ReaderAudio, rawBlockSampleSize)) { s->device()->seek(0); @@ -130,12 +136,6 @@ void AudioThread::run() // Populate finalSoundBytesBuffer from rawData processAudioData(); - // Start audio (if it's not started already) - if (mAudioOutput->state() != QAudio::ActiveState) { - mAudioOutput->start(s->device()); - } - qApp->processEvents(); - } else { // Probably could sleep here for a while qApp->processEvents(); @@ -143,14 +143,15 @@ void AudioThread::run() } // Any 'finish up' code goes here. - mAudioOutput->stop(); + mAudioSink->stop(); + + if (s) + delete s; delete [] rawData; delete [] interpFloats; delete [] interpInts; delete [] finalSoundBytesBuffer; - delete s; - delete buf; running = false; } else { @@ -223,7 +224,6 @@ void AudioThread::processAudioData() originalSamplesCopied = 0; soundSamplesCopied = 0; while (originalSamplesCopied < rawBlockSampleSize) { - qApp->processEvents(); currentValue = nextValue; nextValue = rawData[originalSamplesCopied]; @@ -282,21 +282,21 @@ void AudioThread::processAudioData() void AudioThread::catchError() { - QAudio::Error errorValue = mAudioOutput->error(); + QAudio::Error errorValue = mAudioSink->error(); switch (errorValue) { case QAudio::NoError: break; case QAudio::OpenError: - qDebug() << "Open Error"; + qDebug().noquote() << "rhx-audio: Open Error"; break; case QAudio::IOError: - qDebug() << "IO Error"; + qDebug().noquote() << "rhx-audio: IO Error"; break; case QAudio::UnderrunError: - qDebug() << "Underrun Error"; + qDebug().noquote() << "rhx-audio: Underrun Error"; break; case QAudio::FatalError: - qDebug() << "Fatal Error"; + qDebug().noquote() << "rhx-audio: Fatal Error"; break; } } diff --git a/Engine/Threads/audiothread.h b/Engine/Threads/audiothread.h index 89cc1b2..948833a 100644 --- a/Engine/Threads/audiothread.h +++ b/Engine/Threads/audiothread.h @@ -32,7 +32,8 @@ #define AUDIOTHREAD_H #include -#include +#include +#include #include #include #include "systemstate.h" @@ -94,20 +95,18 @@ private slots: int originalSamplesCopied; int soundSamplesCopied; - volatile bool keepGoing; - volatile bool running; - volatile bool stopThread; + std::atomic_bool keepGoing; + std::atomic_bool running; + std::atomic_bool stopThread; float currentValue; float nextValue; double interpRatio; int interpLength; - QAudioDeviceInfo mDevice; - QByteArray* buf; - QDataStream* s; - QAudioOutput* mAudioOutput; QAudioFormat mFormat; + std::unique_ptr mAudioSink; + QDataStream* s; QString currentChannelString; diff --git a/Engine/Threads/usbdatathread.cpp b/Engine/Threads/usbdatathread.cpp index c058696..c162e83 100644 --- a/Engine/Threads/usbdatathread.cpp +++ b/Engine/Threads/usbdatathread.cpp @@ -46,7 +46,7 @@ USBDataThread::USBDataThread(AbstractRHXController* controller_, DataStreamFifo* bufferSize = (BufferSizeInBlocks + 1) * BytesPerWord * RHXDataBlock::dataBlockSizeInWords(controller->getType(), controller->maxNumDataStreams()); memoryNeededGB = sizeof(uint8_t) * bufferSize / (1024.0 * 1024.0 * 1024.0); - cout << "USBDataThread: Allocating " << bufferSize / 1.0e6 << " MBytes for USB buffer." << '\n'; + std::cout << "USBDataThread: Allocating " << bufferSize / 1.0e6 << " MBytes for USB buffer." << std::endl; usbBuffer = nullptr; memoryAllocated = true; @@ -54,7 +54,7 @@ USBDataThread::USBDataThread(AbstractRHXController* controller_, DataStreamFifo* usbBuffer = new uint8_t [bufferSize]; } catch (std::bad_alloc&) { memoryAllocated = false; - cerr << "Error: USBDataThread constructor could not allocate " << memoryNeededGB << " GB of memory." << '\n'; + std::cerr << "Error: USBDataThread constructor could not allocate " << memoryNeededGB << " GB of memory." << std::endl; } // cout << "Ideal thread count: " << QThread::idealThreadCount() << EndOfLine; diff --git a/GUI/Dialogs/boardselectdialog.cpp b/GUI/Dialogs/boardselectdialog.cpp index 788da1f..665cb40 100644 --- a/GUI/Dialogs/boardselectdialog.cpp +++ b/GUI/Dialogs/boardselectdialog.cpp @@ -387,9 +387,6 @@ BoardSelectDialog::BoardSelectDialog(QWidget *parent) : QCoreApplication::setOrganizationDomain(OrganizationDomain); QCoreApplication::setApplicationName(ApplicationName); - // Globally disable unused Context Help buttons from windows/dialogs - QApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton); - // Initialize Board Identifier. boardIdentifier = new BoardIdentifier(this); diff --git a/GUI/Dialogs/renamechanneldialog.cpp b/GUI/Dialogs/renamechanneldialog.cpp index 0ce48ac..04254a8 100644 --- a/GUI/Dialogs/renamechanneldialog.cpp +++ b/GUI/Dialogs/renamechanneldialog.cpp @@ -30,6 +30,8 @@ #include "renamechanneldialog.h" +#include + RenameChannelDialog::RenameChannelDialog(const QString& nativeName, const QString& oldName, QWidget* parent) : QDialog(parent) { @@ -40,8 +42,9 @@ RenameChannelDialog::RenameChannelDialog(const QString& nativeName, const QStrin oldNameLayout->addWidget(new QLabel(tr("Old channel name: ") + oldName + addNativeName, this)); nameLineEdit = new QLineEdit; - QRegExp regExp("[\\w-\\+\\./]{1,16}"); // Name must be 1-16 characters, alphanumeric or _-+./ - nameLineEdit->setValidator(new QRegExpValidator(regExp, this)); + QRegularExpression regExp("[\\w-\\+\\./]{1,16}"); // Name must be 1-16 characters, alphanumeric or _-+./ + auto reValidator = new QRegularExpressionValidator(regExp, this); + nameLineEdit->setValidator(reValidator); connect(nameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onLineEditTextChanged())); diff --git a/GUI/Widgets/filterdisplayselector.cpp b/GUI/Widgets/filterdisplayselector.cpp index 6132f9a..a9cb75c 100644 --- a/GUI/Widgets/filterdisplayselector.cpp +++ b/GUI/Widgets/filterdisplayselector.cpp @@ -136,10 +136,10 @@ FilterDisplaySelector::FilterDisplaySelector(SystemState* state_, QWidget* paren connect(order3CheckBox, SIGNAL(clicked(bool)), this, SLOT(filterOrderChanged())); connect(order4CheckBox, SIGNAL(clicked(bool)), this, SLOT(filterOrderChanged())); - connect(order1ButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(filterOrderChanged())); - connect(order2ButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(filterOrderChanged())); - connect(order3ButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(filterOrderChanged())); - connect(order4ButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(filterOrderChanged())); + connect(order1ButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(filterOrderChanged())); + connect(order2ButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(filterOrderChanged())); + connect(order3ButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(filterOrderChanged())); + connect(order4ButtonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(filterOrderChanged())); order1CheckBox->setChecked(true); order2CheckBox->setChecked(false); diff --git a/GUI/Widgets/pageview.cpp b/GUI/Widgets/pageview.cpp index 2df48f4..4fd2c11 100644 --- a/GUI/Widgets/pageview.cpp +++ b/GUI/Widgets/pageview.cpp @@ -401,7 +401,7 @@ void PageView::mousePressEvent(QMouseEvent *event) QWidget::mousePressEvent(event); // If mouse wheel is clicked (regardless of mouse mode), start scrolling. - if (event->button() == Qt::MidButton) { + if (event->button() == Qt::MiddleButton) { scrolling = true; scrollStartX = xPixelsToUnitValue(event->pos().x()); scrollStartY = yPixelsToUnitValue(event->pos().y()); @@ -451,7 +451,7 @@ void PageView::mouseReleaseEvent(QMouseEvent *event) QWidget::mouseReleaseEvent(event); // If mouse wheel was unclicked (regardless of mouse mode), end scrolling. - if (event->button() == Qt::MidButton) { + if (event->button() == Qt::MiddleButton) { scrolling = false; if (mouseMode == Scroll) { this->setCursor(Qt::OpenHandCursor); @@ -587,7 +587,7 @@ void PageView::resizeEvent(QResizeEvent* /* event */) update(); } -void PageView::enterEvent(QEvent* /* event */) +void PageView::enterEvent(QEnterEvent* /* event */) { mousePresent = true; diff --git a/GUI/Widgets/pageview.h b/GUI/Widgets/pageview.h index ce83a99..a57cd80 100644 --- a/GUI/Widgets/pageview.h +++ b/GUI/Widgets/pageview.h @@ -93,7 +93,7 @@ public slots: void mouseMoveEvent(QMouseEvent *event) override; void wheelEvent(QWheelEvent *event) override; void resizeEvent(QResizeEvent *event) override; - void enterEvent(QEvent *event) override; + void enterEvent(QEnterEvent *event) override; void leaveEvent(QEvent *event) override; private: diff --git a/GUI/Widgets/testcontrolpanel.cpp b/GUI/Widgets/testcontrolpanel.cpp index d37160f..63caeeb 100644 --- a/GUI/Widgets/testcontrolpanel.cpp +++ b/GUI/Widgets/testcontrolpanel.cpp @@ -2,6 +2,8 @@ #include "testcontrolpanel.h" #include "controlwindow.h" +#include + HelpDialogCheckInputWave::HelpDialogCheckInputWave(QWidget *parent) : QDialog(parent) { @@ -1704,7 +1706,7 @@ double TestControlPanel::median(const QVector &arr) } //Arrange 'arrCopy' lowest to highest - qSort(arrCopy); + std::sort(arrCopy.begin(), arrCopy.end()); //if odd # of elements... if ((arrCopy.size() % 2) == 1) @@ -2642,9 +2644,9 @@ void TestControlPanel::saveReport() } QTextStream out(&csvFile); if (state->getControllerTypeEnum() == ControllerStimRecord) { - out << "Channel Number,Triangle Error,Stim Error,Avg Positive Voltage, Avg Negative Voltage" << endl; + out << "Channel Number,Triangle Error,Stim Error,Avg Positive Voltage, Avg Negative Voltage" << Qt::endl; } else { - out << "Channel Number,Triangle Error,Settle Error" << endl; + out << "Channel Number,Triangle Error,Settle Error" << Qt::endl; } for (int channel = 0; channel < report.size(); channel++) { @@ -2653,11 +2655,11 @@ void TestControlPanel::saveReport() if (state->getControllerTypeEnum() == ControllerStimRecord) { out << report.at(channel)->variableError << ","; out << report.at(channel)->posAvg << ","; - out << report.at(channel)->negAvg << endl; + out << report.at(channel)->negAvg << Qt::endl; } else { - out << report.at(channel)->variableError << endl; + out << report.at(channel)->variableError << Qt::endl; } - //out << report.at(channel)->variableError << endl; + //out << report.at(channel)->variableError << Qt::endl; } csvFile.close(); } diff --git a/GUI/Widgets/waveformdisplaycolumn.cpp b/GUI/Widgets/waveformdisplaycolumn.cpp index e06947c..ccf8864 100644 --- a/GUI/Widgets/waveformdisplaycolumn.cpp +++ b/GUI/Widgets/waveformdisplaycolumn.cpp @@ -52,7 +52,7 @@ WaveformDisplayColumn::WaveformDisplayColumn(int columnIndex_, WaveformDisplayMa portComboBox->addItems(state->signalSources->populatedGroupListWithChannelCounts()); waveformPlot = new MultiWaveformPlot(columnIndex, waveformManager, controllerInterface, state, this); - connect(portComboBox, SIGNAL(currentIndexChanged(QString)), waveformPlot, SLOT(updateFromState())); + connect(portComboBox, SIGNAL(currentIndexChanged(int)), waveformPlot, SLOT(updateFromState())); if (state->testMode->getValue()) { portComboBox->setFocusProxy(waveformPlot); } diff --git a/GUI/Windows/controlwindow.cpp b/GUI/Windows/controlwindow.cpp index cb895f2..7d77c18 100644 --- a/GUI/Windows/controlwindow.cpp +++ b/GUI/Windows/controlwindow.cpp @@ -640,9 +640,9 @@ void ControlWindow::createActions() QPixmap jumpToEndPixmap(":/images/tostarticon.png"); - QMatrix rm; - rm.rotate(180); - jumpToEndPixmap = jumpToEndPixmap.transformed(rm); + QTransform transform; + transform.rotate(180); + jumpToEndPixmap = jumpToEndPixmap.transformed(transform); QIcon jumpToEndIcon(jumpToEndPixmap); jumpToEndAction = new QAction(jumpToEndIcon, tr("Jump to End"), this); connect(jumpToEndAction, SIGNAL(triggered()), this, SLOT(jumpToEndSlot())); @@ -1541,22 +1541,22 @@ void ControlWindow::keyPressEvent(QKeyEvent *event) if (!state->running) { ((TestControlPanel*) controlPanel)->viewReport(); } - break; } + break; case Qt::Key_U: if (state->testMode->getValue()) { if (!state->running && state->getControllerTypeEnum() == ControllerStimRecord) { ((TestControlPanel*) controlPanel)->uploadStimManual(); } - break; } + break; case Qt::Key_C: if (state->testMode->getValue()) { if (!state->running) { ((TestControlPanel*) controlPanel)->checkInputWave(); } - break; } + break; case Qt::Key_Space: if (state->testMode->getValue()) { if (!state->running) { @@ -1564,15 +1564,15 @@ void ControlWindow::keyPressEvent(QKeyEvent *event) } else { stopControllerSlot(); } - break; } + break; case Qt::Key_R: if (state->testMode->getValue()) { if (!state->running) { ((TestControlPanel*) controlPanel)->rescanPorts(); } - break; } + break; default: QWidget::keyPressEvent(event); diff --git a/GUI/Windows/probemapwindow.cpp b/GUI/Windows/probemapwindow.cpp index 8608784..d14b6e7 100644 --- a/GUI/Windows/probemapwindow.cpp +++ b/GUI/Windows/probemapwindow.cpp @@ -305,7 +305,7 @@ void ProbeMapWindow::updateForStop() void ProbeMapWindow::catchSpikeReport(QString names) { // Separate QString out using ',' - QStringList nameList = names.split(',', QString::SkipEmptyParts); + QStringList nameList = names.split(',', Qt::SkipEmptyParts); // Insert or assign each name within nameList for (QStringList::const_iterator it = nameList.constBegin(); it != nameList.constEnd(); ++it) { diff --git a/IntanRHX.pro b/IntanRHX.pro index 458ae34..b323dd3 100644 --- a/IntanRHX.pro +++ b/IntanRHX.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui xml multimedia network widgets +QT += core gui xml multimedia network widgets TARGET = IntanRHX TEMPLATE = app diff --git a/contrib/ci/Dockerfile-debian b/contrib/ci/Dockerfile-debian index 4690a2f..ddca5e0 100644 --- a/contrib/ci/Dockerfile-debian +++ b/contrib/ci/Dockerfile-debian @@ -1,7 +1,7 @@ # # Docker file for Intan RHX CI # -FROM debian:bullseye +FROM debian:trixie # prepare RUN mkdir -p /build/ci/ diff --git a/contrib/ci/Dockerfile-ubuntu b/contrib/ci/Dockerfile-ubuntu index 12f4cbe..fb53dc5 100644 --- a/contrib/ci/Dockerfile-ubuntu +++ b/contrib/ci/Dockerfile-ubuntu @@ -1,7 +1,7 @@ # # Docker file for Intan RHX CI # -FROM ubuntu:focal +FROM ubuntu:noble # prepare RUN mkdir -p /build/ci/ diff --git a/contrib/ci/install-deps-deb.sh b/contrib/ci/install-deps-deb.sh index bff3eed..2d5fee8 100755 --- a/contrib/ci/install-deps-deb.sh +++ b/contrib/ci/install-deps-deb.sh @@ -34,8 +34,7 @@ eatmydata apt-get install -yq --no-install-recommends \ # Intan RHX build dependencies eatmydata apt-get install -yq --no-install-recommends \ - libqt5xmlpatterns5-dev \ ocl-icd-opencl-dev \ - qt5-qmake \ - qtbase5-dev \ - qtmultimedia5-dev + qmake6 \ + qt6-base-dev \ + qt6-multimedia-dev diff --git a/contrib/debian/changelog b/contrib/debian/changelog index 35c0219..4641558 100644 --- a/contrib/debian/changelog +++ b/contrib/debian/changelog @@ -1,5 +1,5 @@ -intan-rhx (3.0.2) UNRELEASED; urgency=medium +intan-rhx (3.2.0) UNRELEASED; urgency=medium * Permanent dummy release - -- Matthias Klumpp Mon, 05 Apr 2021 12:38:32 +0200 + -- Matthias Klumpp Mon, 08 Apr 2024 12:38:32 +0200 diff --git a/contrib/debian/control b/contrib/debian/control index c6dfec4..81451ce 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -2,13 +2,12 @@ Source: intan-rhx Section: non-free/science Priority: optional Maintainer: Intan Technologies -Build-Depends: debhelper-compat (= 12), - libqt5xmlpatterns5-dev, +Build-Depends: debhelper-compat (= 13), ocl-icd-opencl-dev, - qt5-qmake, - qtbase5-dev, - qtmultimedia5-dev -Standards-Version: 4.5.0 + qmake6, + qt6-base-dev, + qt6-multimedia-dev +Standards-Version: 4.6.2 Package: intan-rhx Architecture: any diff --git a/contrib/debian/rules b/contrib/debian/rules index e984e9b..1b159fb 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -2,4 +2,4 @@ # -*- mode: makefile; coding: utf-8 -*- %: - dh $@ + dh $@ --buildsystem=qmake6 From d077aecdca11b03a93b9d1716c0239c376ad337f Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Mon, 6 May 2024 18:01:58 +0200 Subject: [PATCH 2/5] Resolve a compiler warnings and make compiler more strict --- Engine/API/Hardware/rhxcontroller.cpp | 4 +- .../DataFileReaders/fileperchannelmanager.cpp | 2 +- .../DataFileReaders/fileperchannelmanager.h | 2 +- .../traditionalintanfilemanager.cpp | 2 +- .../Processing/XPUInterfaces/gpuinterface.cpp | 6 ++- .../XPUInterfaces/xpucontroller.cpp | 10 +++-- Engine/Processing/commandparser.cpp | 8 +++- Engine/Processing/controllerinterface.cpp | 2 +- .../Processing/softwarereferenceprocessor.cpp | 2 +- Engine/Processing/stateitem.h | 2 +- Engine/Processing/waveformfifo.cpp | 6 +-- Engine/Processing/waveformfifo.h | 3 +- Engine/Processing/xmlinterface.cpp | 4 +- Engine/Threads/tcpdataoutputthread.cpp | 4 +- GUI/Dialogs/advancedstartupdialog.cpp | 6 +-- GUI/Dialogs/advancedstartupdialog.h | 2 +- GUI/Dialogs/anoutdialog.h | 2 +- GUI/Dialogs/boardselectdialog.cpp | 6 +-- GUI/Dialogs/digoutdialog.h | 2 +- GUI/Dialogs/stimparamdialog.h | 2 +- GUI/Widgets/abstractpanel.cpp | 4 +- GUI/Widgets/anoutfigure.h | 6 +-- GUI/Widgets/controlpanel.cpp | 5 +-- GUI/Widgets/controlpanelconfiguretab.cpp | 2 +- GUI/Widgets/digfigure.h | 6 +-- GUI/Widgets/smartspinbox.h | 20 +++++----- GUI/Widgets/testcontrolpanel.cpp | 10 ++--- GUI/Widgets/waveformdisplaymanager.cpp | 6 +-- GUI/Windows/controlwindow.cpp | 6 +-- GUI/Windows/probemapwindow.cpp | 4 +- IntanRHX.pro | 40 ++++++++++++++----- 31 files changed, 108 insertions(+), 78 deletions(-) diff --git a/Engine/API/Hardware/rhxcontroller.cpp b/Engine/API/Hardware/rhxcontroller.cpp index 33ef436..ce5d178 100644 --- a/Engine/API/Hardware/rhxcontroller.cpp +++ b/Engine/API/Hardware/rhxcontroller.cpp @@ -160,8 +160,8 @@ bool RHXController::uploadFPGABitfile(const string& filename) boardId = dev->GetWireOutValue(WireOutBoardId); boardVersion = dev->GetWireOutValue(WireOutBoardVersion); - cout << "Rhythm configuration file successfully loaded. Rhythm version number: " << - boardVersion << "\n\n"; + std::cout << "Rhythm configuration file successfully loaded. Rhythm version number: " << + boardVersion << "\n" << std::endl; return true; } diff --git a/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp b/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp index f4e0460..d1fbc69 100644 --- a/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp +++ b/Engine/Processing/DataFileReaders/fileperchannelmanager.cpp @@ -512,7 +512,7 @@ void FilePerChannelManager::updateEndOfData() // TODO - polish up to get the actual end of all data, not just assume from end of shortest amp file int tempTotalNumSamples = 0; for (int stream = 0; stream < info->numDataStreams; ++stream) { - for (int channel = 0; channel < amplifierFiles[stream].size(); ++channel) { + for (uint channel = 0; channel < amplifierFiles[stream].size(); ++channel) { if (amplifierWasSaved[stream][channel]) { int64_t numAmpSamples = amplifierFiles[stream][channel]->fileSize() / 2; if (numAmpSamples < tempTotalNumSamples || tempTotalNumSamples == 0) { diff --git a/Engine/Processing/DataFileReaders/fileperchannelmanager.h b/Engine/Processing/DataFileReaders/fileperchannelmanager.h index fedccb3..40d7f0f 100644 --- a/Engine/Processing/DataFileReaders/fileperchannelmanager.h +++ b/Engine/Processing/DataFileReaders/fileperchannelmanager.h @@ -49,7 +49,7 @@ class FilePerChannelManager : public DataFileManager DataFileReader* parent); ~FilePerChannelManager(); - long readDataBlocksRaw(int numBlocks, uint8_t* buffer); + long readDataBlocksRaw(int numBlocks, uint8_t* buffer) override; int64_t getLastTimeStamp() override; int64_t jumpToTimeStamp(int64_t target) override; void loadDataFrame() override; diff --git a/Engine/Processing/DataFileReaders/traditionalintanfilemanager.cpp b/Engine/Processing/DataFileReaders/traditionalintanfilemanager.cpp index ff1e835..1e62116 100644 --- a/Engine/Processing/DataFileReaders/traditionalintanfilemanager.cpp +++ b/Engine/Processing/DataFileReaders/traditionalintanfilemanager.cpp @@ -379,7 +379,7 @@ int64_t TraditionalIntanFileManager::blocksPresent() { // Should remain accurate even if data file continues growing int dataSizeBytes = 0; - for (int i = 0; i < consecutiveFiles.size(); i++) { + for (uint i = 0; i < consecutiveFiles.size(); i++) { dataSizeBytes += QFileInfo(consecutiveFiles[i].fileName).size() - info->headerSizeInBytes; } return dataSizeBytes / info->bytesPerDataBlock; diff --git a/Engine/Processing/XPUInterfaces/gpuinterface.cpp b/Engine/Processing/XPUInterfaces/gpuinterface.cpp index f3b1e0e..9d94544 100644 --- a/Engine/Processing/XPUInterfaces/gpuinterface.cpp +++ b/Engine/Processing/XPUInterfaces/gpuinterface.cpp @@ -539,8 +539,12 @@ bool GPUInterface::createKernel(int devIndex) state->writeToLog("Completed clCreateContext()"); state->writeToLog("About to call clCreateCommandQueue"); + cl_queue_properties properties[] = { + CL_QUEUE_PROPERTIES, + 0 // Terminates the list + }; // Create command queue. - commandQueue = clCreateCommandQueue(context, id, 0, &ret); + commandQueue = clCreateCommandQueueWithProperties(context, id, properties, &ret); if (ret != CL_SUCCESS) { state->writeToLog("Failure creating OpenCL commandqueue. Ret: " + QString::number(ret)); gpuErrorMessage("Error creating OpenCL commandqueue. Returned error code: " + QString::number(ret)); diff --git a/Engine/Processing/XPUInterfaces/xpucontroller.cpp b/Engine/Processing/XPUInterfaces/xpucontroller.cpp index 1ad3ef1..9a496ff 100644 --- a/Engine/Processing/XPUInterfaces/xpucontroller.cpp +++ b/Engine/Processing/XPUInterfaces/xpucontroller.cpp @@ -32,9 +32,9 @@ XPUController::XPUController(SystemState *state_, bool useOpenCL_, QObject *parent) : QObject(parent), + useOpenCL(useOpenCL_), state(state_), - usedXPUIndex(-1), - useOpenCL(useOpenCL_) + usedXPUIndex(-1) { state->writeToLog("Entered XPUController ctor"); connect(state, SIGNAL(stateChanged()), this, SLOT(updateFromState())); @@ -126,7 +126,11 @@ void XPUController::updateFromState() if (state->usedXPUIndex() != usedXPUIndex) { activeInterface->cleanupMemory(); usedXPUIndex = state->usedXPUIndex(); - activeInterface = (usedXPUIndex == 0) ? activeInterface = cpuInterface : activeInterface = gpuInterface; + if (usedXPUIndex == 0) { + activeInterface = cpuInterface; + } else { + activeInterface = gpuInterface; + } activeInterface->setupMemory(); } activeInterface->updateFromState(); diff --git a/Engine/Processing/commandparser.cpp b/Engine/Processing/commandparser.cpp index 394e273..47cc176 100644 --- a/Engine/Processing/commandparser.cpp +++ b/Engine/Processing/commandparser.cpp @@ -33,8 +33,8 @@ CommandParser::CommandParser(SystemState* state_, ControllerInterface *controllerInterface_, QObject *parent) : QObject(parent), - controllerInterface(controllerInterface_), controlWindow(nullptr), + controllerInterface(controllerInterface_), state(state_) { // These connections allow for interactions with communicators that may live in another thread @@ -871,6 +871,8 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const if (stimParams->pulseTrainPeriod->getValue() < stimDuration) return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)"; + break; + case BoardDacSignal: // PulseTrainPeriod cannot be less than stimDuration (which depends on Shape) // Biphasic: stimDuration = FirstPhaseDuration + SecondPhaseDuration @@ -888,11 +890,15 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const if (stimParams->pulseTrainPeriod->getValue() < stimDuration) return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)"; + break; + case BoardDigitalOutSignal: // PulseTrainPeriod cannot be less than FirstPhaseDuration if (stimParams->pulseTrainPeriod->getValue() < stimParams->firstPhaseDuration->getValue()) return "PulseTrainPeriodMicroseconds cannot be less than pulse duration (FirstPhaseDurationMicroseconds)"; + break; + default: break; } diff --git a/Engine/Processing/controllerinterface.cpp b/Engine/Processing/controllerinterface.cpp index 75abad9..fc830c2 100644 --- a/Engine/Processing/controllerinterface.cpp +++ b/Engine/Processing/controllerinterface.cpp @@ -298,7 +298,7 @@ int ControllerInterface::scanPorts(vector &chipType, vector &port state->previousDelaySelectedPort->getValue(), state->lastDetectedChip->getValue()); - for (int i = 0; i < chipType.size(); i++) { + for (uint i = 0; i < chipType.size(); i++) { if (chipType[i] != NoChip) { state->lastDetectedChip->setValue((int) chipType[i]); break; diff --git a/Engine/Processing/softwarereferenceprocessor.cpp b/Engine/Processing/softwarereferenceprocessor.cpp index 10a5ee0..0188946 100644 --- a/Engine/Processing/softwarereferenceprocessor.cpp +++ b/Engine/Processing/softwarereferenceprocessor.cpp @@ -342,7 +342,7 @@ void SoftwareReferenceProcessor::readReferenceSamples(vector { const uint16_t* pRead; - for (int i = 0; i < addresses.size(); ++i) { + for (uint i = 0; i < addresses.size(); ++i) { pRead = start; pRead += 6; // Skip header and timestamp. pRead += misoWordSize * (numDataStreams * 3); // Skip auxiliary channels. diff --git a/Engine/Processing/stateitem.h b/Engine/Processing/stateitem.h index 7a83a6f..63a0a5b 100644 --- a/Engine/Processing/stateitem.h +++ b/Engine/Processing/stateitem.h @@ -142,7 +142,7 @@ class StateFilenameItem : public StateItem bool isValid() const { return !path.isEmpty() && !baseFilename.isEmpty(); } QString getFullFilename() const { return isValid() ? path + "/" + baseFilename : ""; } - QString getValidValues() const { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; } + QString getValidValues() const override { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; } private: QString path; diff --git a/Engine/Processing/waveformfifo.cpp b/Engine/Processing/waveformfifo.cpp index 432e121..2946ea5 100644 --- a/Engine/Processing/waveformfifo.cpp +++ b/Engine/Processing/waveformfifo.cpp @@ -35,12 +35,12 @@ #include "waveformfifo.h" WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBlocks_, int memorySizeInDataBlocks_, int maxWriteSizeInDataBlocks_, SystemState* state_) : + state(state_), signalSources(signalSources_), bufferSizeInDataBlocks(bufferSizeInDataBlocks_), memorySizeInDataBlocks(memorySizeInDataBlocks_), maxWriteSizeInDataBlocks(maxWriteSizeInDataBlocks_), - numReaders(NumberOfReaders), - state(state_) + numReaders(NumberOfReaders) { if (numReaders < 1) { cerr << "WaveformFifo constructor: numReaders must be one or greater." << '\n'; @@ -64,7 +64,7 @@ WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBl bufferAllocateSize = bufferSize + maxWriteSizeInSamples; bufferAllocateSizeInBlocks = bufferSizeInDataBlocks + maxWriteSizeInDataBlocks; - usedWordsNewData = new Semaphore [numReaders]; + usedWordsNewData = new Semaphore[numReaders]; bufferReadIndex.resize(numReaders); bufferMemoryIndex.resize(numReaders); numWordsToBeRead.resize(numReaders); diff --git a/Engine/Processing/waveformfifo.h b/Engine/Processing/waveformfifo.h index 814e8fc..d2c836b 100644 --- a/Engine/Processing/waveformfifo.h +++ b/Engine/Processing/waveformfifo.h @@ -36,7 +36,6 @@ #include #include #include -#include "rhxglobals.h" #include "semaphore.h" #include "minmax.h" #include "signalsources.h" @@ -76,7 +75,7 @@ const uint8_t SpikeIdLikelyArtifact = 0x80u; class WaveformFifo { public: - enum Reader { + enum Reader : uint { ReaderDisplay = 0, ReaderDisk, ReaderAudio, diff --git a/Engine/Processing/xmlinterface.cpp b/Engine/Processing/xmlinterface.cpp index dc22512..4613257 100644 --- a/Engine/Processing/xmlinterface.cpp +++ b/Engine/Processing/xmlinterface.cpp @@ -517,7 +517,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString errorMessage.append("\n"); } errorMessage.append("Warning: The following channels are currently detected by the Intan controller but are not included in the settings file:"); - for (int i = 0; i < uninitializedChannels.size(); ++i) { + for (uint i = 0; i < uninitializedChannels.size(); ++i) { errorMessage.append("\n" + QString::fromStdString(uninitializedChannels[i])); } } @@ -576,7 +576,7 @@ bool XMLInterface::checkConsistentChannels(const QByteArray &byteArray, QString vector XMLInterface::findUninitializedChannels(vector allChannels, vector channelsInitializedFromXML) const { vector uninitializedChannels; - for (int i = 0; i < allChannels.size(); ++i) { + for (uint i = 0; i < allChannels.size(); ++i) { if (!channelsInitializedFromXML[i]) { uninitializedChannels.push_back(allChannels[i]); } diff --git a/Engine/Threads/tcpdataoutputthread.cpp b/Engine/Threads/tcpdataoutputthread.cpp index b2b688b..89062e2 100644 --- a/Engine/Threads/tcpdataoutputthread.cpp +++ b/Engine/Threads/tcpdataoutputthread.cpp @@ -34,6 +34,7 @@ TCPDataOutputThread::TCPDataOutputThread(WaveformFifo *waveformFifo_, const doub QThread(parent), tcpWaveformDataCommunicator(state_->tcpWaveformDataCommunicator), tcpSpikeDataCommunicator(state_->tcpSpikeDataCommunicator), + previousSample(nullptr), waveformFifo(waveformFifo_), signalSources(state_->signalSources), sampleRate(sampleRate_), @@ -42,8 +43,7 @@ TCPDataOutputThread::TCPDataOutputThread(WaveformFifo *waveformFifo_, const doub stopThread(false), parentObject(parent), connected(false), - state(state_), - previousSample(nullptr) + state(state_) { } diff --git a/GUI/Dialogs/advancedstartupdialog.cpp b/GUI/Dialogs/advancedstartupdialog.cpp index f43a30a..571ae7a 100644 --- a/GUI/Dialogs/advancedstartupdialog.cpp +++ b/GUI/Dialogs/advancedstartupdialog.cpp @@ -16,11 +16,11 @@ AdvancedStartupDialog::AdvancedStartupDialog(bool &useOpenCL_, uint8_t &playback playbackFCheckBox(nullptr), playbackGCheckBox(nullptr), playbackHCheckBox(nullptr), - playbackPorts(&playbackPorts_), - demoMode(demoMode_), buttonBox(nullptr), useOpenCL(&useOpenCL_), - tempUseOpenCL(useOpenCL_) + tempUseOpenCL(useOpenCL_), + playbackPorts(&playbackPorts_), + demoMode(demoMode_) { useOpenCLDescription = new QLabel(tr( "OpenCL is a platform-independent framework that allows the CPU to\n" diff --git a/GUI/Dialogs/advancedstartupdialog.h b/GUI/Dialogs/advancedstartupdialog.h index 1fbfd69..f6e0be3 100644 --- a/GUI/Dialogs/advancedstartupdialog.h +++ b/GUI/Dialogs/advancedstartupdialog.h @@ -17,7 +17,7 @@ class AdvancedStartupDialog : public QDialog static uint8_t portsBoolToInt(QVector portsBool); public slots: - void accept(); + void accept() override; private slots: void changeUseOpenCL(bool use); diff --git a/GUI/Dialogs/anoutdialog.h b/GUI/Dialogs/anoutdialog.h index 8153722..1a38212 100644 --- a/GUI/Dialogs/anoutdialog.h +++ b/GUI/Dialogs/anoutdialog.h @@ -55,7 +55,7 @@ class AnOutDialog : public QDialog void loadParameters(StimParameters* parameters); public slots: - void accept(); + void accept() override; void notifyFocusChanged(QWidget *lostFocus, QWidget *gainedFocus); private: diff --git a/GUI/Dialogs/boardselectdialog.cpp b/GUI/Dialogs/boardselectdialog.cpp index 665cb40..4b4bd19 100644 --- a/GUI/Dialogs/boardselectdialog.cpp +++ b/GUI/Dialogs/boardselectdialog.cpp @@ -369,8 +369,6 @@ BoardSelectDialog::BoardSelectDialog(QWidget *parent) : openButton(nullptr), playbackButton(nullptr), advancedButton(nullptr), - useOpenCL(true), - playbackPorts(255), defaultSampleRateCheckBox(nullptr), defaultSettingsFileCheckBox(nullptr), splash(nullptr), @@ -380,7 +378,9 @@ BoardSelectDialog::BoardSelectDialog(QWidget *parent) : state(nullptr), controllerInterface(nullptr), parser(nullptr), - controlWindow(nullptr) + controlWindow(nullptr), + useOpenCL(true), + playbackPorts(255) { // Information used by QSettings to save basic settings across sessions. QCoreApplication::setOrganizationName(OrganizationName); diff --git a/GUI/Dialogs/digoutdialog.h b/GUI/Dialogs/digoutdialog.h index 2e8e8ac..1e04b57 100644 --- a/GUI/Dialogs/digoutdialog.h +++ b/GUI/Dialogs/digoutdialog.h @@ -54,7 +54,7 @@ class DigOutDialog : public QDialog void loadParameters(StimParameters* parameters); public slots: - void accept(); + void accept() override; void notifyFocusChanged(QWidget *lostFocus, QWidget *gainedFocus); private: diff --git a/GUI/Dialogs/stimparamdialog.h b/GUI/Dialogs/stimparamdialog.h index eb2090c..167b0f3 100644 --- a/GUI/Dialogs/stimparamdialog.h +++ b/GUI/Dialogs/stimparamdialog.h @@ -57,7 +57,7 @@ class StimParamDialog : public QDialog void activate(); public slots: - void accept(); + void accept() override; private slots: void notifyFocusChanged(QWidget* lostFocus, QWidget* gainedFocus); diff --git a/GUI/Widgets/abstractpanel.cpp b/GUI/Widgets/abstractpanel.cpp index e9a5c3c..b184912 100644 --- a/GUI/Widgets/abstractpanel.cpp +++ b/GUI/Widgets/abstractpanel.cpp @@ -32,10 +32,10 @@ void ColorWidget::setColor(QColor color) } AbstractPanel::AbstractPanel(ControllerInterface* controllerInterface_, SystemState* state_, CommandParser* parser_, ControlWindow *parent) : - controlWindow(parent), - controllerInterface(controllerInterface_), state(state_), parser(parser_), + controlWindow(parent), + controllerInterface(controllerInterface_), filterDisplaySelector(nullptr), tabWidget(nullptr), configureTab(nullptr), diff --git a/GUI/Widgets/anoutfigure.h b/GUI/Widgets/anoutfigure.h index a52e727..16764ae 100644 --- a/GUI/Widgets/anoutfigure.h +++ b/GUI/Widgets/anoutfigure.h @@ -40,7 +40,7 @@ class AnOutFigure : public AbstractFigure Q_OBJECT public: explicit AnOutFigure(StimParameters* stimParameters, QWidget *parent = nullptr); - void uniqueRedraw(QPainter &painter); + void uniqueRedraw(QPainter &painter) override; public slots: void updateMonophasicAndPositive(bool logicValue); @@ -51,8 +51,8 @@ public slots: void highlightBaselineVoltage(bool highlight); private: - QSize sizeHint() const; - QSize minimumSizeHint() const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; bool localMonophasicAndPositive; QColor oldColor; }; diff --git a/GUI/Widgets/controlpanel.cpp b/GUI/Widgets/controlpanel.cpp index b41386d..6dcccd8 100644 --- a/GUI/Widgets/controlpanel.cpp +++ b/GUI/Widgets/controlpanel.cpp @@ -28,9 +28,6 @@ // //------------------------------------------------------------------------------ -#include "stimparamdialog.h" -#include "anoutdialog.h" -#include "digoutdialog.h" #include "controlpanelbandwidthtab.h" #include "controlpanelimpedancetab.h" #include "controlpanelaudioanalogtab.h" @@ -182,6 +179,8 @@ QString ControlPanel::currentTabName() const } else { qDebug() << "Unrecognized tab widget."; } + + return QString(); } QHBoxLayout* ControlPanel::createSelectionLayout() diff --git a/GUI/Widgets/controlpanelconfiguretab.cpp b/GUI/Widgets/controlpanelconfiguretab.cpp index efe764c..7522cab 100644 --- a/GUI/Widgets/controlpanelconfiguretab.cpp +++ b/GUI/Widgets/controlpanelconfiguretab.cpp @@ -37,13 +37,13 @@ ControlPanelConfigureTab::ControlPanelConfigureTab(ControllerInterface* controllerInterface_, SystemState* state_, CommandParser* parser_, QWidget *parent) : QWidget(parent), + fastSettleCheckBox(nullptr), state(state_), parser(parser_), controllerInterface(controllerInterface_), scanButton(nullptr), setCableDelayButton(nullptr), digOutButton(nullptr), - fastSettleCheckBox(nullptr), externalFastSettleCheckBox(nullptr), externalFastSettleSpinBox(nullptr), note1LineEdit(nullptr), diff --git a/GUI/Widgets/digfigure.h b/GUI/Widgets/digfigure.h index 0f8d4e3..9dd5a24 100644 --- a/GUI/Widgets/digfigure.h +++ b/GUI/Widgets/digfigure.h @@ -40,11 +40,11 @@ class DigFigure : public AbstractFigure Q_OBJECT public: explicit DigFigure(StimParameters* stimParameters, QWidget* parent = nullptr); - void uniqueRedraw(QPainter &painter); + void uniqueRedraw(QPainter &painter) override; private: - QSize sizeHint() const; - QSize minimumSizeHint() const; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; }; diff --git a/GUI/Widgets/smartspinbox.h b/GUI/Widgets/smartspinbox.h index 69788b9..474f46b 100644 --- a/GUI/Widgets/smartspinbox.h +++ b/GUI/Widgets/smartspinbox.h @@ -71,15 +71,15 @@ class CurrentSpinBox : public SmartSpinBox Q_OBJECT public: explicit CurrentSpinBox(double step_, QWidget *parent = nullptr); - void setTrueMinimum(double min); + void setTrueMinimum(double min) override; public slots: - void loadValue(double val); - void roundValue(); + void loadValue(double val) override; + void roundValue() override; private slots: - void scaleUnits(double val); - void sendSignalValueMicro(double val); + void scaleUnits(double val) override; + void sendSignalValueMicro(double val) override; }; @@ -88,15 +88,15 @@ class TimeSpinBox : public SmartSpinBox Q_OBJECT public: explicit TimeSpinBox(double step_, QWidget *parent = nullptr); - void setTrueMinimum(double min); + void setTrueMinimum(double min) override; public slots: - void loadValue(double val); - void roundValue(); + void loadValue(double val) override; + void roundValue() override; private slots: - void scaleUnits(double val); - void sendSignalValueMicro(double val); + void scaleUnits(double val) override; + void sendSignalValueMicro(double val) override; }; #endif // SMARTSPINBOX_H diff --git a/GUI/Widgets/testcontrolpanel.cpp b/GUI/Widgets/testcontrolpanel.cpp index 63caeeb..06c64e1 100644 --- a/GUI/Widgets/testcontrolpanel.cpp +++ b/GUI/Widgets/testcontrolpanel.cpp @@ -91,12 +91,12 @@ TestControlPanel::TestControlPanel(ControllerInterface *controllerInterface_, Ab rhxController(rhxController_), multiColumnDisplay(multiColumnDisplay_), stimParametersInterface(stimParametersInterface_), - reportPresent(false), helpDialogCheckInputWave(nullptr), helpDialogTestChip(nullptr), helpDialogUploadTestStimParameters(nullptr), - previousDelay(-1), - portComboBox(nullptr) + reportPresent(false), + portComboBox(nullptr), + previousDelay(-1) { setFocusPolicy(Qt::StrongFocus); this->setFocus(); @@ -2385,7 +2385,7 @@ void TestControlPanel::validateFastSettleChannels(QVector > &fas int TestControlPanel::amoeba(QVector &t, QVector &ytarget, QVector > &p, QVector &y, int ndim, double ftol) { int i, ihi, ilo, inhi, j, mpts = ndim + 1; - double rtol, sum, swap, ysave, ytry; + double rtol, sum; QVector psum; psum.resize(ndim); @@ -2718,7 +2718,7 @@ double TestControlPanel::vectorAvg(QVector vect, int start, int end) ReportDialog::ReportDialog(QWidget *parent) { - + Q_UNUSED(parent); } void ReportDialog::keyPressEvent(QKeyEvent *event) diff --git a/GUI/Widgets/waveformdisplaymanager.cpp b/GUI/Widgets/waveformdisplaymanager.cpp index 9004580..1e0ae49 100644 --- a/GUI/Widgets/waveformdisplaymanager.cpp +++ b/GUI/Widgets/waveformdisplaymanager.cpp @@ -32,12 +32,12 @@ #include "waveformdisplaymanager.h" WaveformDisplayManager::WaveformDisplayManager(SystemState* state_, int maxWidthInPixels_, int numRefreshZones_) : - state(state_), - needsFullReset(true), needsFullRedraw(true), + needsFullReset(true), + numColumns(0), + state(state_), finishedRedraws(0), finishedResets(0), - numColumns(0), maxWidthInPixels(maxWidthInPixels_), numRefreshZones(numRefreshZones_) { diff --git a/GUI/Windows/controlwindow.cpp b/GUI/Windows/controlwindow.cpp index 7d77c18..16b5575 100644 --- a/GUI/Windows/controlwindow.cpp +++ b/GUI/Windows/controlwindow.cpp @@ -44,6 +44,7 @@ using namespace std; ControlWindow::ControlWindow(SystemState* state_, CommandParser* parser_, ControllerInterface* controllerInterface_, AbstractRHXController* rhxController_) : QMainWindow(nullptr), // Since the parent isn't a QMainWindow but a QDialog, just pass a nullptr + stimParametersInterface(nullptr), state(state_), controllerInterface(controllerInterface_), rhxController(rhxController_), @@ -76,8 +77,8 @@ ControlWindow::ControlWindow(SystemState* state_, CommandParser* parser_, Contro rewindAction(nullptr), fastForwardAction(nullptr), fastPlaybackAction(nullptr), - jumpToStartAction(nullptr), jumpToEndAction(nullptr), + jumpToStartAction(nullptr), jumpBack1SecAction(nullptr), jumpBack10SecAction(nullptr), jumpAction(nullptr), @@ -139,7 +140,6 @@ ControlWindow::ControlWindow(SystemState* state_, CommandParser* parser_, Contro tcpDisplay(nullptr), showHideRow(nullptr), showHideStretch(nullptr), - stimParametersInterface(nullptr), stimClipboard(nullptr), currentlyRunning(false), currentlyRecording(false), @@ -1534,8 +1534,8 @@ void ControlWindow::keyPressEvent(QKeyEvent *event) if (!state->running) { ((TestControlPanel*) controlPanel)->testChip(); } - break; } + break; case Qt::Key_V: if (state->testMode->getValue()) { if (!state->running) { diff --git a/GUI/Windows/probemapwindow.cpp b/GUI/Windows/probemapwindow.cpp index d14b6e7..85388eb 100644 --- a/GUI/Windows/probemapwindow.cpp +++ b/GUI/Windows/probemapwindow.cpp @@ -72,11 +72,11 @@ ProbeMapWindow::ProbeMapWindow(SystemState* state_, ControllerInterface* control bestFitAction->setShortcuts(bestFitShortcuts); zoomInAction = new QAction(QIcon(":/images/zoomin.png"), "Zoom in. Shortcut: 'MouseWheelUp' or 'Shift+UpArrow' or 'Ctrl+UpArrow' or '+'", this); - QList zoomInShortcuts = QList() << Qt::Key_Plus << Qt::Key_Equal << (Qt::SHIFT + Qt::Key_Up) << (Qt::CTRL + Qt::Key_Up); + QList zoomInShortcuts = QList() << Qt::Key_Plus << Qt::Key_Equal << (Qt::SHIFT | Qt::Key_Up) << (Qt::CTRL | Qt::Key_Up); zoomInAction->setShortcuts(zoomInShortcuts); zoomOutAction = new QAction(QIcon(":/images/zoomout.png"), "Zoom out. Shortcut: 'MouseWheelDown' or 'Shift+DownArrow' or 'Ctrl+DownArrow' or '-'", this); - QList zoomOutShortcuts = QList() << Qt::Key_Minus << Qt::Key_Underscore << (Qt::SHIFT + Qt::Key_Down) << (Qt::CTRL + Qt::Key_Down); + QList zoomOutShortcuts = QList() << Qt::Key_Minus << Qt::Key_Underscore << (Qt::SHIFT | Qt::Key_Down) << (Qt::CTRL | Qt::Key_Down); zoomOutAction->setShortcuts(zoomOutShortcuts); scrollUpAction = new QAction(QIcon(":/images/uparrow.png"), "Scroll up. Shortcut: 'Shift+MouseWheelUp' or 'UpArrow' or 'PageUp'", this); diff --git a/IntanRHX.pro b/IntanRHX.pro index b323dd3..93373a5 100644 --- a/IntanRHX.pro +++ b/IntanRHX.pro @@ -4,6 +4,8 @@ # #------------------------------------------------- +CONFIG += c++17 + QT += core gui xml multimedia network widgets TARGET = IntanRHX @@ -267,25 +269,41 @@ DISTFILES += kernel.cl INCLUDEPATH += $$PWD/includes/ +unix { + # Catch common issues on Linux/MacOS + QMAKE_CXXFLAGS += -Werror=empty-body \ + -Werror=pointer-arith \ + -Werror=missing-declarations \ + -Werror=return-type \ + -Werror=misleading-indentation \ + -Werror=format-security \ + -Werror=suggest-override \ + -Werror=implicit-fallthrough \ + -Werror=reorder + + # Ignore some overly pedantic warnings + QMAKE_CXXFLAGS += -Wno-unused-parameter +} + # Windows win32: { -LIBS += -L$$PWD/libraries/Windows/ -lOpenCL # OpenCL library -LIBS += -L$$PWD/libraries/Windows/ -lokFrontPanel # Opal Kelly Front Panel library -LIBS += -L$$PWD/libraries/Windows/ -ldelayimp # Microsoft's Delay Import library -QMAKE_LFLAGS += /DELAYLOAD:okFrontPanel.dll # Use delayimp to only load okFrontPanel.dll when necessary, - # so we can give an error message when okFrontPanel.dll is missing + LIBS += -L$$PWD/libraries/Windows/ -lOpenCL # OpenCL library + LIBS += -L$$PWD/libraries/Windows/ -lokFrontPanel # Opal Kelly Front Panel library + LIBS += -L$$PWD/libraries/Windows/ -ldelayimp # Microsoft's Delay Import library + QMAKE_LFLAGS += /DELAYLOAD:okFrontPanel.dll # Use delayimp to only load okFrontPanel.dll when necessary, + # so we can give an error message when okFrontPanel.dll is missing } # Mac mac: { -LIBS += -framework OpenCL # Mac OS X built-in OpenCL library -LIBS += -L$$PWD/libraries/Mac/ -lokFrontPanel # Opal Kelly Front Panel library + LIBS += -framework OpenCL # Mac OS X built-in OpenCL library + LIBS += -L$$PWD/libraries/Mac/ -lokFrontPanel # Opal Kelly Front Panel library } # Linux unix:!macx: { -LIBS += -L$$PWD/libraries/Linux/ -lOpenCL # OpenCL library -LIBS += -L$$PWD/libraries/Linux/ -lokFrontPanel # Opal Kelly Front Panel library -QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN\'' # Flag that at runtime, look for shared libraries (like - # libokFrontPanel.so) at the same directory as the binary + LIBS += -L$$PWD/libraries/Linux/ -lOpenCL # OpenCL library + LIBS += -L$$PWD/libraries/Linux/ -lokFrontPanel # Opal Kelly Front Panel library + QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN\'' # Flag that at runtime, look for shared libraries (like + # libokFrontPanel.so) at the same directory as the binary } From 36952e38eb6bf7895f1e61360f7145dda3173e96 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Mon, 6 May 2024 18:11:28 +0200 Subject: [PATCH 3/5] trivial: Update metainfo file --- contrib/com.intantech.intan_rhx.metainfo.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/com.intantech.intan_rhx.metainfo.xml b/contrib/com.intantech.intan_rhx.metainfo.xml index 4698612..9cc5935 100644 --- a/contrib/com.intantech.intan_rhx.metainfo.xml +++ b/contrib/com.intantech.intan_rhx.metainfo.xml @@ -16,10 +16,14 @@

+ https://intantech.com/RHX_software.html + com.intantech.intan_rhx.desktop https://intantech.com/image-src/RHX_screenshot2_940.PNG + + From 7e5e21be55441cde4e17993293b2a40cb67295b6 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Mon, 6 May 2024 18:36:32 +0200 Subject: [PATCH 4/5] ci: Update actions versions --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47a0ad0..8b0b55c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: name: Validate Metadata runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment run: cd contrib/ci/ && podman build -t intanrhx_validate -f ./Dockerfile-debian-testing . @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -40,7 +40,7 @@ jobs: ./contrib/ci/auto-build-deb.sh - name: Upload Debian package artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Debian Package path: | @@ -53,7 +53,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -66,7 +66,7 @@ jobs: ./contrib/ci/auto-build-deb.sh - name: Upload Ubuntu package artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Ubuntu LTS Package path: | From 3ead6dfb5a54498924001aad940f5474dac471b2 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Tue, 9 Jul 2024 20:18:15 +0200 Subject: [PATCH 5/5] Resolve a few more compiler warnings and Qt6 deprecations --- Engine/API/Abstract/abstractrhxcontroller.cpp | 7 +++---- Engine/API/Hardware/rhxregisters.cpp | 8 ++++---- Engine/Processing/xmlinterface.cpp | 6 +++--- GUI/Widgets/pageview.cpp | 4 ++-- GUI/Widgets/testcontrolpanel.cpp | 12 ++++-------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Engine/API/Abstract/abstractrhxcontroller.cpp b/Engine/API/Abstract/abstractrhxcontroller.cpp index 26611ff..09a991a 100644 --- a/Engine/API/Abstract/abstractrhxcontroller.cpp +++ b/Engine/API/Abstract/abstractrhxcontroller.cpp @@ -665,14 +665,13 @@ unsigned int AbstractRHXController::fifoCapacityInWords() // Print a command list to the console in readable form. void AbstractRHXController::printCommandList(const vector &commandList) const { - unsigned int i, cmd; int channel, reg, data, uFlag, mFlag, dFlag, hFlag; cout << '\n'; - for (i = 0; i < commandList.size(); ++i) { - cmd = commandList[i]; + for (uint i = 0; i < commandList.size(); ++i) { + auto cmd = commandList[i]; if (type != ControllerStimRecord) { - if (cmd < 0 || cmd > 0xffff) { + if ((int)cmd < 0 || cmd > 0xffff) { cout << " command[" << i << "] = INVALID COMMAND: " << cmd << '\n'; } else if ((cmd & 0xc000) == 0x0000) { channel = (cmd & 0x3f00) >> 8; diff --git a/Engine/API/Hardware/rhxregisters.cpp b/Engine/API/Hardware/rhxregisters.cpp index 2d4b882..6a9a26e 100644 --- a/Engine/API/Hardware/rhxregisters.cpp +++ b/Engine/API/Hardware/rhxregisters.cpp @@ -1122,7 +1122,7 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned } else { switch (commandType) { case RHXCommandConvert: - if ((arg1 < 0) || (arg1 > 63)) { + if (((int)arg1 < 0) || (arg1 > 63)) { cerr << "Error in RHXRegisters::createRHXCommand: " << "Channel number out of range.\n"; return -1; @@ -1130,7 +1130,7 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned return 0x0000 + (arg1 << 8); // 00cccccc0000000h; if the command is 'Convert', // arg1 is the channel number. case RHXCommandRegRead: - if ((arg1 < 0) || (arg1 > 63)) { + if (((int)arg1 < 0) || (arg1 > 63)) { cerr << "Error in RHXRegisters::createRHXCommand: " << "Register address out of range.\n"; return -1; @@ -1182,12 +1182,12 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned } else { switch (commandType) { case RHXCommandRegWrite: - if ((arg1 < 0) || (arg1 > 63)) { + if (((int)arg1 < 0) || (arg1 > 63)) { cerr << "Error in RHXRegisters::createRHXCommand: " << "Register address out of range.\n"; return -1; } - if ((arg2 < 0) || (arg2 > 255)) { + if (((int)arg2 < 0) || (arg2 > 255)) { cerr << "Error in RHXRegisters::createRHXCommand: " << "Register data out of range.\n"; return -1; diff --git a/Engine/Processing/xmlinterface.cpp b/Engine/Processing/xmlinterface.cpp index 2fff4b3..cb10990 100644 --- a/Engine/Processing/xmlinterface.cpp +++ b/Engine/Processing/xmlinterface.cpp @@ -884,7 +884,7 @@ void XMLInterface::parseSignalGroupsAttributes(const QByteArray &byteArray, QStr { QXmlStreamReader stream(byteArray); while (!stream.atEnd()) { - while (stream.name() != "SignalGroup") { + while (stream.name() != QStringLiteral("SignalGroup")) { QXmlStreamReader::TokenType token = stream.readNext(); if (token == QXmlStreamReader::EndDocument) { return; @@ -894,7 +894,7 @@ void XMLInterface::parseSignalGroupsAttributes(const QByteArray &byteArray, QStr QXmlStreamAttributes attributes = stream.attributes(); QString portName(""); for (auto attribute : attributes) { - if (attribute.name().toString().toLower() == "prefix") { + if (attribute.name().toString().toLower() == QStringLiteral("prefix")) { portName = "Port " + attribute.value().toString(); break; } @@ -910,7 +910,7 @@ void XMLInterface::parseSignalGroupsAttributes(const QByteArray &byteArray, QStr QString attributeName = attribute.name().toString(); QString attributeValue = attribute.value().toString(); - if (attributeValue != "N/A") { + if (attributeValue != QStringLiteral("N/A")) { StateSingleItem *singleItem = state->locateStateSingleItem(thisSignalGroup->portItems, attributeName); // If the attribute is a StateSingleItem, set it according to XMLIncludeParameters. diff --git a/GUI/Widgets/pageview.cpp b/GUI/Widgets/pageview.cpp index 66cd247..c797995 100644 --- a/GUI/Widgets/pageview.cpp +++ b/GUI/Widgets/pageview.cpp @@ -1266,8 +1266,8 @@ QString PageView::getSiteShape(int port, int site) void PageView::overwriteColor(QColor &color, const QString& colorName) { - if (color.isValidColor(colorName)) - color.setNamedColor(colorName); + if (color.isValidColorName(colorName)) + color = QColor::fromString(colorName); } void PageView::overwriteFloat(float &original, float newValue) { diff --git a/GUI/Widgets/testcontrolpanel.cpp b/GUI/Widgets/testcontrolpanel.cpp index 9e3bdca..9628766 100644 --- a/GUI/Widgets/testcontrolpanel.cpp +++ b/GUI/Widgets/testcontrolpanel.cpp @@ -94,8 +94,8 @@ TestControlPanel::TestControlPanel(ControllerInterface *controllerInterface_, Ab helpDialogCheckInputWave(nullptr), helpDialogTestChip(nullptr), helpDialogUploadTestStimParameters(nullptr), - previousDelay(-1), portComboBox(nullptr), + previousDelay(-1), auxIn1Min(3.3), auxIn1Max(0), auxIn1Median(0), @@ -830,13 +830,11 @@ void TestControlPanel::recordDummySegment(double duration, int portIndex) void TestControlPanel::allocateDoubleArray3D(QVector > > &array3D, int xSize, int ySize, int zSize) { - int i, j; - if (xSize == 0) return; array3D.resize(xSize); - for (i = 0; i < xSize; ++i) { + for (int i = 0; i < xSize; ++i) { array3D[i].resize(ySize); - for (j = 0; j < ySize; ++j) { + for (int j = 0; j < ySize; ++j) { array3D[i][j].resize(zSize); } } @@ -846,11 +844,9 @@ void TestControlPanel::allocateDoubleArray3D(QVector > > void TestControlPanel::allocateDoubleArray2D(QVector > &array2D, int xSize, int ySize) { - int i, j; - if (xSize == 0) return; array2D.resize(xSize); - for (i = 0; i < xSize; ++i) { + for (int i = 0; i < xSize; ++i) { array2D[i].resize(ySize); } }