Various fixes for the style engine
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 3 Aug 2009 22:53:58 +0000 (00:53 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Aug 2009 18:25:58 +0000 (20:25 +0200)
This should iron out the last remaining buggy corner cases. I hope.

src/qtui/qtuistyle.cpp
src/uisupport/qssparser.cpp
src/uisupport/uistyle.cpp

index 4086eed..f37b85e 100644 (file)
@@ -93,7 +93,7 @@ void QtUiStyle::generateSettingsQss() const {
 
   if(s.value("UseSenderColors").toBool()) {
     out << "// Sender Colors\n\n"
 
   if(s.value("UseSenderColors").toBool()) {
     out << "// Sender Colors\n\n"
-        << "ChatLine::sender[sender=\"self\"] { foreground: " << color("SenderSelf", s) << "; }\n\n";
+        << "ChatLine::sender#plain[sender=\"self\"] { foreground: " << color("SenderSelf", s) << "; }\n\n";
 
     for(int i = 0; i < 16; i++)
       out << senderQss(i, s);
 
     for(int i = 0; i < 16; i++)
       out << senderQss(i, s);
@@ -114,5 +114,5 @@ QString QtUiStyle::senderQss(int i, QtUiStyleSettings &settings) const {
   QString dez = QString::number(i);
   if(dez.length() == 1) dez.prepend('0');
 
   QString dez = QString::number(i);
   if(dez.length() == 1) dez.prepend('0');
 
-  return QString("ChatLine::sender[sender=\"0%1\"] { foreground: %2; }\n").arg(QString::number(i, 16), color("Sender"+dez, settings));
+  return QString("ChatLine::sender#plain[sender=\"0%1\"] { foreground: %2; }\n").arg(QString::number(i, 16), color("Sender"+dez, settings));
 }
 }
index 7200e58..d5b9984 100644 (file)
@@ -262,7 +262,7 @@ quint64 QssParser::parseFormatType(const QString &decl) {
               qWarning() << Q_FUNC_INFO << tr("Senderhash can be at most \"0x0f\"!");
               return UiStyle::Invalid;
             }
               qWarning() << Q_FUNC_INFO << tr("Senderhash can be at most \"0x0f\"!");
               return UiStyle::Invalid;
             }
-            fmtType |= val << 48;
+            fmtType |= ++val << 48;
           }
       } else if(condName == "format") {
         if(condValue == "bold")
           }
       } else if(condName == "format") {
         if(condValue == "bold")
index 1626c01..025c9d1 100644 (file)
@@ -87,6 +87,7 @@ void UiStyle::loadStyleSheet() {
   qDeleteAll(_metricsCache);
   _metricsCache.clear();
   _formatCache.clear();
   qDeleteAll(_metricsCache);
   _metricsCache.clear();
   _formatCache.clear();
+  _formats.clear();
 
   UiStyleSettings s;
 
 
   UiStyleSettings s;
 
@@ -335,7 +336,7 @@ void UiStyle::mergeFormat(QTextCharFormat &fmt, quint32 ftype, quint64 label) {
   if((ftype & 0xfff00)) { // element format
     for(quint32 mask = 0x00100; mask <= 0x40000; mask <<= 1) {
       if(ftype & mask) {
   if((ftype & 0xfff00)) { // element format
     for(quint32 mask = 0x00100; mask <= 0x40000; mask <<= 1) {
       if(ftype & mask) {
-        mergeSubElementFormat(fmt, mask | 0xff, label);
+        mergeSubElementFormat(fmt, ftype & (mask | 0xff), label);
       }
     }
   }
       }
     }
   }