+ QTextCharFormat format(quint64 key) const;
+ QTextCharFormat cachedFormat(quint32 formatType, quint32 messageLabel) const;
+ void setCachedFormat(const QTextCharFormat &format, quint32 formatType, quint32 messageLabel) const;
+ void mergeFormat(QTextCharFormat &format, quint32 formatType, quint64 messageLabel) const;
+ void mergeSubElementFormat(QTextCharFormat &format, quint32 formatType, quint64 messageLabel) const;
+
+ static FormatType formatType(const QString &code);
+ static QString formatCode(FormatType);
+ static void setTimestampFormatString(const QString &format);
+ /**
+ * Updates the local setting cache of whether or not to show sender brackets
+ *
+ * @param[in] enabled If true, sender brackets are enabled, otherwise false.
+ */
+ static void enableSenderBrackets(bool enabled);
+
+ QVariant itemData(int role, const QTextCharFormat &format) const;
+
+private slots:
+ void allowMircColorsChanged(const QVariant &);
+ void showItemViewIconsChanged(const QVariant &);
+
+private:
+ QVector<QBrush> _uiStylePalette;
+ QBrush _markerLineBrush;
+ QHash<quint64, QTextCharFormat> _formats;
+ mutable QHash<quint64, QTextCharFormat> _formatCache;
+ mutable QHash<quint64, QFontMetricsF *> _metricsCache;
+ QHash<quint32, QTextCharFormat> _listItemFormats;
+ static QHash<QString, FormatType> _formatCodes;
+ static QString _timestampFormatString;
+ static bool _showSenderBrackets; /// If true, show brackets around sender names
+
+ QIcon _channelJoinedIcon;
+ QIcon _channelPartedIcon;
+ QIcon _userOfflineIcon;
+ QIcon _userOnlineIcon;
+ QIcon _userAwayIcon;
+ QIcon _categoryOpIcon;
+ QIcon _categoryVoiceIcon;
+ int _opIconLimit;
+ int _voiceIconLimit;
+ bool _showNickViewIcons;
+ bool _showBufferViewIcons;
+ bool _allowMircColors;
+};
+
+
+class UiStyle::StyledMessage : public Message
+{
+ Q_DECLARE_TR_FUNCTIONS(UiStyle::StyledMessage)
+
+public:
+ explicit StyledMessage(const Message &message);
+
+ QString decoratedTimestamp() const;
+ QString plainSender() const; //!< Nickname (no decorations) for Plain and Notice, empty else
+ QString decoratedSender() const;
+ const QString &plainContents() const;
+
+ const FormatList &contentsFormatList() const;
+
+ quint8 senderHash() const;
+
+protected:
+ void style() const;
+
+private:
+ mutable StyledString _contents;
+ mutable quint8 _senderHash;