Fixed a bunch of compiler warnings and deprecated functions. - #446
Fixed a bunch of compiler warnings and deprecated functions.#446sfjuocekr wants to merge 5 commits into
Conversation
|
Just an idea, but I think we should make some CI/CD script to compile companion when changes to companion are committed, don’t you think? |
|
Probably, but my experience regarding CI/CD is very limited. I'm one of those text editor programmers :( I've been trying to get my head around QTCreator the past days. |
| if (Boards::getFourCC(board) != fourcc) { | ||
| if (IS_FAMILY_HORUS_OR_T16(board) && fourcc == 0x3178396F) { | ||
| qDebug() << QString().sprintf("%s: Deprecated fourcc used %x vs %x", getName(), fourcc, Boards::getFourCC(board)); | ||
| qDebug() << QString().asprintf("%s: Deprecated fourcc used %x vs %x", getName(), fourcc, Boards::getFourCC(board)); |
There was a problem hiding this comment.
As per QT doco, even asprintf is not recommended for new code so if updating it is recommended to use QTextStream or arg
There was a problem hiding this comment.
Support - simplest change
| QDir dir(path); | ||
| if (dir.exists() && dir.isReadable()) { | ||
| QStringList fwid = getCurrentFirmware()->getId().split("-", QString::SkipEmptyParts); | ||
| QStringList fwid = getCurrentFirmware()->getId().split("-", Qt::KeepEmptyParts); |
There was a problem hiding this comment.
Why the change from skip to keep?
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
| connect(ui->multiProtocol, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ModulePanel::onMultiProtocolChanged); | ||
| connect(this, &ModulePanel::channelsRangeChanged, this, &ModulePanel::setupFailsafes); | ||
| connect(ui->btnGrpValueType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &ModulePanel::onFailsafesDisplayValueTypeChanged); | ||
| connect(ui->btnGrpValueType, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::idClicked), this, &ModulePanel::onFailsafesDisplayValueTypeChanged); |
There was a problem hiding this comment.
Introduced at 5.15 so backwards compatibility issue with OpenTX and buttonClicked is still supported
|
IMHO there needs to be agreement on what the build environment is otherwise devs will be chasing their tails trying to diagnose why things work or don't considering devs are using Windows, flavours of Linux and maybe even Mac. |
|
Agreed. Just like with the firmware - a set environment (or environments, if it needs to be natively built) - needs to be used for consistency and repeatability. Or at least version locks - i.e. QT 5.12, not just whatever happens to be the latest. |
Traditionally, this is done by having the CI/CD using the oldest version supported. Everything must be checked against that version. So bottom line is: we need CI/CD for Companion if we want to be able to do this properly. @elecpower is that what you had in mind? |
|
Some of these changes could be rewritten with #ifdef to check what version is used to silence the compiler on those versions. |
|
I agree with, where practical, suppressing compiler warnings but please no version #ifdef just to suppress compiler warnings. Set the build platform and live with any annoyances. |
@raphaelcoeffic not quite that far but why not have that as longer term aim. CI tests would need to be across supported OS platforms. The real challenge are those obscure issues that arise between OS platforms eg UI display. Anyway my comment was mainly to set the project's dev environment and all devs code to that and don't expend time writing and/or testing against anything else and then trying to shoehorn it into the project codebase. Some ideas in a collaborative project just have to wait until the time arises. Plus trying to diagnose issues not related to the set environment. Also on the CI/CD theme need to consider recompiling libsimulators when changes to radios. As these are currently package with Companion so would need a new download process. This could potentially be added to existing Companion nightly function but as always some thought needed and consideration in the context in the use of EdgeTX Flasher. |
|
@elecpower Since Companion is your baby ATM, I'll defer to you... I take it there are compatability issues making it so this PR needs more than re-signing with current codebase and merging? |
|
I also agree with not using ifdefs just to silence warnings - better to find a compiler flag to shut it up where possible ;) |
Yes as per previous comments. Also, I do not get these warnings using the EdgeTX build environment so it would appear they are specific each dev's build environment. |
|
Indeed... we can only support the documented/official dev setup, anything else will only lead to never-ending chaos. Once you've had a chance to review, lets give @sfjuocekr a chance to get this PR up to date and see if we can get it merged. To that end, I think I'm going to have to say we can't accept the changes to I would suggest capturing the script in it's current form (as it has changed somewhat in the mean time, make your changes, and re-adding it as |
|
@pfeerick @raphaelcoeffic Since EdgeTX is bleeding edge and I agree we want contributions from all quarters, how about an unsupported resources area for scripts and How To instructions. Some really good ideas/techniques/tricks/etc may come from those and make it into the official environment? |
| #endif | ||
|
|
||
| dfuArgs = g.dfuArguments().split(" ", QString::SkipEmptyParts); | ||
| dfuArgs = g.dfuArguments().split(" ", Qt::SkipEmptyParts); |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
| void burnConfigDialog::on_dfuArgs_editingFinished() | ||
| { | ||
| dfuArgs = ui->dfuArgs->text().split(" ", QString::SkipEmptyParts); | ||
| dfuArgs = ui->dfuArgs->text().split(" ", Qt::SkipEmptyParts); |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
| { | ||
| QPrinter printer; | ||
| printer.setPageMargins(10.0, 10.0, 10.0, 10.0, printer.Millimeter); | ||
| printer.setPageMargins({10.0, 10.0, 10.0, 10.0}, QPageLayout::Millimeter); |
| QPrinter printer; | ||
| QString filename = QFileDialog::getSaveFileName(this, tr("Select PDF output file"), QString(), "Pdf File(*.pdf)"); | ||
| printer.setPageMargins(10.0, 10.0, 10.0, 10.0, printer.Millimeter); | ||
| printer.setPageMargins({10.0, 10.0, 10.0, 10.0}, QPageLayout::Millimeter); |
| printer.setPageMargins({10.0, 10.0, 10.0, 10.0}, QPageLayout::Millimeter); | ||
| printer.setOutputFormat(QPrinter::PdfFormat); | ||
| printer.setOrientation(QPrinter::Landscape); | ||
| printer.setPageOrientation(QPageLayout::Landscape); |
| unsigned int result = 0; | ||
| const Firmware * base = getFirmwareBase(); | ||
| QStringList options = id.mid(base->getId().length()+1).split("-", QString::SkipEmptyParts); | ||
| QStringList options = id.mid(base->getId().length()+1).split("-", Qt::SkipEmptyParts); |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
|
|
||
| QObject::connect(btn, &QToolButton::clicked, [=]() { | ||
| QString dir = QFileDialog::getExistingDirectory(parent, fsw->property("fileDialogTitle").toString(), le->text(), 0); | ||
| QString dir = QFileDialog::getExistingDirectory(parent, fsw->property("fileDialogTitle").toString(), le->text(), {}); |
| } | ||
| } | ||
| qDebug() << QString().sprintf("%s: OK", getName()); | ||
| qDebug() << QString().asprintf("%s: OK", getName()); |
| bool added = false; | ||
| // Convert set into list and sort it alphabetically case insensitive | ||
| QStringList list = QStringList::fromSet(set); | ||
| QStringList list = QList<QString>(set.begin(), set.end()); |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
| QString newFilename = logFilename; | ||
| newFilename.append(QString("-Session%1.csv").arg(index)); | ||
| QString filename = QFileDialog::getSaveFileName(this, "Save log", newFilename, "CSV files (.csv);", 0, 0); // getting the filename (full path) | ||
| QString filename = QFileDialog::getSaveFileName(this, "Save log", newFilename, "CSV files (.csv);", 0, {}); // getting the filename (full path) |
| QString MainWindow::seekCodeString(const QByteArray & qba, const QString & label) const | ||
| { | ||
| int posLabel = qba.indexOf(label); | ||
| int posLabel = qba.indexOf(label.toUtf8()); |
|
|
||
| if (!m_options.includeFilter.isEmpty() && m_options.includeFilter != "*") | ||
| m_dirIteratorFilters = m_options.includeFilter.split(',', QString::SkipEmptyParts); | ||
| m_dirIteratorFilters = m_options.includeFilter.split(',', Qt::SkipEmptyParts); |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
|
|
||
| if (!m_options.excludeFilter.isEmpty()) { | ||
| for (const QString & f : m_options.excludeFilter.split(',', QString::SkipEmptyParts)) | ||
| for (const QString & f : m_options.excludeFilter.split(',', Qt::SkipEmptyParts)) |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
| void AutoBitsetCheckBox::updateValue() | ||
| { | ||
| if (m_field) | ||
| { |
There was a problem hiding this comment.
Already fixed in OTX and Companion 2.5
|
|
||
| // determine if we have a model number | ||
| QStringList parts = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); | ||
| QStringList parts = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts); |
There was a problem hiding this comment.
Needs Qt 5.14 - change not supported
| QDebugStateSaver saver(d); | ||
| d << "RadioWidget::RadioWidgetState: type=" << o.type << "; index=" << o.index | ||
| << "; value=" << o.value << "; flags=0x" << hex << o.flags; | ||
| << "; value=" << o.value << "; flags=0x" << Qt::hex << o.flags; |
There was a problem hiding this comment.
Support these scope qualifiers
| QSpacerItem * item = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding); | ||
|
|
||
| ui->curvesLayout->addItem(item,limit + 1, 1, 1, 1, 0); | ||
| ui->curvesLayout->addItem(item, limit + 1, 1, 1, 1); |
|
@pfeerick finished my review of the Companion code. Where no comment then previous comments applies for same change |
|
@sfjuocekr Did you want to work on this further. Otherwise, I can add a commit with the reviewed changes in the #555 PR so that it is included as part of that (if @elecpower is ok with that). Your build script would go in https://github.com/EdgeTX/playground, a new repo to host more experimental/unsupported stuff, and will be the first addition. I'll give say three days for a reply before proceeding further... |
|
@pfeerick @sfjuocekr this PR will need to be rebased on #555 and conflicts resolved. |
|
I've had to deal with some unfortunate events in my personal life, sorry for not responding. The resolve conflicts button is grayed out for me, I'll try to go over the changes and touch up the copy paste errors. No guarantees tho, I've just lost one of my best friends :( |
|
My condolences. 😢 Take your time... Yeah, the changes to |
Add builder from EdgeTX/edgetx#446
|
By the way, adding real support for Mac M1 seems to force us to update to C++17 and Qt 6.2 (only supported version so far). |
That is a whole lot of pain as significant changes from Qt 5 to 6. |
I know… but it’s not like we have a choice… |
|
Well, we, do... who cares about the Mac M1 :-P That's just one variant of one OS supported... I'm not saying this shouldn't happen, but I don't see it even being worth started on until 2.8/9 ... especially given that means dropping support for Windows 7/ 8 & 10 (pre 1809), macOS 10.13 , and linux distros from 18 -> 20 releases. |
Whoa! Really? This is crazy! Qt said they might support Apple silicon in 5.15, but it seems to be only for the “commercial” version, whatever that means. |
|
Upgrade to Qt 5.15.2 covered by #3339 and some of the radio changes have been superseded by PRs moving to new ui, etc |
Fixed a bunch of compiler warnings.
Fixed a bunch of deprecated functions.
Changed the setup script to allow builds on 21.04.