using a shared buffer for QTextBoundaryFinder
[quassel.git] / src / qtui / chatscene.h
index 7bfd6eb..22dcb47 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <QAbstractItemModel>
 #include <QGraphicsScene>
+#include <QSet>
 
 class AbstractUiMsg;
 class Buffer;
@@ -41,14 +42,15 @@ class ChatScene : public QGraphicsScene {
 
     Buffer *buffer() const;
     inline QAbstractItemModel *model() const { return _model; }
+    inline QString idString() const { return _idString; }
 
   public slots:
     void setWidth(qreal);
 
-    // these are used by the chatitems to notify the scene
+    // these are used by the chatitems to notify the scene and manage selections
     void setSelectingItem(ChatItem *item);
     ChatItem *selectingItem() const { return _selectingItem; }
-    void startGlobalSelection(ChatItem *item);
+    void startGlobalSelection(ChatItem *item, const QPointF &itemPos);
 
   signals:
     void heightChanged(qreal height);
@@ -60,12 +62,16 @@ class ChatScene : public QGraphicsScene {
 
   protected slots:
     void rowsInserted(const QModelIndex &, int, int);
+    void modelReset();
 
   private slots:
     void rectChanged(const QRectF &);
     void handlePositionChanged(qreal xpos);
 
   private:
+    void updateSelection(const QPointF &pos);
+    QString selectionToString() const;
+
     QString _idString;
     qreal _width, _height;
     QAbstractItemModel *_model;
@@ -74,7 +80,12 @@ class ChatScene : public QGraphicsScene {
     ColumnHandleItem *firstColHandle, *secondColHandle;
     qreal firstColHandlePos, secondColHandlePos;
 
-    ChatItem *_selectingItem;
+    ChatItem *_selectingItem, *_lastItem;
+    QSet<ChatLine *> _selectedItems;
+    int _selectionStartCol, _selectionMinCol;
+    int _selectionStart;
+    int _selectionEnd;
+    bool _isSelecting;
 };
 
 #endif