quassel no longer allocates an MessageItem on the heap for every message - working...
[quassel.git] / src / qtui / chatlinemodelitem.h
index 1018e99..d4979cd 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  *
 #ifndef CHATLINEMODELITEM_H_
 #define CHATLINEMODELITEM_H_
 
-#include <QVector>
-#include <QPair>
+#include "messagemodel.h"
 
-#include "chatlinemodel.h"
-#include "uistyle.h"
+class ChatLineModelItemPrivate;
 
 class ChatLineModelItem : public MessageModelItem {
-
-  public:
-
-    ChatLineModelItem(const Message &);
-    //virtual ~ChatLineModelItem() {};
-
-    virtual QVariant data(int column, int role) const;
-    virtual bool setData(int column, const QVariant &value, int role);
-
-  private:
-    void computeWrapList();
-s
-    struct ChatLinePart {
-      QString plainText;
-      UiStyle::FormatList formatList;
-    };
-    ChatLinePart _timestamp, _sender, _contents;
-
-    ChatLineModel::WrapList _wrapList;
+public:
+  ChatLineModelItem(const Message &);
+  ChatLineModelItem(const ChatLineModelItem &other);
+  ~ChatLineModelItem();
+
+  virtual QVariant data(int column, int role) const;
+
+  /// Used to store information about words to be used for wrapping
+  struct Word {
+    quint16 start;
+    qreal endX;
+    qreal width;
+    qreal trailing;
+  };
+  typedef QVector<Word> WrapList;
+
+private:
+  ChatLineModelItemPrivate *_data;
 };
 
 #endif