X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.h;h=b6e8a9cf70b62933077467426a846d2f27879fac;hp=31fdd5eec7d8ec59bc1389cb268ecdbecf95ec85;hb=03d6711ea69594e8a4637b4ea20baeb9a109af9c;hpb=429f2aad1e22ba8410f4ea63471fcfc9887c55aa diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index 31fdd5ee..b6e8a9cf 100644 --- a/src/qtui/chatitem.h +++ b/src/qtui/chatitem.h @@ -74,8 +74,8 @@ protected: virtual inline QVector additionalFormats() const { return QVector(); } 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() @@ -197,11 +197,50 @@ struct ContentsChatItem::Clickable { }; struct ContentsChatItemPrivate : ChatItemPrivate { + ContentsChatItem *contentsItem; QList clickables; ContentsChatItem::Clickable currentClickable; bool hasDragged; - ContentsChatItemPrivate(QTextLayout *l, const QList &c) : ChatItemPrivate(l), clickables(c), hasDragged(false) {} + ContentsChatItemPrivate(QTextLayout *l, const QList &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 @@ -222,9 +261,6 @@ private: qint16 wordidx; qint16 lineCount; qreal choppedTrailing; - qint16 lastwrapcol; - qreal lastwrappos; - qreal width; }; /*************************************************************************************************/