Merge all stylesheet formats with the base format
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 29 Jul 2009 22:52:21 +0000 (00:52 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Aug 2009 18:25:58 +0000 (20:25 +0200)
src/uisupport/uistyle.cpp
src/uisupport/uistyle.h

index 6cfff50..1a478f2 100644 (file)
@@ -38,7 +38,7 @@ UiStyle::UiStyle(QObject *parent) : QObject(parent) {
   }
 
   // Now initialize the mapping between FormatCodes and FormatTypes...
-  _formatCodes["%O"] = None;
+  _formatCodes["%O"] = Base;
   _formatCodes["%B"] = Bold;
   _formatCodes["%S"] = Italic;
   _formatCodes["%U"] = Underline;
@@ -81,7 +81,13 @@ void UiStyle::loadStyleSheet() {
     QssParser parser;
     parser.processStyleSheet(styleSheet);
     QApplication::setPalette(parser.palette());
-    _formatCache = parser.formats();
+
+    QTextCharFormat baseFmt = parser.formats().value(Base);
+    foreach(quint64 fmtType, parser.formats().keys()) {
+      QTextCharFormat fmt = baseFmt;
+      fmt.merge(parser.formats().value(fmtType));
+      _formatCache[fmtType] = fmt;
+    }
 
     qApp->setStyleSheet(styleSheet); // pass the remaining sections to the application
   }
index 7e4094f..843d2f2 100644 (file)
@@ -49,7 +49,7 @@ public:
    *         Also, we _do_ rely on certain properties of these values in styleString() and friends!
    */
   enum FormatType {
-    None            = 0x00000000,
+    Base            = 0x00000000,
     Invalid         = 0xffffffff,
 
     // Message Formats (mutually exclusive!)
@@ -105,7 +105,7 @@ public:
   class StyledMessage;
 
   static FormatType formatType(Message::Type msgType);
-  static StyledString styleString(const QString &string, quint32 baseFormat = None);
+  static StyledString styleString(const QString &string, quint32 baseFormat = Base);
   static QString mircToInternal(const QString &);
   static inline QString timestampFormatString() { return _timestampFormatString; }