Prefer initializer_list over operator << for initializing a QList
Needs ReviewPublic

Authored by tcanabrava on Sep 27 2018, 1:14 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

1 - Change QStringList() << a << b << c to QStringList { a, b, c};
2 - Split really long lines in main.cpp

The command line options setup are too big to fit in the screen
this breaks one parameter per line (as a single parameter can
take more than 80 characters sometimes).

Not all of the strings can be read in the line yet, but
this is an improvement.

I'm unsure if the gettext tools will extract correctly the
string if I transform it in a multiline c++ string, so I'm
leaving those as is.

Diff Detail

Repository
R40 Kate
Branch
commandLineSpeedup
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3262
Build 3280: arc lint + arc unit
tcanabrava created this revision.Sep 27 2018, 1:14 PM
Restricted Application added a project: Kate. · View Herald TranscriptSep 27 2018, 1:14 PM
Restricted Application added a subscriber: kwrite-devel. · View Herald Transcript
tcanabrava requested review of this revision.Sep 27 2018, 1:14 PM
apol added a subscriber: apol.Sep 27 2018, 3:15 PM
apol added inline comments.
kate/main.cpp
252

Why do you need to hardcode the QStringList constructor?

broulik added inline comments.
kate/main.cpp
187

Just do QStringList{QStringLiteral("s"), QStringLiteral("start")}

tcanabrava added inline comments.Sep 27 2018, 5:35 PM
kate/main.cpp
187

ok.

252

i tried using only initializer list but got a compilation error.

broulik added inline comments.Sep 28 2018, 8:01 AM
kate/main.cpp
252

I think because there's an overload for QString and QStringList and you can also do QString{"foo"} so it's ambiguous if you just use {}