X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatscene.h;h=e0aaa500df894e79ffa1acead874652e1d144437;hb=076f0dd24b1bf78a0156cf1d3b5eda7dcf9f5fa0;hp=66026c1bc323b43ee98c7237097f8f0de05cdd20;hpb=62192fb6cd9cc211b5b9fe844c9b4c2f98f923cc;p=quassel.git diff --git a/src/qtui/chatscene.h b/src/qtui/chatscene.h index 66026c1b..e0aaa500 100644 --- a/src/qtui/chatscene.h +++ b/src/qtui/chatscene.h @@ -26,7 +26,7 @@ #include #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); @@ -88,6 +90,12 @@ private: QList _lines; bool _singleBufferScene; + // calls to QChatScene::sceneRect() are very expensive. As we manage the scenerect ourselves + // we store the size in a member variable. + QRectF _sceneRect; + void updateSceneRect(const QRectF &rect); + qreal _viewportHeight; + ColumnHandleItem *firstColHandle, *secondColHandle; qreal firstColHandlePos, secondColHandlePos; @@ -101,4 +109,12 @@ private: int _lastBacklogSize; }; +bool ChatScene::containsBuffer(const BufferId &id) const { + MessageFilter *filter = qobject_cast(model()); + if(filter) + return filter->containsBuffer(id); + else + return false; +} + #endif