+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);
+#if defined HAVE_WEBKIT || defined HAVE_WEBENGINE
+ void webPreviewNextStep();
+#endif
+ void showWebPreviewChanged();
+
+ /**
+ * Updates the local setting cache of whether or not to show sender brackets
+ */
+ void showSenderBracketsChanged();
+
+ /**
+ * Updates the local setting cache of whether or not to use the custom timestamp format
+ */
+ void useCustomTimestampFormatChanged();
+
+ /**
+ * Updates the local setting cache of the timestamp format string
+ */
+ void timestampFormatStringChanged();
+
+ /**
+ * Updates the status of whether or not the timestamp format string contains brackets
+ *
+ * When the timestamp contains brackets -and- showSenderBrackets is disabled, we need to
+ * automatically add brackets. This function checks if the timestamp has brackets and stores
+ * the result, rather than checking each time text is copied.
+ */
+ void updateTimestampHasBrackets();
+
+ 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;
+ /// Whether to re-add hidden brackets around sender for all message types
+ bool _alwaysBracketSender;
+
+ 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;
+
+ bool _showSenderBrackets; /// If true, show brackets around sender names
+
+ bool _useCustomTimestampFormat; /// If true, use the custom timestamp format
+ QString _timestampFormatString; /// Format of the timestamp string
+ bool _timestampHasBrackets; /// If true, timestamp format has [brackets] of some sort
+
+ static const int _webSearchSelectionTextMaxVisible = 24;
+
+#if defined HAVE_WEBKIT || defined HAVE_WEBENGINE
+ struct WebPreview {
+ enum PreviewState {
+ NoPreview,
+ NewPreview,
+ DelayPreview,
+ ShowPreview,
+ HidePreview
+ };
+ ChatItem *parentItem{nullptr};
+ QGraphicsItem *previewItem{nullptr};
+ QUrl url;
+ QRectF urlRect;
+ PreviewState previewState{NoPreview};
+ QTimer timer;
+ };
+ WebPreview webPreview;
+#endif // HAVE_WEBKIT || HAVE_WEBENGINE