projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use QtWebEngine instead of QtWebKit if available
[quassel.git]
/
src
/
qtui
/
webpreviewitem.cpp
diff --git
a/src/qtui/webpreviewitem.cpp
b/src/qtui/webpreviewitem.cpp
index
99bb553
..
4941fa2
100644
(file)
--- a/
src/qtui/webpreviewitem.cpp
+++ b/
src/qtui/webpreviewitem.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-201
4
by the Quassel Project *
+ * Copyright (C) 2005-201
6
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-20,12
+20,18
@@
#include "webpreviewitem.h"
#include "webpreviewitem.h"
-#ifdef HAVE_WEBKIT
+#ifdef HAVE_WEBENGINE
+#include <QWebEngineView>
+#include <QWebEngineSettings>
+#elif defined HAVE_WEBKIT
+#include <QWebView>
+#include <QWebSettings>
+#endif
+
+#if defined HAVE_WEBKIT || defined HAVE_WEBENGINE
#include <QGraphicsProxyWidget>
#include <QPainter>
#include <QGraphicsProxyWidget>
#include <QPainter>
-#include <QWebView>
-#include <QWebSettings>
WebPreviewItem::WebPreviewItem(const QUrl &url)
: QGraphicsItem(0), // needs to be a top level item as we otherwise cannot guarantee that it's on top of other chatlines
WebPreviewItem::WebPreviewItem(const QUrl &url)
: QGraphicsItem(0), // needs to be a top level item as we otherwise cannot guarantee that it's on top of other chatlines
@@
-33,8
+39,13
@@
WebPreviewItem::WebPreviewItem(const QUrl &url)
{
qreal frameWidth = 5;
{
qreal frameWidth = 5;
+#ifdef HAVE_WEBENGINE
+ QWebEngineView *webView = new QWebEngineView;
+ webView->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
+#elif defined HAVE_WEBKIT
QWebView *webView = new QWebView;
webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
QWebView *webView = new QWebView;
webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
+#endif
webView->load(url);
webView->setDisabled(true);
webView->resize(1000, 750);
webView->load(url);
webView->setDisabled(true);
webView->resize(1000, 750);
@@
-44,7
+55,7
@@
WebPreviewItem::WebPreviewItem(const QUrl &url)
qreal xScale = (_boundingRect.width() - 2 * frameWidth) / webView->width();
qreal yScale = (_boundingRect.height() - 2 * frameWidth) / webView->height();
qreal xScale = (_boundingRect.width() - 2 * frameWidth) / webView->width();
qreal yScale = (_boundingRect.height() - 2 * frameWidth) / webView->height();
- proxyItem->s
cale(xScale, yScal
e);
+ proxyItem->s
etTransform(QTransform::fromScale(xScale, yScale), tru
e);
proxyItem->setPos(frameWidth, frameWidth);
setZValue(30);
proxyItem->setPos(frameWidth, frameWidth);
setZValue(30);
@@
-62,4
+73,4
@@
void WebPreviewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
}
}
-#endif //#ifdef HAVE_WEBKIT
+#endif //#ifdef HAVE_WEBKIT
|| HAVE_WEBENGINE