virtual inline QVector<QTextLayout::FormatRange> additionalFormats() const { return QVector<QTextLayout::FormatRange>(); }
qint16 posToCursor(const QPointF &pos);
- inline void ChatItem::setPrivateData(ChatItemPrivate *data) { Q_ASSERT(!_data); _data = data; }
- inline ChatItemPrivate *ChatItem::privateData() const;
+ inline void setPrivateData(ChatItemPrivate *data) { Q_ASSERT(!_data); _data = data; }
+ inline ChatItemPrivate *privateData() const;
// WARNING: setGeometry and setHeight should not be used without either:
// a) calling prepareGeometryChange() immediately before setColumns()
};
struct ContentsChatItemPrivate : ChatItemPrivate {
+ ContentsChatItem *contentsItem;
QList<ContentsChatItem::Clickable> clickables;
ContentsChatItem::Clickable currentClickable;
bool hasDragged;
- ContentsChatItemPrivate(QTextLayout *l, const QList<ContentsChatItem::Clickable> &c) : ChatItemPrivate(l), clickables(c), hasDragged(false) {}
+ ContentsChatItemPrivate(QTextLayout *l, const QList<ContentsChatItem::Clickable> &c, ContentsChatItem *parent) : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false), controller(0) {}
+ ~ContentsChatItemPrivate();
+
+ void loadWebPreview(const QString &url, const QRectF &urlRect);
+ void clearPreview();
+
+private:
+ class PreviewController;
+ class PreviewItem;
+ PreviewController *controller;
+};
+
+class ContentsChatItemPrivate::PreviewController : public QObject {
+ Q_OBJECT
+public:
+ PreviewController(ContentsChatItem *contentsItem) : contentsItem(contentsItem), previewItem(0) {}
+ ~PreviewController();
+
+ void loadPage(const QString &url, const QRectF &urlRect);
+
+private slots:
+ void pageLoaded(bool success);
+
+private:
+ ContentsChatItem *contentsItem;
+ ContentsChatItemPrivate::PreviewItem *previewItem;
+
+ QString url;
+};
+
+class QWebView;
+class ContentsChatItemPrivate::PreviewItem : public QGraphicsItem {
+public:
+ PreviewItem(QWebView *webView);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ virtual inline QRectF boundingRect() const { return _boundingRect; }
+
+private:
+ QRectF _boundingRect;
};
//inlines regarding ContentsChatItemPrivate
qint16 wordidx;
qint16 lineCount;
qreal choppedTrailing;
- qint16 lastwrapcol;
- qreal lastwrappos;
- qreal width;
};
/*************************************************************************************************/