+ static FormatType formatType(const QString &code);
+ static QString formatCode(FormatType);
+
+ /**
+ * Cache the system locale timestamp format string
+ *
+ * Based on whether or not AM/PM designators are used in the QLocale::system().timeFormat(),
+ * this extends the system locale timestamp format string to include seconds.
+ *
+ * @see UiStyle::systemTimestampFormatString()
+ */
+ static void updateSystemTimestampFormat();
+
+ /**
+ * Updates the local setting cache of whether or not to use the custom timestamp format
+ *
+ * @param[in] enabled If true, custom timestamp format used, otherwise false
+ */
+ static void setUseCustomTimestampFormat(bool enabled);
+
+ /**
+ * Updates the local setting cache of the timestamp format string
+ *
+ * @param[in] format Timestamp format string
+ */
+ 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 bool _useCustomTimestampFormat; /// If true, use the custom timestamp format
+ static QString _systemTimestampFormatString; /// Cached copy of system locale timestamp format
+ static QString _timestampFormatString; /// Timestamp format string
+ 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;