diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-18 18:19:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-19 10:16:04 +0200 |
commit | afd4c43bcef467da03d89d5468742a1dcbfa04fa (patch) | |
tree | 40e76f4472d79c2365f63c8af66f164e2bafbbb1 /examples/webenginewidgets/browser/browserapplication.cpp | |
parent | 89c41f52f6d90d9cad2b054908ef51238c6612a9 (diff) | |
download | qtwebengine-afd4c43bcef467da03d89d5468742a1dcbfa04fa.tar.gz |
Re-enable some qwebenginesetting features in browser example
We now have the QWebEngineSettings class and can re-enable the features
that were previously disabled in the browser that depended on it.
Change-Id: I525dd1a4b5c380ad4c6060f276440e069f633897
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'examples/webenginewidgets/browser/browserapplication.cpp')
-rw-r--r-- | examples/webenginewidgets/browser/browserapplication.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp index 89fc698a7..9ea9fbfcf 100644 --- a/examples/webenginewidgets/browser/browserapplication.cpp +++ b/examples/webenginewidgets/browser/browserapplication.cpp @@ -66,9 +66,7 @@ #include <QtNetwork/QNetworkProxy> #include <QtNetwork/QSslSocket> -#if defined(QWEBENGINESETTINGS) #include <QWebEngineSettings> -#endif #include <QtCore/QDebug> @@ -203,10 +201,10 @@ void BrowserApplication::quitBrowser() */ void BrowserApplication::postLaunch() { -#if defined(QWEBENGINESETTINGS) QString directory = QStandardPaths::writableLocation(QStandardPaths::DataLocation); if (directory.isEmpty()) directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); +#if defined(QWEBENGINESETTINGS_PATHS) QWebEngineSettings::setIconDatabasePath(directory); QWebEngineSettings::setOfflineStoragePath(directory); #endif @@ -228,7 +226,6 @@ void BrowserApplication::postLaunch() void BrowserApplication::loadSettings() { -#if defined(QWEBENGINESETTINGS) QSettings settings; settings.beginGroup(QLatin1String("websettings")); @@ -248,15 +245,17 @@ void BrowserApplication::loadSettings() defaultSettings->setFontSize(QWebEngineSettings::DefaultFixedFontSize, fixedFont.pointSize()); defaultSettings->setAttribute(QWebEngineSettings::JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); + +#if defined(QTWEBENGINE_PLUGINS) defaultSettings->setAttribute(QWebEngineSettings::PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); +#endif +#if defined(QTWEBENGINE_USERSTYLESHEET) QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); defaultSettings->setUserStyleSheetUrl(url); - - defaultSettings->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true); +#endif settings.endGroup(); -#endif } QList<BrowserMainWindow*> BrowserApplication::mainWindows() @@ -278,7 +277,7 @@ void BrowserApplication::clean() void BrowserApplication::saveSession() { -#if defined(QWEBENGINESETTINGS) +#if defined(QTWEBENGINE_PRIVATEBROWSING) QWebEngineSettings *globalSettings = QWebEngineSettings::globalSettings(); if (globalSettings->testAttribute(QWebEngineSettings::PrivateBrowsingEnabled)) return; @@ -466,7 +465,7 @@ BookmarksManager *BrowserApplication::bookmarksManager() QIcon BrowserApplication::icon(const QUrl &url) const { -#if defined(QWEBENGINESETTINGS) +#if defined(QTWEBENGINE_ICONDATABASE) QIcon icon = QWebEngineSettings::iconForUrl(url); if (!icon.isNull()) return icon.pixmap(16, 16); |