fixing a bug where quit messages from different networks were shown if the user has...
[quassel.git] / src / qtui / chatitem.h
index 51b59f9..996cb43 100644 (file)
@@ -69,7 +69,9 @@ protected:
 
   inline QTextLayout *layout() const;
 
+  virtual QTextLayout::FormatRange selectionFormat() const;
   virtual inline QVector<QTextLayout::FormatRange> additionalFormats() const { return QVector<QTextLayout::FormatRange>(); }
+
   qint16 posToCursor(const QPointF &pos);
 
   inline bool hasPrivateData() const { return (bool)_data; }
@@ -83,8 +85,12 @@ protected:
     _boundingRect.setWidth(width);
     _boundingRect.setHeight(height);
   }
-  inline void setHeight(const qreal &height) { _boundingRect.setHeight(height); }
-  inline void setWidth(const qreal &width) { _boundingRect.setWidth(width); }
+  inline void setHeight(const qreal &height) {
+    _boundingRect.setHeight(height);
+  }
+  inline void setWidth(const qreal &width) {
+    _boundingRect.setWidth(width);
+  }
 
 private:
   // internal selection stuff
@@ -133,7 +139,8 @@ public:
   virtual inline ChatLineModel::ColumnType column() const { return ChatLineModel::SenderColumn; }
 
 protected:
-  virtual inline ChatItemPrivate *newPrivateData() { return new ChatItemPrivate(createLayout(QTextOption::WrapAnywhere, Qt::AlignRight)); }
+  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+  virtual inline ChatItemPrivate *newPrivateData() { return new ChatItemPrivate(createLayout(QTextOption::ManualWrap, Qt::AlignRight)); }
 };
 
 // ************************************************************
@@ -155,6 +162,9 @@ protected:
   virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
   virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
   virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
+  virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+
+
 
   virtual QVector<QTextLayout::FormatRange> additionalFormats() const;
 
@@ -172,10 +182,6 @@ private:
   void showWebPreview(const Clickable &click);
   void clearWebPreview();
 
-
-  // WARNING: setGeometry and setHeight should not be used without either:
-  //  a) calling prepareGeometryChange() immediately before setColumns()
-  //  b) calling Chatline::setPos() immediately afterwards
   qreal setGeometryByWidth(qreal w);
   friend class ChatLine;
   friend struct ContentsChatItemPrivate;
@@ -207,7 +213,8 @@ struct ContentsChatItemPrivate : ChatItemPrivate {
   ContentsChatItem::Clickable currentClickable;
   bool hasDragged;
 
-  ContentsChatItemPrivate(QTextLayout *l, const QList<ContentsChatItem::Clickable> &c, ContentsChatItem *parent) : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false) {}
+  ContentsChatItemPrivate(QTextLayout *l, const QList<ContentsChatItem::Clickable> &c, ContentsChatItem *parent)
+  : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false) {}
 };
 
 //inlines regarding ContentsChatItemPrivate