Quassel now handles even huge ChatScenes without slowing to a crawl.
[quassel.git] / src / qtui / chatscene.h
index 4dc415b..a0bcefc 100644 (file)
 
 #include <QGraphicsScene>
 
+#include "messagemodel.h"
+
 class AbstractUiMsg;
 class Buffer;
+class ChatItem;
 class ChatLine;
 class QGraphicsSceneMouseEvent;
 
@@ -32,22 +35,27 @@ class ChatScene : public QGraphicsScene {
   Q_OBJECT
 
   public:
-    ChatScene(Buffer *buffer, QObject *parent);
+    ChatScene(MessageModel *model, QObject *parent);
     virtual ~ChatScene();
 
     Buffer *buffer() const;
+    inline MessageModel *model() const { return _model; }
 
   public slots:
+    void setWidth(int);
 
-  protected slots:
-    void appendMsg(AbstractUiMsg *msg);
-    void prependMsg(AbstractUiMsg *msg);
+  signals:
+    void heightChanged(int height);
 
+  protected slots:
+    void rowsInserted(const QModelIndex &, int, int);
     void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent );
 
   private:
-    Buffer *_buffer;
-    QList<ChatLine*> _lines;
+    int _width, _height;
+    int _timestampWidth, _senderWidth;
+    MessageModel *_model;
+    QList<ChatLine *> _lines;
 
 };