Skip to content

Conversation

@zomfg
Copy link

@zomfg zomfg commented Nov 26, 2020

I ran the build through clazy and it highlighted a lot of small things (still does) to improve
here are most of those things:

  • QStringLiteral (compile time QString basically)
  • new connect syntax so slots/signals are checked at build time (found few loose things this way)
    • which in some cases needs c++14, so I bumped everything to 17
      also apparently doing this through FLAGS does not work well because qmake would still append whatever the default is from mkspec, so changing this via CONFIG solves that
  • some missing consts
  • std::chrono_literals for QTimers
  • QList::reserve() where possible
  • random normal gcc/clang warnings (casts etc)

After that I tried building with Qt6 RC, and after some minor massaging it worked

  • QSettings assumes utf-8 now, so no need for setIniCodec() (which is dropped from core anyway)
  • QRegExp* is QRegularExpression* now
  • QList works slightly differently now and does not like forward declarations for item types
    I'm not sure if there's more to be done for this part given what they say (like is it leaking as is or...)
  • couple other minor things

but just by itself this PR has like 95% of the above (so just this would not build with Qt6 for ex)

once all 3 are merged, another quick pass would be needed (this one should probably go first)

while dealing with slots and signals I did some device refactoring, mostly de-copypasta'd UDP, and fixed couple of small things on the way
there's a lot more to do there, but that'll wait another time

and finally, removed remaining QDekstopWidget usage which I started doing a while ago with some deprecations, but at the time they were saying "use these other classes/methods" which themselves used QDekstopWidget but were not flagged as deprecated for some reason and now everything gets removed in Qt6...
these changes seem to work, but I can't test multiple displays

otherwise this builds and runs on all 3 platforms

Copy link
Owner

@psieg psieg left a comment

Choose a reason for hiding this comment

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

Thanks, just a few small notes

int count = QGuiApplication::screens().count();

result = QString("%1%2\r\n").arg(CmdResultCountMonitor).arg(count);
result = QStringLiteral("%1%2\r\n").arg(CmdResultCountMonitor).arg(count);
Copy link
Owner

Choose a reason for hiding this comment

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

When did you swtich to .arg(x,y) and when stick to .arg(X).arg(Y) ?

Copy link
Author

Choose a reason for hiding this comment

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

(QString1, QString2...) (up to 9 i think)
arg(type1).arg(type2)... which is probably equal to (QString(type1), QString(type2)...) allocation wise

virtual ~LedDeviceAlienFx();
QString name() const { return QStringLiteral("lightfx"); }
int maxLedsCount();
int defaultLedsCount() { return 1; }
Copy link
Owner

Choose a reason for hiding this comment

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

just curious, why is the maxLedsCounts in the code file but the defaultLedsCount in the header?

Copy link
Author

@zomfg zomfg Dec 4, 2020

Choose a reason for hiding this comment

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

to avoid adding enum header

@psieg psieg merged commit 49f0493 into psieg:master Dec 6, 2020
@zomfg zomfg deleted the feature/clazy branch December 6, 2020 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants