From: Manuel Nickschas Date: Thu, 25 Jun 2009 17:49:40 +0000 (+0200) Subject: Remove C-style comment lines from stylesheets X-Git-Tag: 0.5-rc1~132 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5e4dd1ccc3277d871153ac3155b1d1443920f9b8;hp=04c923c596fbde976b23979b92b0636635f97951 Remove C-style comment lines from stylesheets We also now remove all sections we parse and handle from the stylesheet prior to handing it over to QApplication, so we can use incompatible extensions. --- diff --git a/src/uisupport/qssparser.cpp b/src/uisupport/qssparser.cpp index 91ecac5a..f46147b3 100644 --- a/src/uisupport/qssparser.cpp +++ b/src/uisupport/qssparser.cpp @@ -55,13 +55,17 @@ void QssParser::processStyleSheet(QString &ss) { if(ss.isEmpty()) return; - // Now we have the stylesheet itself in ss, start parsing + // Remove C-style comments /* */ or // + QRegExp commentRx("(//.*(\\n|$)|/\\*.*\\*/)"); + commentRx.setMinimal(true); + ss.remove(commentRx); + // Palette definitions first, so we can apply roles later on QRegExp paletterx("(Palette[^{]*)\\{([^}]+)\\}"); int pos = 0; while((pos = paletterx.indexIn(ss, pos)) >= 0) { parsePaletteData(paletterx.cap(1).trimmed(), paletterx.cap(2).trimmed()); - pos += paletterx.matchedLength(); + ss.remove(pos, paletterx.matchedLength()); } // Now we can parse the rest of our custom blocks @@ -75,9 +79,8 @@ void QssParser::processStyleSheet(QString &ss) { //else // TODO: add moar here - pos += blockrx.matchedLength(); + ss.remove(pos, blockrx.matchedLength()); } - } void QssParser::parseChatLineData(const QString &decl, const QString &contents) {