Another Speed boost for the new ChatView.
[quassel.git] / src / qtui / chatscene.h
index f54869b..e0aaa50 100644 (file)
@@ -26,7 +26,7 @@
 #include <QSet>
 
 #include "columnhandleitem.h"
-
+#include "messagefilter.h"
 
 class AbstractUiMsg;
 class ChatItem;
@@ -47,12 +47,14 @@ public:
   int sectionByScenePos(int x);
   inline int sectionByScenePos(const QPoint &pos) { return sectionByScenePos(pos.x()); }
   inline bool isSingleBufferScene() const { return _singleBufferScene; }
+  inline bool containsBuffer(const BufferId &id) const;
   inline ChatLine *chatLine(int row) { return (row < _lines.count()) ? _lines[row] : 0; }
 
   inline ColumnHandleItem *firstColumnHandle() const { return firstColHandle; }
   inline ColumnHandleItem *secondColumnHandle() const { return secondColHandle; }
 
 public slots:
+  void updateForViewport(qreal width, qreal height);
   void setWidth(qreal, bool forceReposition = false);
 
   // these are used by the chatitems to notify the scene and manage selections
@@ -64,7 +66,7 @@ public slots:
   void requestBacklog();
 
 signals:
-  void sceneHeightChanged(qreal dh);
+  void lastLineChanged(QGraphicsItem *);
 
 protected:
   virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
@@ -92,6 +94,7 @@ private:
   // we store the size in a member variable.
   QRectF _sceneRect;
   void updateSceneRect(const QRectF &rect);
+  qreal _viewportHeight;
 
   ColumnHandleItem *firstColHandle, *secondColHandle;
   qreal firstColHandlePos, secondColHandlePos;
@@ -106,4 +109,12 @@ private:
   int _lastBacklogSize;
 };
 
+bool ChatScene::containsBuffer(const BufferId &id) const {
+  MessageFilter *filter = qobject_cast<MessageFilter*>(model());
+  if(filter)
+    return filter->containsBuffer(id);
+  else
+    return false;
+}
+
 #endif