X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.h;h=098800cd5a3d85272dac6d2753b0c507606bab60;hb=e8cf454ed97b2f2785438377dfcf4386dc273fb9;hp=57e8988b65cd537b741992cf81d19368f6d65ccd;hpb=90eb5244fb07eb2371279c12266fca06d0fed23c;p=quassel.git diff --git a/src/uisupport/uistyle.h b/src/uisupport/uistyle.h index 57e8988b..098800cd 100644 --- a/src/uisupport/uistyle.h +++ b/src/uisupport/uistyle.h @@ -64,11 +64,6 @@ public: RenameMsg = 0x00000009, ModeMsg = 0x0000000a, ActionMsg = 0x0000000b, - HighlightMsg = 0x0000000f, - - // Note: mergedFormat() assumes that 0x10 - 0x80 are *only* used within the message contents, - // e.g. not together with any of 0x0100-0x2000! - // If we happen to find a use case for that, we can see if/how to implement that though. // Standard Formats Bold = 0x00000010, @@ -85,7 +80,7 @@ public: ModeFlags = 0x00002000, // URL is special, we want that to take precedence over the rest... - Url = 0x00100000, + Url = 0x00080000, // mIRC Colors - we assume those to be present only in plain contents FgCol00 = 0x00400000, @@ -149,6 +144,10 @@ public: SenderColSelf = 0xff000200 }; + enum MessageLabel { + Highlight = 0x00000001 + }; + struct StyledString { QString plainText; FormatList formatList; // starting pos, ftypes @@ -160,11 +159,16 @@ public: StyledString styleString(const QString &); QString mircToInternal(const QString &) const; - void setFormat(FormatType, QTextCharFormat, Settings::Mode mode/* = Settings::Custom*/); - void setSenderAutoColor(bool state); - QTextCharFormat format(FormatType, Settings::Mode mode = Settings::Custom) const; - QTextCharFormat mergedFormat(quint32 formatType); - QFontMetricsF *fontMetrics(quint32 formatType); + void setFormat(FormatType, QTextCharFormat, Settings::Mode mode/* = Settings::Custom*/); // FIXME go away + void setSenderAutoColor(bool state); // FIXME go away + QTextCharFormat format(FormatType, Settings::Mode mode = Settings::Custom) const; // FIXME go away + + QTextCharFormat cachedFormat(quint64 key) const; + QTextCharFormat cachedFormat(quint32 formatType, quint32 messageLabel = 0) const; + void setCachedFormat(const QTextCharFormat &format, quint32 formatType, quint32 messageLabel = 0); + + QTextCharFormat mergedFormat(quint32 formatType, quint32 messageLabel = 0); + QFontMetricsF *fontMetrics(quint32 formatType, quint32 messageLabel = 0); FormatType formatType(const QString &code) const; QString formatCode(FormatType) const; @@ -176,6 +180,12 @@ public: protected: void loadStyleSheet(); + //! Determines the format set to be used for the given hostmask + //int formatSetIndex(const QString &hostmask) const; + //int formatSetIndexForSelf() const; + + void mergeSubElementFormat(QTextCharFormat &format, quint32 formatType, quint32 messageLabel = 0); + bool _senderAutoColor; private: @@ -183,8 +193,8 @@ private: QTextCharFormat _defaultPlainFormat; QHash _defaultFormats; QHash _customFormats; - QHash _cachedFormats; - QHash _cachedFontMetrics; + QHash _formatCache; + QHash _metricsCache; QHash _formatCodes; QString _settingsKey; @@ -249,7 +259,7 @@ protected: // Parse basic data types QBrush parseBrushValue(const QString &str); QColor parseColorValue(const QString &str); - QFont parseFont(const QString &str); + QFont parseFontValue(const QString &str); // Parse subelements ColorTuple parseColorTuple(const QString &str);