X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fqssparser.cpp;h=61679d9505883f3975fa8b60afdd7453f4f6c1ee;hp=d1a13e8f96e233fbd203cbca73df341539663b43;hb=98144aaad0cd747f186edcd0e36a1d67326ac766;hpb=b12b02f1bd5ee8a68bda20622b7ec3eac84f000c diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index d1a13e8f..61679d95 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -293,6 +293,8 @@ std::pair QssParser::parseFormatType label |= MessageLabel::Highlight; else if (condValue == "selected") label |= MessageLabel::Selected; + else if (condValue == "hovered") + label |= MessageLabel::Hovered; else { qWarning() << Q_FUNC_INFO << tr("Invalid message label: %1").arg(condValue); return invalid; @@ -322,8 +324,8 @@ std::pair QssParser::parseFormatType fmtType |= FormatType::Italic; else if (condValue == "underline") fmtType |= FormatType::Underline; - else if (condValue == "reverse") - fmtType |= FormatType::Reverse; + else if (condValue == "strikethrough") + fmtType |= FormatType::Strikethrough; else { qWarning() << Q_FUNC_INFO << tr("Invalid format name: %1").arg(condValue); return invalid; @@ -628,7 +630,7 @@ QColor QssParser::parseColor(const QString &str) if (str.startsWith("rgba")) { ColorTuple tuple = parseColorTuple(str.mid(4)); if (tuple.count() == 4) - return QColor(tuple.at(0), tuple.at(1), tuple.at(2), tuple.at(3)); + return QColor(tuple.at(0), tuple.at(1), tuple.at(2), tuple.at(3)); // NOLINT(modernize-return-braced-init-list) } else if (str.startsWith("rgb")) { ColorTuple tuple = parseColorTuple(str.mid(3)); @@ -715,21 +717,28 @@ QGradientStops QssParser::parseGradientStops(const QString &str_) void QssParser::parseFont(const QString &value, QTextCharFormat *format) { - static const QRegExp rx("((?:(?:normal|italic|oblique|underline|bold|100|200|300|400|500|600|700|800|900) ){0,2}) ?(\\d+)(pt|px)? \"(.*)\""); + static const QRegExp rx("((?:(?:normal|italic|oblique|underline|strikethrough|bold|100|200|300|400|500|600|700|800|900) ){0,2}) ?(\\d+)(pt|px)? \"(.*)\""); if (!rx.exactMatch(value)) { qWarning() << Q_FUNC_INFO << tr("Invalid font specification: %1").arg(value); return; } format->setFontItalic(false); + format->setFontUnderline(false); + format->setFontStrikeOut(false); format->setFontWeight(QFont::Normal); QStringList proplist = rx.cap(1).split(' ', QString::SkipEmptyParts); foreach(QString prop, proplist) { - if (prop == "italic") + if (prop == "normal") + ; // pass + else if (prop == "italic") format->setFontItalic(true); else if (prop == "underline") format->setFontUnderline(true); - //else if(prop == "oblique") - // format->setStyle(QFont::StyleOblique); + else if (prop == "strikethrough") + format->setFontStrikeOut(true); + else if(prop == "oblique") + // Oblique is not a property supported by QTextCharFormat + format->setFontItalic(true); else if (prop == "bold") format->setFontWeight(QFont::Bold); else { // number @@ -755,8 +764,11 @@ void QssParser::parseFontStyle(const QString &value, QTextCharFormat *format) format->setFontItalic(true); else if (value == "underline") format->setFontUnderline(true); - //else if(value == "oblique") - // format->setStyle(QFont::StyleOblique); + else if (value == "strikethrough") + format->setFontStrikeOut(true); + else if(value == "oblique") + // Oblique is not a property supported by QTextCharFormat + format->setFontItalic(true); else { qWarning() << Q_FUNC_INFO << tr("Invalid font style specification: %1").arg(value); }