Skip to content

Fixed a bunch of compiler warnings and deprecated functions. - #446

Closed
sfjuocekr wants to merge 5 commits into
EdgeTX:mainfrom
sfjuocekr:2.4
Closed

Fixed a bunch of compiler warnings and deprecated functions.#446
sfjuocekr wants to merge 5 commits into
EdgeTX:mainfrom
sfjuocekr:2.4

Conversation

@sfjuocekr

Copy link
Copy Markdown
Contributor

Fixed a bunch of compiler warnings.
Fixed a bunch of deprecated functions.
Changed the setup script to allow builds on 21.04.

@pfeerick pfeerick added the companion Related to the companion software label Jul 14, 2021
@raphaelcoeffic

Copy link
Copy Markdown
Member

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?

@sfjuocekr

Copy link
Copy Markdown
Contributor Author

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.

@raphaelcoeffic
raphaelcoeffic changed the base branch from 2.4 to main July 20, 2021 11:34
@raphaelcoeffic
raphaelcoeffic requested a review from elecpower July 31, 2021 06:00
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));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per QT doco, even asprintf is not recommended for new code so if updating it is recommended to use QTextStream or arg

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from skip to keep?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy paste error!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced at 5.15 so backwards compatibility issue with OpenTX and buttonClicked is still supported

@elecpower

Copy link
Copy Markdown
Collaborator

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.
I have no problem in devs using the environment of their choice but all PRs should be compiled and tested against the agreed environment.
There are lots of changes to the project code without adding moving platform. This is not to say the platform should stay fixed but maybe review and if necessary update after each major project release.

@pfeerick

pfeerick commented Aug 1, 2021

Copy link
Copy Markdown
Member

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.

@raphaelcoeffic

Copy link
Copy Markdown
Member

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?

@sfjuocekr

Copy link
Copy Markdown
Contributor Author

Some of these changes could be rewritten with #ifdef to check what version is used to silence the compiler on those versions.

@elecpower

Copy link
Copy Markdown
Collaborator

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.

@elecpower

elecpower commented Aug 1, 2021

Copy link
Copy Markdown
Collaborator

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?

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

@pfeerick

Copy link
Copy Markdown
Member

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

@pfeerick

pfeerick commented Aug 24, 2021

Copy link
Copy Markdown
Member

I also agree with not using ifdefs just to silence warnings - better to find a compiler flag to shut it up where possible ;)

@elecpower

Copy link
Copy Markdown
Collaborator

I take it there are compatability issues making it so this PR needs more than re-signing with current codebase and merging?

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.
IMHO we 'fix' those that pop up in the official build environment otherwise there will be PR after PR for individual dev issues that potentially cause issues for other dev's environments or even the official build environment.
These are annoying warnings not errors. But if you stray from the official path then be it on your head.
That being said in the next day or so I will recheck Qt version compatibility with OTX and flag any that are incompatible in addition to the one already noted.

@pfeerick

Copy link
Copy Markdown
Member

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 tools/setup_buildenv_ubuntu20.04.sh in this form, as ubuntu21 is not a supported build environment as yet - and those changes wouldn't be consistent with the script anyway, since it is specifically for ubuntu 21.04 ;)

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 setup_buildenv_ubuntu21.04_unsupported.sh, whilst adding a caution at the start and end of the run that this is not an officially supported build configuration, so use at your own risk. I would like to keep it rather reject outright, as it will allow for this build environment to actually get tested. :) Although I would suspect the next supported build environment would be 22.04 (next LTS). Your thoughts @raphaelcoeffic ?

@elecpower

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support

printer.setPageMargins({10.0, 10.0, 10.0, 10.0}, QPageLayout::Millimeter);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation(QPrinter::Landscape);
printer.setPageOrientation(QPageLayout::Landscape);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support

}
}
qDebug() << QString().sprintf("%s: OK", getName());
qDebug() << QString().asprintf("%s: OK", getName());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support

Comment thread companion/src/helpers.cpp
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());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supported

QString MainWindow::seekCodeString(const QByteArray & qba, const QString & label) const
{
int posLabel = qba.indexOf(label);
int posLabel = qba.indexOf(label.toUtf8());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support


if (!m_options.includeFilter.isEmpty() && m_options.includeFilter != "*")
m_dirIteratorFilters = m_options.includeFilter.split(',', QString::SkipEmptyParts);
m_dirIteratorFilters = m_options.includeFilter.split(',', Qt::SkipEmptyParts);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs Qt 5.14 - change not supported

void AutoBitsetCheckBox::updateValue()
{
if (m_field)
{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support

@elecpower

Copy link
Copy Markdown
Collaborator

@pfeerick finished my review of the Companion code. Where no comment then previous comments applies for same change

@pfeerick

pfeerick commented Aug 29, 2021

Copy link
Copy Markdown
Member

@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 pfeerick added the question Further information is requested label Aug 29, 2021
@elecpower

Copy link
Copy Markdown
Collaborator

@pfeerick @sfjuocekr this PR will need to be rebased on #555 and conflicts resolved.
I have a couple more commits for 555 to push after a bit more testing.

@sfjuocekr

Copy link
Copy Markdown
Contributor Author

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 :(

@pfeerick

pfeerick commented Sep 1, 2021

Copy link
Copy Markdown
Member

My condolences. 😢 Take your time...

Yeah, the changes to setup_buildenv_ubuntu20.04.sh were probably too substantial for it to want to let you resolve online. You'll be able to resolve that by removing it - that can get merged into the playground repo instead. PR for exactly that. Then you can focus just on the companion rebase/changes.

pfeerick added a commit to EdgeTX/playground that referenced this pull request Sep 1, 2021
@pfeerick pfeerick self-assigned this Oct 7, 2021
@raphaelcoeffic

Copy link
Copy Markdown
Member

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

@elecpower

Copy link
Copy Markdown
Collaborator

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.

@raphaelcoeffic

Copy link
Copy Markdown
Member

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…

@pfeerick

Copy link
Copy Markdown
Member

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.

@raphaelcoeffic

Copy link
Copy Markdown
Member

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.

@pfeerick pfeerick removed their assignment Mar 18, 2022
@elecpower

Copy link
Copy Markdown
Collaborator

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

@pfeerick pfeerick removed the question Further information is requested label Mar 17, 2023
@pfeerick pfeerick closed this Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

companion Related to the companion software

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants