src: Yearly copyright bump This time on time!
src: Yearly copyright bump Let's welcome 2020.
qa: Avoid deprecation warnings for QList/QSet conversions Qt 5.14 deprecated the explicit functions for converting between QSet and QList, preferring instead the use of range-based ctors. Unfortunately, those ctors were only added in Qt 5.14, so we can't use them when compiling against older versions. Add a util function for QList->QSet to keep the version check in a single place. Replace the other direction by using QSet::values(). In some cases, conversions could be avoided altogether, or an STL container be used easily, so do that.
common: Always let QVariant::fromValue() deduce the type In some places, we would explicitly give the type to QVariant::fromValue(), forgoing automatic type deduction. This is almost always redundant, and in the cases where it is not, the input type should be explicitly cast. Additionally, the implementation of QVariant::fromValue() subtly changed in Qt 5.14, leading to compile errors when giving a non-decayed type (as we did in SignalProxy::attachSignal()).
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.
common: Provide helper for resolving overloaded function pointers The pointer-to-member-function connect syntax cannot directly deal with overloaded method signatures. Provide a helper to avoid ugly static_cast incantations: #include "util.h" connect(this, selectOverload<int, QString>(&MyClass::mySignal), other, &Other::mySlot); This helper can be used for both signals and slots.
modernize: Use nullptr Let clang-tidy fix all occurrences where nullptr should be used instead of 0.
src: Mark symbols to be exported where needed Generate export headers for the Quassel modules, and mark all relevant classes and function to be exported so that shared libraries can be linked against without globally exporting all symbols. This is a hard requirement for Windows DLLs, and more efficient on other platforms, too. For now, this was done incrementally until everything linked properly. In the future, we may consider explicitly defining the public interfaces for each module, and trying to minimize the linker interface e.g. by PIMPLing.
util: Remove unused and broken scopeMatch() Remove scopeMatch() from util.cpp - not only is it no longer needed, superseded by ExpressionMatch, the scopeMatch behavior broke previous Quassel functionality. Details: Channel names can begin with "!", and scopeMatch() does not support escaping "!" in the beginning of rules. Escaping support needs to be added.. but ExpressionMatch can now handle this. Let us keep the ugly parser loops confined to one place...
common: Unify Date/Time formatting, UTC offset Unify date/time formatting for the client UI, using Qt::DateFormat::DefaultLocaleShortDate to respect the operating system's configured locale. This avoids Qt's kind-of-weird default date/time format that mixes numbers and named short months/days. See https://doc.qt.io/qt-5/qt.html#DateFormat-enum Modify AM/PM detection to use application locale, which currently defaults to system locale. This avoids any inconsistencies should Quassel later allow specifying an application-wide locale different from the system locale. In CTCP VERSION replies, always use UTC time in ISO8601 date format, avoiding locale-specific replies and timezone differences. This fixes client version statistic-tracking software from treating different languages and different timezones as unique versions of Quassel IRC. In CTCP TIME replies, use local time in ISO8601 date format with timezone offset. This provides a consistent format for others to parse and still provides the timezone information. Work around a Qt bug for the latter. See https://bugreports.qt.io/browse/QTBUG-26161 And https://stackoverflow.com/questions/18750569/qdatetime-isodate-with-timezone
common: Make CommitDate Unix epoch, handle legacy Leave CommitDate (BuildDate) in Unix epoch format, converting it on demand when displayed. This allows clients to localize the time shown. Add tryFormatUnixEpoch, which checks a string for Unix epoch, parsing as date/time if possible, otherwise letting the string through. This avoids breaking protocol or any existing packaging scripts that set commit date to a string. Check for empty commit/build dates when using them, replacing with "Unknown date" or "unknown" as appropriate. Don't encode this in Quassel::setupBuildInfo() to allow for location-specific treatment and client-side translation.
common: Apply RegEx, CS column to sender, channel Modify scopeMatch to optionally treat the rule as a regular expression, and to treat it as case-sensitive or not. Modify highlight rule processing to... * Use scopeMatch for "Sender", allowing easy multi-sender rules * Treat both "Sender" and "Channel" as regular expressions if "RegEx" is checked, allowing for full regular expression power. (Breaks existing rules with RegEx matching, but in a different way) This means it is no longer possible to use RegEx matching for the "Sender" and "Channel" yet not on the phrase itself. However, it should be easy enough to work around this by using the same phrase regular expression Quassel does. This should simplify common highlight rules without limiting those who know regular expressions. Win-win, hopefully? Update tooltips to reflect these changes.
common: Put scopeMatch in util, use in highlights Move ignore rule scopeMatch() to util to share usage with highlight rule scope matching. Use scopeMatch() in highlight rule channel name processing. Advantages: > Simpler to manage common cases > Shares the same rules as ignore lists, already-learned behavior Disadvantages: > No way to escape ';' in rules > No longer able to use full regular expressions > Breaks existing channel name rules (also applies to local!) (Another approach is to keep only local highlight rules inconsistent)
Semi-yearly copyright bump It's no longer 2016.
common: Make frequently called util methods more efficient Remove unnecessary temporary allocations and string copies in the various methods in util.*, and avoid calling API functions that do more than we need them to do in favor of an efficient implementation. Ensure that frequently used QRegExp instances are created statically and reused between invocations, so they can make use of JIT and other optimizations. As some of the affected methods are called *very* frequently, this provides significant savings in terms of allocations, and significantly reduces memory fragmentation as well. Modernize some of the related code. Clean up includes, too.
Handle multiple timestamp formats, escape code Move search and replace into a loop to handle multiple timestamp format strings. Include a limit on maximum number of iterations to avoid any potential infinite loops (512 ought be enough for anybody). Add check for empty %% group to allow using '%%%%' as '%%', two literal percent signs. Comments! Document all the things. Examples: All Quassel clients vanished from the face of the earth... %%hh:mm:ss%% > All Quassel clients vanished from the face of the earth... 23:20:34 Away since %%hh:mm%% on %%dd.MM%% - %%%% not here %%%% > Away since 23:20 on 21.05 - %% not here %%
Optionally include timestamp when entering away - In utils added function to find regexp format - Added formatting the away message in core - Tooltip update in client about possible away message format
Bring copyright headers into 2016 That took some time...
Happy New Year!