X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=75524db86c84dcb65ef6a30013d204465420bc66;hb=3f354bcce2cecfe88a46de90cbf94ffd1bc7c506;hp=d020bb05d3cb96482cf8f3e042348e11e50013fb;hpb=eb3bfb3d7909160b3b34995d074d0bacb7ae77c0;p=quassel.git diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index d020bb05..75524db8 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -102,17 +102,14 @@ void UiStyle::loadStyleSheet() { QssParser parser; parser.processStyleSheet(styleSheet); QApplication::setPalette(parser.palette()); - _uiStylePalette = parser.uiStylePalette(); - QTextCharFormat baseFmt = parser.formats().value(Base); - foreach(quint64 fmtType, parser.formats().keys()) { - QTextCharFormat fmt = baseFmt; - fmt.merge(parser.formats().value(fmtType)); - _formats[fmtType] = fmt; - } + _uiStylePalette = parser.uiStylePalette(); + _formats = parser.formats(); _listItemFormats = parser.listItemFormats(); - qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application + styleSheet = styleSheet.trimmed(); + if(!styleSheet.isEmpty()) + qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application } emit changed(); @@ -352,7 +349,7 @@ void UiStyle::mergeFormat(QTextCharFormat &fmt, quint32 ftype, quint64 label) { // URL if(ftype & Url) - mergeSubElementFormat(fmt, ftype & Url, label); + mergeSubElementFormat(fmt, ftype & (Url | 0x000000ff), label); } // Merge a subelement format into an existing message format @@ -455,10 +452,10 @@ UiStyle::StyledString UiStyle::styleString(const QString &s_, quint32 baseFormat color &= 0x0f; if(s[pos+3] == 'f') { curfmt &= 0xf0ffffff; - curfmt |= (color << 24) | 0x00400000; + curfmt |= (quint32)(color << 24) | 0x00400000; } else { curfmt &= 0x0fffffff; - curfmt |= (color << 28) | 0x00800000; + curfmt |= (quint32)(color << 28) | 0x00800000; } length = 6; } @@ -692,7 +689,7 @@ quint8 UiStyle::StyledMessage::senderHash() const { QString nick = nickFromMask(sender()).toLower(); if(!nick.isEmpty()) { int chopCount = 0; - while(nick.at(nick.count() - 1 - chopCount) == '_') + while(chopCount < nick.size() && nick.at(nick.count() - 1 - chopCount) == '_') chopCount++; if(chopCount < nick.size()) nick.chop(chopCount);