diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-03-02 09:51:53 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-03-25 14:12:27 +0000 |
commit | bd3d10a4a892166c79563e0ef37b3065420f99d0 (patch) | |
tree | cd2c79bc29e628c87f933fd405f27772f79e034c /examples | |
parent | 7a49313c84ccd4779e396b7bc8341a331d90f96f (diff) |
Add settings for FaviconManager's icon download modes
Change-Id: I8e4b11089de29623ed39ec6b13fe30be734baa3e
Task-number: QTBUG-51179
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'examples')
4 files changed, 122 insertions, 49 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 0b95c0db1..b468b2a77 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -84,6 +84,8 @@ ApplicationWindow { property alias errorPageEnabled: errorPageEnabled.checked; property alias pluginsEnabled: pluginsEnabled.checked; property alias fullScreenSupportEnabled: fullScreenSupportEnabled.checked; + property alias autoLoadIconsForPage: autoLoadIconsForPage.checked; + property alias touchIconsEnabled: touchIconsEnabled.checked; } Action { @@ -294,6 +296,19 @@ ApplicationWindow { checked: (currentWebView.profile.httpCacheType == WebEngineProfile.DiskHttpCache) onToggled: currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache } + MenuItem { + id: autoLoadIconsForPage + text: "Icons On" + checkable: true + checked: WebEngine.settings.autoLoadIconsForPage + } + MenuItem { + id: touchIconsEnabled + text: "Touch Icons On" + checkable: true + checked: WebEngine.settings.touchIconsEnabled + enabled: autoLoadIconsForPage.checked + } } } } @@ -365,6 +380,8 @@ ApplicationWindow { settings.errorPageEnabled: appSettings.errorPageEnabled settings.pluginsEnabled: appSettings.pluginsEnabled settings.fullScreenSupportEnabled: appSettings.fullScreenSupportEnabled + settings.autoLoadIconsForPage: appSettings.autoLoadIconsForPage + settings.touchIconsEnabled: appSettings.touchIconsEnabled onCertificateError: { error.defer() diff --git a/examples/webenginewidgets/demobrowser/browserapplication.cpp b/examples/webenginewidgets/demobrowser/browserapplication.cpp index a2e47cd9f..027a7d148 100644 --- a/examples/webenginewidgets/demobrowser/browserapplication.cpp +++ b/examples/webenginewidgets/demobrowser/browserapplication.cpp @@ -299,6 +299,21 @@ void BrowserApplication::loadSettings() defaultProfile->setHttpUserAgent(settings.value(QLatin1String("httpUserAgent")).toString()); defaultProfile->setHttpAcceptLanguage(settings.value(QLatin1String("httpAcceptLanguage")).toString()); + + switch (settings.value(QLatin1String("faviconDownloadMode"), 1).toInt()) { + case 0: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false); + break; + case 1: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, true); + defaultSettings->setAttribute(QWebEngineSettings::TouchIconsEnabled, false); + break; + case 2: + defaultSettings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, true); + defaultSettings->setAttribute(QWebEngineSettings::TouchIconsEnabled, true); + break; + } + settings.endGroup(); settings.beginGroup(QLatin1String("cookies")); diff --git a/examples/webenginewidgets/demobrowser/settings.cpp b/examples/webenginewidgets/demobrowser/settings.cpp index 220fafdec..aa3110ae7 100644 --- a/examples/webenginewidgets/demobrowser/settings.cpp +++ b/examples/webenginewidgets/demobrowser/settings.cpp @@ -114,6 +114,13 @@ void SettingsDialog::loadDefaults() sessionCookiesCombo->setCurrentIndex(QWebEngineProfile::defaultProfile()->persistentCookiesPolicy()); httpUserAgent->setText(QWebEngineProfile::defaultProfile()->httpUserAgent()); httpAcceptLanguage->setText(defaultAcceptLanguage()); + + if (!defaultSettings->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)) + faviconDownloadMode->setCurrentIndex(0); + else if (!defaultSettings->testAttribute(QWebEngineSettings::TouchIconsEnabled)) + faviconDownloadMode->setCurrentIndex(1); + else + faviconDownloadMode->setCurrentIndex(2); } void SettingsDialog::loadFromSettings() @@ -164,6 +171,7 @@ void SettingsDialog::loadFromSettings() enableScrollAnimator->setChecked(settings.value(QLatin1String("enableScrollAnimator"), enableScrollAnimator->isChecked()).toBool()); httpUserAgent->setText(settings.value(QLatin1String("httpUserAgent"), httpUserAgent->text()).toString()); httpAcceptLanguage->setText(settings.value(QLatin1String("httpAcceptLanguage"), httpAcceptLanguage->text()).toString()); + faviconDownloadMode->setCurrentIndex(settings.value(QLatin1String("faviconDownloadMode"), faviconDownloadMode->currentIndex()).toInt()); settings.endGroup(); // Privacy @@ -223,6 +231,7 @@ void SettingsDialog::saveToSettings() settings.setValue(QLatin1String("userStyleSheet"), userStyleSheet->toPlainText()); settings.setValue(QLatin1String("httpUserAgent"), httpUserAgent->text()); settings.setValue(QLatin1String("httpAcceptLanguage"), httpAcceptLanguage->text()); + settings.setValue(QLatin1String("faviconDownloadMode"), faviconDownloadMode->currentIndex()); settings.endGroup(); //Privacy diff --git a/examples/webenginewidgets/demobrowser/settings.ui b/examples/webenginewidgets/demobrowser/settings.ui index 38a7af344..c78a52dfe 100644 --- a/examples/webenginewidgets/demobrowser/settings.ui +++ b/examples/webenginewidgets/demobrowser/settings.ui @@ -27,13 +27,26 @@ <item row="1" column="0"> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>4</number> + <number>0</number> </property> <widget class="QWidget" name="tab"> <attribute name="title"> <string>General</string> </attribute> <layout class="QGridLayout" name="gridLayout_4"> + <item row="1" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>280</width> + <height>18</height> + </size> + </property> + </spacer> + </item> <item row="0" column="0"> <widget class="QLabel" name="label_3"> <property name="text"> @@ -47,36 +60,63 @@ <item row="0" column="1" colspan="2"> <widget class="QLineEdit" name="homeLineEdit"/> </item> - <item row="1" column="1"> - <widget class="QPushButton" name="setHomeToCurrentPageButton"> - <property name="text"> - <string>Set to current page</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <spacer name="horizontalSpacer"> + <item row="7" column="1" colspan="2"> + <spacer> <property name="orientation"> - <enum>Qt::Horizontal</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>280</width> - <height>18</height> + <width>391</width> + <height>262</height> </size> </property> </spacer> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_4"> + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> <property name="text"> - <string>Remove history items:</string> + <string>Save downloads to:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Open links from applications:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> + <item row="6" column="1" colspan="2"> + <widget class="QCheckBox" name="enableScrollAnimator"> + <property name="text"> + <string>Enable Scroll Animator</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="1" colspan="2"> + <widget class="QComboBox" name="openLinksIn"> + <item> + <property name="text"> + <string>In a tab in the current window</string> + </property> + </item> + <item> + <property name="text"> + <string>In a new window</string> + </property> + </item> + </widget> + </item> <item row="2" column="1" colspan="2"> <widget class="QComboBox" name="expireHistory"> <item> @@ -111,10 +151,10 @@ </item> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_7"> + <item row="2" column="0"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Save downloads to:</string> + <string>Remove history items:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -124,53 +164,45 @@ <item row="3" column="1" colspan="2"> <widget class="QLineEdit" name="downloadsLocation"/> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_8"> + <item row="1" column="1"> + <widget class="QPushButton" name="setHomeToCurrentPageButton"> <property name="text"> - <string>Open links from applications:</string> + <string>Set to current page</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>Favicon download mode:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="4" column="1" colspan="2"> - <widget class="QComboBox" name="openLinksIn"> + <item row="5" column="1" colspan="2"> + <widget class="QComboBox" name="faviconDownloadMode"> + <property name="currentIndex"> + <number>1</number> + </property> <item> <property name="text"> - <string>In a tab in the current window</string> + <string>Disable icons</string> </property> </item> <item> <property name="text"> - <string>In a new window</string> + <string>Enable favicons</string> + </property> + </item> + <item> + <property name="text"> + <string>Enable favicons and touch icons</string> </property> </item> </widget> </item> - <item row="5" column="1" colspan="2"> - <widget class="QCheckBox" name="enableScrollAnimator"> - <property name="text"> - <string>Enable Scroll Animator</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="6" column="1" colspan="2"> - <spacer> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>391</width> - <height>262</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="tab_3"> |