+signals:
+ void lastLineChanged(QGraphicsItem *item, qreal offset);
+ void layoutChanged(); // indicates changes to the scenerect due to resizing of the contentsitems
+ void mouseMoveWhileSelecting(const QPointF &scenePos);
+
+protected:
+ virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
+ virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent);
+ virtual void handleClick(Qt::MouseButton button, const QPointF &scenePos);
+
+protected slots:
+ void rowsInserted(const QModelIndex &, int, int);
+ void rowsAboutToBeRemoved(const QModelIndex &, int, int);
+ void dataChanged(const QModelIndex &, const QModelIndex &);
+
+private slots:
+ void firstHandlePositionChanged(qreal xpos);
+ void secondHandlePositionChanged(qreal xpos);
+#ifdef HAVE_WEBKIT
+ void webPreviewNextStep();
+#endif
+ void showWebPreviewChanged();
+
+ void rowsRemoved();
+
+ void clickTimeout();
+
+private:
+ void setHandleXLimits();
+ void updateSelection(const QPointF &pos);
+
+ ChatView *_chatView;
+ QString _idString;
+ QAbstractItemModel *_model;
+ QList<ChatLine *> _lines;
+ BufferId _singleBufferId;
+
+ // calls to QChatScene::sceneRect() are very expensive. As we manage the scenerect ourselves
+ // we store the size in a member variable.
+ QRectF _sceneRect;
+ int _firstLineRow; // the first row to display (aka: not a daychange msg)
+ void updateSceneRect(qreal width);
+ inline void updateSceneRect() { updateSceneRect(_sceneRect.width()); }
+ void updateSceneRect(const QRectF &rect);
+ qreal _viewportHeight;
+
+ MarkerLineItem *_markerLine;
+ bool _markerLineVisible, _markerLineValid, _markerLineJumpPending;
+
+ ColumnHandleItem *_firstColHandle, *_secondColHandle;
+ qreal _firstColHandlePos, _secondColHandlePos;
+ int _defaultFirstColHandlePos, _defaultSecondColHandlePos;
+ CutoffMode _cutoffMode;
+
+ ChatItem *_selectingItem;
+ int _selectionStartCol, _selectionMinCol;
+ int _selectionStart;
+ int _selectionEnd;
+ int _firstSelectionRow;
+ bool _isSelecting;
+
+ QTimer _clickTimer;
+ ClickMode _clickMode;
+ QPointF _clickPos;
+ bool _clickHandled;
+ bool _leftButtonPressed;
+
+ bool _showWebPreview;
+
+ static const int _webSearchSelectionTextMaxVisible = 24;
+
+#ifdef HAVE_WEBKIT
+ struct WebPreview {
+ enum PreviewState {
+ NoPreview,
+ NewPreview,
+ DelayPreview,
+ ShowPreview,
+ HidePreview
+ };
+ ChatItem *parentItem;
+ QGraphicsItem *previewItem;
+ QUrl url;
+ QRectF urlRect;
+ PreviewState previewState;
+ QTimer timer;
+ WebPreview() : parentItem(0), previewItem(0), previewState(NoPreview) {}
+ };
+ WebPreview webPreview;
+#endif // HAVE_WEBKIT