- fmt.merge(format(key & 0x0000ffffffffff00ull)); // label + subelement
- fmt.merge(format(key & 0x0000ffffffffffffull)); // label + subelement + msgtype
- fmt.merge(format(key & 0xffffffffffffff00ull)); // label + subelement + nickhash
- fmt.merge(format(key & 0xffffffffffffffffull)); // label + subelement + nickhash + msgtype
+ fmt.merge(parsedFormat(key & 0x0000ffffffffff00ull)); // label + subelement
+ fmt.merge(parsedFormat(key & 0x0000ffffffffffffull)); // label + subelement + msgtype
+ fmt.merge(parsedFormat(key & 0xffffffffffffff00ull)); // label + subelement + nickhash
+ fmt.merge(parsedFormat(key & 0xffffffffffffffffull)); // label + subelement + nickhash + msgtype
+}
+
+
+void UiStyle::mergeColors(QTextCharFormat &charFormat, const Format &format, MessageLabel label) const
+{
+ bool allowFg = charFormat.property(static_cast<int>(FormatProperty::AllowForegroundOverride)).toBool();
+ bool allowBg = charFormat.property(static_cast<int>(FormatProperty::AllowBackgroundOverride)).toBool();
+
+ // Classic mIRC colors (styleable)
+ // We assume that those can't be combined with subelement and message types.
+ if (allowFg && (format.type & 0x00400000) != FormatType::Base)
+ charFormat.merge(parsedFormat((format.type & 0x0f400000) | label)); // foreground
+ if (allowBg && (format.type & 0x00800000) != FormatType::Base)
+ charFormat.merge(parsedFormat((format.type & 0xf0800000) | label)); // background
+ if (allowFg && allowBg && (format.type & 0x00c00000) == static_cast<FormatType>(0x00c00000))
+ charFormat.merge(parsedFormat((format.type & 0xffc00000) | label)); // combination
+
+ // Extended mIRC colors (hardcoded)
+ if (allowFg && format.foreground.isValid())
+ charFormat.setForeground(format.foreground);
+ if (allowBg && format.background.isValid())
+ charFormat.setBackground(format.background);