- StyledString styleString(const QString &);
- StyledMessage styleMessage(const Message &);
- QString mircToInternal(const QString &) const;
-
- void setFormat(FormatType, QTextCharFormat, Settings::Mode mode/* = Settings::Custom*/);
- QTextCharFormat format(FormatType, Settings::Mode mode = Settings::Custom) const;
- QTextCharFormat mergedFormat(quint32 formatType);
- QFontMetricsF *fontMetrics(quint32 formatType);
-
- FormatType formatType(const QString &code) const;
- QString formatCode(FormatType) const;
-
- inline QFont defaultFont() const { return _defaultFont; }
-
- QList<QTextLayout::FormatRange> toTextLayoutList(const FormatList &, int textLength);
-
- protected:
-
-
- private:
-
- QFont _defaultFont;
- QTextCharFormat _defaultPlainFormat;
- QHash<FormatType, QTextCharFormat> _defaultFormats;
- QHash<FormatType, QTextCharFormat> _customFormats;
- QHash<quint32, QTextCharFormat> _cachedFormats;
- QHash<quint32, QFontMetricsF *> _cachedFontMetrics;
- QHash<QString, FormatType> _formatCodes;
-
- QString _settingsKey;
+ static FormatType formatType(Message::Type msgType);
+ static StyledString styleString(const QString &string, quint32 baseFormat = Base);
+ static QString mircToInternal(const QString &);
+ static inline QString timestampFormatString() { return _timestampFormatString; }
+
+ QTextCharFormat format(quint32 formatType, quint32 messageLabel) const;
+ QFontMetricsF *fontMetrics(quint32 formatType, quint32 messageLabel) const;
+
+ QList<QTextLayout::FormatRange> toTextLayoutList(const FormatList &, int textLength, quint32 messageLabel) const;
+
+ inline const QBrush &brush(ColorRole role) const { return _uiStylePalette.at((int)role); }
+ inline void setBrush(ColorRole role, const QBrush &brush) { _uiStylePalette[(int)role] = brush; }
+
+ QVariant bufferViewItemData(const QModelIndex &networkModelIndex, int role) const;
+ QVariant nickViewItemData(const QModelIndex &networkModelIndex, int role) const;
+
+public slots:
+ void reload();
+
+signals:
+ void changed();
+
+protected:
+ void loadStyleSheet();
+ QString loadStyleSheet(const QString &name, bool shouldExist = false);
+
+ 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);
+
+ 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;
+
+ QPixmap _channelJoinedIcon;
+ QPixmap _channelPartedIcon;
+ QPixmap _userOfflineIcon;
+ QPixmap _userOnlineIcon;
+ QPixmap _userAwayIcon;
+ QPixmap _categoryOpIcon;
+ QPixmap _categoryVoiceIcon;
+ int _opIconLimit;
+ int _voiceIconLimit;
+ bool _showNickViewIcons;
+ bool _showBufferViewIcons;
+ bool _allowMircColors;