X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.h;h=3bb1a45bf0feec7a45b6155caee44aca25f962a2;hp=8745d117b62a9e4c1c2d11e712d682b6c7f895ae;hb=f824db0e31b54969e0b7fa0b5405b1e9173d482c;hpb=7e051ca7bf165df865b61fe07a80699e5ea0503e diff --git a/src/uisupport/uistyle.h b/src/uisupport/uistyle.h index 8745d117..3bb1a45b 100644 --- a/src/uisupport/uistyle.h +++ b/src/uisupport/uistyle.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -31,7 +31,7 @@ #include "settings.h" class UiStyle { - Q_DECLARE_TR_FUNCTIONS (UiStyle); + Q_DECLARE_TR_FUNCTIONS(UiStyle) public: UiStyle(const QString &settingsKey); @@ -122,14 +122,11 @@ class UiStyle { FormatList formatList; // starting pos, ftypes }; - struct StyledMessage { - StyledString timestamp; - StyledString sender; - StyledString contents; - }; + class StyledMessage; 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; @@ -147,7 +144,6 @@ class UiStyle { private: - QString mircToInternal(const QString &); QFont _defaultFont; QTextCharFormat _defaultPlainFormat; @@ -160,9 +156,33 @@ class UiStyle { QString _settingsKey; }; +class UiStyle::StyledMessage { + + public: + explicit StyledMessage(const Message &, UiStyle *style); + + QDateTime timestamp() const; + QString decoratedTimestamp() const; + QString sender() const; //!< Nickname (no decorations) for Plain and Notice, empty else + QString decoratedSender() const; + QString contents() const; + + FormatType timestampFormat() const; + FormatType senderFormat() const; + FormatList contentsFormatList() const; + + inline Message::Type type() const { return _msgType; } + + private: + StyledString _contents; + QDateTime _timestamp; + QString _sender; + Message::Type _msgType; +}; + QDataStream &operator<<(QDataStream &out, const UiStyle::FormatList &formatList); QDataStream &operator>>(QDataStream &in, UiStyle::FormatList &formatList); -Q_DECLARE_METATYPE(UiStyle::FormatList); +Q_DECLARE_METATYPE(UiStyle::FormatList) #endif