src: Yearly copyright bump This time on time!
src: Yearly copyright bump Let's welcome 2020.
src: Yearly copyright bump ... and it's still January!
modernize: Reformat ALL the source... again! It's been more than six years since we last used an autoformatter on the codebase. Tooling has progressed, so has the language and of course our personal preferences. Use clang-format this time to reformat the whole codebase, following the rules laid out in .clang-format (which one can use for configuring an IDE, too, if it supports autoformatting). Overall, the new style is not too different from what we used before, with one significant change: We now attach pointer/reference indicators (*&) to the type rather than the name, i.e. we left-align. While this is a major deviation from the Qt style which we use for almost everything else, it aligns more closely with many other projects, as well as the C++ documentation and STL. It also makes more sense semantically, because */& are really part of the type. Other changes include (but are not limited to): - Use only one blank line between function definitions - Categorize includes from generic/system to local, sorting each category alphabetically. The generic-to-local sort order seems to be more common than the other way round, so we use that. - In .cpp files, the corresponding header is always included first. This is a general recommendation, because it makes it harder to accidentally introduce a reliance on transitive includes in headers. - Consistently break initializers in ctors before the comma, so the commas are left-aligned together with the colon. - Use two spaces between code and trailing comments. Note that sometimes even clang-format gets things wrong. In a few places, formatting was manually fixed; however, reviewing a diff of almost 80k lines is a rather boring task, so we didn't thoroughly go through all the changes. Wrong formatting can always be fixed in follow-up commits, anyway. Note also that we don't intend to re-run clang-format on a regular basis, nor do we want to religiously follow a hardcoded set of rules for new code in the future. Where it makes sense, the rules may be bent in favor of better readability or more pleasing code.
modernize: Require member function pointers for Settings::notify() Require member function pointers for Settings::notify() and Settings::initAndNotify(). This brings us one step closer to being SLOT-free.
modernize: Migrate action-related things to PMF connects In our quest to get rid of the deprecated use of slots, refactor Action and ActionCollection to require pointer-to-member-function connects. Ensure nobody accidentally still uses SLOT through a static assertion. Add a convenience function to ActionCollection for adding lists of actions. While we're at it, also rework ActionCollection's optional KDE Frameworks support to simplify things. Adapt the rest of the code accordingly.
clazy: Convert many old-style connects into function pointer based Since Qt5, signal/slot connections can be expressed using function pointers rather than the SIGNAL/SLOT macros. This is a) much more efficient, and b) provides a compile-time check for the sender and receiver being compatible. Let clazy auto-fix old-style connects where it can. However, a lot of occurrences remain where we'll need manual intervention for one reason or another.
modernize: Use raw string literals instead of escaped strings Replace escaped strings with raw string literals in places where it makes sense, and doesn't confuse lupdate.
modernize: Use auto where the type is clear from context Apply clang-tidy's modernize-use-auto fix, which uses auto where the type would otherwise be duplicated in the line (e.g. when casting a type, or creating an instance with 'new').
modernize: Use '= default' instead of empty ctor/dtor bodies Also remove lots of unnecessary, empty ctors and dtors.
modernize: Pass arguments by value and move in constructors If a method (or constructor) wants to store an argument in a local variable or attribute, one should prefer passing it in by value and moving it into the final location, rather than taking a const reference and copying it over. In the best case, this saves one copy, if the method is called with an rvalue. This pattern is most frequent in constructors initializing class members, so let clang-tidy fix this for argument types that have move constructors.
modernize: Use nullptr Let clang-tidy fix all occurrences where nullptr should be used instead of 0.
qt4-b-gone: Remove all code supporting Qt < 5.5 and KDE4 Remove compatibility code for Qt versions we no longer support.
qa: Try to avoid fall-through warnings GCC8 warns again about some intentional fallthroughs. Try to fix this by adding comments.
qa: Remove [[clang::fallthrough]] annotations again These cause warnings in most compilers, so remove them again until we can use C++17 and the official attribute. Add comments, so we know the fallthroughs are intentional anyway.
icons: Warn on missing icons Provide new helper functions icon::get() that replace the uses of QIcon::fromTheme. These functions still use fromTheme() internally, but log a warning if an icon could not be found. This should make it easier to detect problems with icons. Replace all uses of QIcon::fromTheme() with icon::get(), remove useless fallbacks as that should be taken care of by the normal icon loader mechanism. Update the icon import script accordingly.
Semi-yearly copyright bump It's no longer 2016.
qa: Replace [[fallthrough]] by [[clang::fallthrough]] The [[fallthrough]] attribute is a C++17 extension. It happens to work in GCC 7, but causes warnings or even failures in other compilers. In my quest to find a syntax that makes all compilers happy without having to disable the (useful) warning, I think I have finally found a way. Using the clang:: namespace seems to solve several issues: * It is marked as a compiler extension, so compilers not supporting it should simply ignore the attribute * It (obviously) works in Clang, which is nice when using a Clang-based IDE like Qt Creator * For some reason, it also seems to silence warnings in GCC; I guess one of GCC's fancy regexes somehow matches
client: Fix Chat Monitor missing sender brackets Always re-add hidden sender brackets for the Chat Monitor as the normal sender prefixes get replaced with Network, Buffer, and Sender names. Sender brackets shown: > Copy-pasted Chat Monitor: <Bitlbee:#channel> digitalcircuit does things Channel: -*- digitalcircuit does things Before: > Copy-pasted with sender brackets hidden (wrong) Chat Monitor: Bitlbee:#channel digitalcircuit does things Channel: -*- digitalcircuit does things After: > Copy-pasted with sender brackets hidden (correct) Chat Monitor: <Bitlbee:#channel> digitalcircuit does things Channel: -*- digitalcircuit does things Closes GH-314.
qa: Add [[fallthrough]] annotations where appropriate Newer GCCs start to warn about this, so add attributes or rearrange code as appropriate. While the [[fallthrough]] attribute has only been standardized in C++17, it should simply be ignored by older compilers (and it does shut up GCC even when compiling with -std=c++11).