X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.h;h=a163809b2acbd3e8c3c2b0d536e54497e92ed7e3;hp=c55aa1cddc7e66dee84b40d09691ea1e87c15450;hb=e47500c0800e92c59d504f3b62ee3bf715c0207e;hpb=76ff3775486d1f813d932adf38a53b45966eb274 diff --git a/src/uisupport/uistyle.h b/src/uisupport/uistyle.h index c55aa1cd..a163809b 100644 --- a/src/uisupport/uistyle.h +++ b/src/uisupport/uistyle.h @@ -102,10 +102,9 @@ public: class StyledMessage; - StyledString styleString(const QString &string, quint32 baseFormat = None); - QString mircToInternal(const QString &) const; - - FormatType formatType(Message::Type msgType) const; + static FormatType formatType(Message::Type msgType); + static StyledString styleString(const QString &string, quint32 baseFormat = None); + static QString mircToInternal(const QString &); QTextCharFormat format(quint32 formatType, quint32 messageLabel = 0); QFontMetricsF *fontMetrics(quint32 formatType, quint32 messageLabel = 0); @@ -126,34 +125,32 @@ protected: void setCachedFormat(const QTextCharFormat &format, quint32 formatType, quint32 messageLabel = 0); void mergeSubElementFormat(QTextCharFormat &format, quint32 formatType, quint32 messageLabel = 0); - FormatType formatType(const QString &code) const; - QString formatCode(FormatType) const; + static FormatType formatType(const QString &code); + static QString formatCode(FormatType); private: QFont _defaultFont; QHash _formatCache; QHash _metricsCache; - QHash _formatCodes; + static QHash _formatCodes; }; class UiStyle::StyledMessage : public Message { public: explicit StyledMessage(const Message &message); - //! Styling is only needed for calls to plainContents() and contentsFormatList() - // StyledMessage can't style lazily by itself, as it doesn't know the used style - bool inline needsStyling() const { return _contents.plainText.isNull(); } - void style(UiStyle *style) const; - - QString decoratedTimestamp() const; QString plainSender() const; //!< Nickname (no decorations) for Plain and Notice, empty else QString decoratedSender() const; - inline const QString &plainContents() const { return _contents.plainText; } + const QString &plainContents() const; inline FormatType timestampFormat() const { return UiStyle::Timestamp; } FormatType senderFormat() const; - inline const FormatList &contentsFormatList() const { return _contents.formatList; } + const FormatList &contentsFormatList() const; +protected: + //! Styling is only needed for calls to plainContents() and contentsFormatList() + void style() const; + private: mutable StyledString _contents;