Yearly copyright bump :)
[quassel.git] / src / uisupport / uistyle.h
index 70144c8..3bb1a45 100644 (file)
@@ -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,11 +122,7 @@ 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 &);
@@ -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