X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fuisupport%2Fqssparser.cpp;h=50c8c3212899767c0a92b4b155d504af99455de1;hb=efee441a243efb88929e1e275d71ee27991bf074;hp=e40fe15e7643f6414710410f88fe052f962f9a51;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce;p=quassel.git diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index e40fe15e..50c8c321 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -1,29 +1,28 @@ /*************************************************************************** -* Copyright (C) 2005-09 by the Quassel Project * -* devel@quassel-irc.org * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) version 3. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ + * Copyright (C) 2005-2016 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ #include #include "qssparser.h" QssParser::QssParser() - : _maxSenderHash(0) { _palette = QApplication::palette(); @@ -53,6 +52,24 @@ QssParser::QssParser() _uiStylePalette = QVector(UiStyle::NumRoles, QBrush()); _uiStyleColorRoles["marker-line"] = UiStyle::MarkerLine; + // Sender colors + _uiStyleColorRoles["sender-color-self"] = UiStyle::SenderColorSelf; + _uiStyleColorRoles["sender-color-00"] = UiStyle::SenderColor00; + _uiStyleColorRoles["sender-color-01"] = UiStyle::SenderColor01; + _uiStyleColorRoles["sender-color-02"] = UiStyle::SenderColor02; + _uiStyleColorRoles["sender-color-03"] = UiStyle::SenderColor03; + _uiStyleColorRoles["sender-color-04"] = UiStyle::SenderColor04; + _uiStyleColorRoles["sender-color-05"] = UiStyle::SenderColor05; + _uiStyleColorRoles["sender-color-06"] = UiStyle::SenderColor06; + _uiStyleColorRoles["sender-color-07"] = UiStyle::SenderColor07; + _uiStyleColorRoles["sender-color-08"] = UiStyle::SenderColor08; + _uiStyleColorRoles["sender-color-09"] = UiStyle::SenderColor09; + _uiStyleColorRoles["sender-color-0a"] = UiStyle::SenderColor0a; + _uiStyleColorRoles["sender-color-0b"] = UiStyle::SenderColor0b; + _uiStyleColorRoles["sender-color-0c"] = UiStyle::SenderColor0c; + _uiStyleColorRoles["sender-color-0d"] = UiStyle::SenderColor0d; + _uiStyleColorRoles["sender-color-0e"] = UiStyle::SenderColor0e; + _uiStyleColorRoles["sender-color-0f"] = UiStyle::SenderColor0f; } @@ -464,7 +481,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();