Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize the codebase (C++11) #10

Open
Kaffeine opened this issue Sep 9, 2016 · 6 comments
Open

Modernize the codebase (C++11) #10

Kaffeine opened this issue Sep 9, 2016 · 6 comments
Milestone

Comments

@Kaffeine
Copy link
Member

Kaffeine commented Sep 9, 2016

No description provided.

@Kaffeine Kaffeine added this to the 0.10.0 milestone Sep 9, 2016
@Kaffeine Kaffeine changed the title Modernize code with C++11 Modernize the codebase (C++11) Oct 26, 2016
@Kaffeine Kaffeine modified the milestones: 0.10.0, 0.9.9 Nov 13, 2019
@jbruechert
Copy link
Contributor

Are you aware of clang-tidy? Fixing at least the override and nullptr warnings should be fairly straightforward using it (https://www.kdab.com/clang-tidy-part-1-modernize-source-code-using-c11c14/).

@Kaffeine
Copy link
Member Author

Yeah, I had it in mind and I ran it on some projects, but I had excuses to not run it on TelepathyQt yet.
Thank you for the remind, I think it is a good time to use it right now.

@Kaffeine
Copy link
Member Author

I also would like to apply your jbruechert@3bbe126, :-) but we can't rely on Qt > 5.6 yet.
(e.g. QDateTime::setSecsSinceEpoch() introduced in Qt 5.8)
Would you mind to rework the commit to support Qt 5.6 or split the changes, so we can apply at least qVariantFromValue -> QVariant::fromValue and std::sort replacements? (I'm running override and nullptr conversions so those are going to be irrelevant).

@jbruechert
Copy link
Contributor

Opened #36 with the changes.

@Kaffeine
Copy link
Member Author

Most of the work is done. Still TODO:

  • Use Qt5 connections wherever applicable
  • Use default member initializers instead of code in constructors
  • Use initializer lists wherever applicable
  • Use range-based for where it makes sense

Get rid of stuff like this:

QVariantMap map;
map.insert(QLatin1String(".AvailableMechanisms"),
           QVariant::fromValue(mPriv->adaptee->availableMechanisms()));
map.insert(QLatin1String(".HasInitialData"),
           QVariant::fromValue(mPriv->adaptee->hasInitialData()));
map.insert(QLatin1String(".CanTryAgain"),
           QVariant::fromValue(mPriv->adaptee->canTryAgain()));
map.insert(QLatin1String(".AuthorizationIdentity"),
           QVariant::fromValue(mPriv->adaptee->authorizationIdentity()));
map.insert(QLatin1String(".DefaultUsername"),
           QVariant::fromValue(mPriv->adaptee->defaultUsername()));
map.insert(QLatin1String(".DefaultRealm"),
           QVariant::fromValue(mPriv->adaptee->defaultRealm()));
map.insert(QLatin1String(".MaySaveResponse"),
           QVariant::fromValue(mPriv->adaptee->maySaveResponse()));
return map;

@jbruechert
Copy link
Contributor

For the old-style connects we could look into automating most of the work using clazy. The harder part will be the spec code generator.

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

No branches or pull requests

2 participants