X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fqssparser.cpp;h=30a8fdd9ed995cd26201c5aef9a51c44bb631787;hb=a04eac3ffa53cb9eea9ebc46ea67a958f0269220;hp=237533bfb8dc8b10823e41732a08f2a0a7c7e2e3;hpb=5b686746c880e5cda6d5de3e08180ea4332ff222;p=quassel.git diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index 237533bf..30a8fdd9 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -23,7 +23,6 @@ #include "qssparser.h" QssParser::QssParser() - : _maxSenderHash(0) { _palette = QApplication::palette(); @@ -464,7 +463,21 @@ QBrush QssParser::parseBrush(const QString &str, bool *ok) } if (str.startsWith("palette")) { // Palette color role - QRegExp rx("palette\\s*\\(\\s*([a-z-]+)\\s*\\)"); + // Does the palette follow the expected format? For example: + // palette(marker-line) + // palette ( system-color-0f ) + // + // Match the palette marker, grabbing the name inside in case-sensitive manner + // palette\s*\(\s*([a-z-0-9]+)\s*\) + // palette Match the string 'palette' + // \s* Match any amount of whitespace + // \(, \) Match literal '(' or ')' marks + // (...+) Match contents between 1 and unlimited number of times + // [a-z-] Match any character from a-z, case sensitive + // [0-9] Match any digit from 0-9 + // Note that '\' must be escaped as '\\' + // Helpful interactive website for debugging and explaining: https://regex101.com/ + QRegExp rx("palette\\s*\\(\\s*([a-z-0-9]+)\\s*\\)"); if (!rx.exactMatch(str)) { qWarning() << Q_FUNC_INFO << tr("Invalid palette color role specification: %1").arg(str); return QBrush();