X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.h;h=f572bb441f6de9ac46e3e24a3db8213d69948ec6;hp=1686a9e17c2b0a001801ec57d2fdfaa3ec65fd7e;hb=e65e46d007d7f5f59274590dec3bc1d8e5f94e91;hpb=98f12cf014e5ef0b2f3827fb0b1e48931618d33c diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index 1686a9e1..f572bb44 100644 --- a/src/qtui/chatitem.h +++ b/src/qtui/chatitem.h @@ -197,12 +197,59 @@ 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) {} +#ifdef HAVE_WEBKIT + ContentsChatItemPrivate(QTextLayout *l, const QList &c, ContentsChatItem *parent) : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false), controller(0) {} +#else + ContentsChatItemPrivate(QTextLayout *l, const QList &c, ContentsChatItem *parent) : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false) {} +#endif + ~ContentsChatItemPrivate(); + +#ifdef HAVE_WEBKIT + void loadWebPreview(const QString &url, const QRectF &urlRect); + void clearPreview(); + +private: + class PreviewController; + class PreviewItem; + PreviewController *controller; +#endif //#ifdef HAVE_WEBKIT +}; + +#ifdef HAVE_WEBKIT +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; }; +#endif //#ifdef HAVE_WEBKIT //inlines regarding ContentsChatItemPrivate ContentsChatItemPrivate *ContentsChatItem::privateData() const { return (ContentsChatItemPrivate *)ChatItem::privateData(); } @@ -222,9 +269,6 @@ private: qint16 wordidx; qint16 lineCount; qreal choppedTrailing; - qint16 lastwrapcol; - qreal lastwrappos; - qreal width; }; /*************************************************************************************************/