diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-15 17:48:28 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-15 17:48:28 +0100 |
commit | 71bfaa3ed29570b1d744675136344447e0fa4f1b (patch) | |
tree | 120f48ac00040fb321575769b164ad2303835955 /plugins/ProfileEditor/forms | |
parent | Moved ProfileView to ProfileEditorPlugin (diff) | |
download | smolbote-71bfaa3ed29570b1d744675136344447e0fa4f1b.tar.xz |
All QWebEngineSettings are now accessible
Diffstat (limited to 'plugins/ProfileEditor/forms')
-rw-r--r-- | plugins/ProfileEditor/forms/profileview.cpp | 68 | ||||
-rw-r--r-- | plugins/ProfileEditor/forms/profileview.ui | 128 |
2 files changed, 141 insertions, 55 deletions
diff --git a/plugins/ProfileEditor/forms/profileview.cpp b/plugins/ProfileEditor/forms/profileview.cpp index ef0fece..fa0bfaa 100644 --- a/plugins/ProfileEditor/forms/profileview.cpp +++ b/plugins/ProfileEditor/forms/profileview.cpp @@ -10,14 +10,13 @@ #include "ui_profileview.h" #include <QWebEngineSettings> -inline void connectCheckBox(QCheckBox *checkBox, QWebEngineSettings *settings, QWebEngineSettings::WebAttribute attr) +inline void connectSetting(QCheckBox *checkBox, QWebEngineSettings *settings, QWebEngineSettings::WebAttribute attr) { QObject::connect(checkBox, &QCheckBox::clicked, [settings, attr](bool checked){ settings->setAttribute(attr, checked); }); } - ProfileView::ProfileView(QWebEngineProfile *profile, QWidget *parent) : QDialog(parent) , ui(new Ui::ProfileView) @@ -27,13 +26,39 @@ ProfileView::ProfileView(QWebEngineProfile *profile, QWidget *parent) ui->setupUi(this); QWebEngineSettings *settings = m_profile->settings(); - connectCheckBox(ui->autoloadImages_checkBox, settings, QWebEngineSettings::AutoLoadImages); - connectCheckBox(ui->autoloadIcons_checkBox, settings, QWebEngineSettings::AutoLoadIconsForPage); + connectSetting(ui->autoloadImages, settings, QWebEngineSettings::AutoLoadImages); + connectSetting(ui->autoloadIcons, settings, QWebEngineSettings::AutoLoadIconsForPage); + + connectSetting(ui->javascriptEnabled, settings, QWebEngineSettings::JavascriptEnabled); + connectSetting(ui->javascriptCanAccessClipboard, settings, QWebEngineSettings::JavascriptCanAccessClipboard); + connectSetting(ui->javascriptCanOpenWindows, settings, QWebEngineSettings::JavascriptCanOpenWindows); + connectSetting(ui->javascriptCanActivateWindows, settings, QWebEngineSettings::AllowWindowActivationFromJavaScript); + + connectSetting(ui->linksIncludedInFocusChain, settings, QWebEngineSettings::LinksIncludedInFocusChain); + connectSetting(ui->spatialNavigationEnabled, settings, QWebEngineSettings::SpatialNavigationEnabled); + connectSetting(ui->focusOnNavigationEnabled, settings, QWebEngineSettings::FocusOnNavigationEnabled); + connectSetting(ui->touchIconsEnabled, settings, QWebEngineSettings::TouchIconsEnabled); + + connectSetting(ui->showScrollBars, settings, QWebEngineSettings::ShowScrollBars); + connectSetting(ui->scrollAnimatorEnabled, settings, QWebEngineSettings::ScrollAnimatorEnabled); + connectSetting(ui->errorPagesEnabled, settings, QWebEngineSettings::ErrorPageEnabled); + + connectSetting(ui->localContentCanAccessRemoteUrls, settings, QWebEngineSettings::LocalContentCanAccessRemoteUrls); + connectSetting(ui->localContentCanAccessFileUrls, settings, QWebEngineSettings::LocalContentCanAccessFileUrls); - connectCheckBox(ui->javascriptEnabled, settings, QWebEngineSettings::JavascriptEnabled); - connectCheckBox(ui->javascriptCanAccessClipboard, settings, QWebEngineSettings::JavascriptCanAccessClipboard); - connectCheckBox(ui->javascriptCanOpenWindows, settings, QWebEngineSettings::JavascriptCanOpenWindows); - connectCheckBox(ui->javascriptCanActivateWindows, settings, QWebEngineSettings::AllowWindowActivationFromJavaScript); + connectSetting(ui->localStorageEnabled, settings, QWebEngineSettings::LocalStorageEnabled); + connectSetting(ui->webglEnabled, settings, QWebEngineSettings::WebGLEnabled); + connectSetting(ui->canvasEnabled, settings, QWebEngineSettings::Accelerated2dCanvasEnabled); + + connectSetting(ui->xssAuditingEnabled, settings, QWebEngineSettings::XSSAuditingEnabled); + connectSetting(ui->hyperlinkAuditingEnabled, settings, QWebEngineSettings::HyperlinkAuditingEnabled); + + connectSetting(ui->allowRunningInsecureContent, settings, QWebEngineSettings::AllowRunningInsecureContent); + connectSetting(ui->allowGeolocationOnInsecureContent, settings, QWebEngineSettings::AllowGeolocationOnInsecureOrigins); + connectSetting(ui->ppapiPluginsEnabled, settings, QWebEngineSettings::PluginsEnabled); + connectSetting(ui->fullscreenSupportEnabled, settings, QWebEngineSettings::FullScreenSupportEnabled); + connectSetting(ui->screenCaptureEnabled, settings, QWebEngineSettings::ScreenCaptureEnabled); + connectSetting(ui->printElementBackgrounds, settings, QWebEngineSettings::PrintElementBackgrounds); // actions connect(ui->clearCache_pushButton, &QPushButton::clicked, [this]() { @@ -70,13 +95,32 @@ void ProfileView::loadProfile() // settings QWebEngineSettings *settings = m_profile->settings(); - ui->autoloadImages_checkBox->setChecked(settings->testAttribute(QWebEngineSettings::AutoLoadImages)); - ui->autoloadIcons_checkBox->setChecked(settings->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)); - + ui->autoloadImages->setChecked(settings->testAttribute(QWebEngineSettings::AutoLoadImages)); ui->javascriptEnabled->setChecked(settings->testAttribute(QWebEngineSettings::JavascriptEnabled)); - ui->javascriptCanAccessClipboard->setChecked(settings->testAttribute(QWebEngineSettings::JavascriptCanAccessClipboard)); ui->javascriptCanOpenWindows->setChecked(settings->testAttribute(QWebEngineSettings::JavascriptCanOpenWindows)); + ui->javascriptCanAccessClipboard->setChecked(settings->testAttribute(QWebEngineSettings::JavascriptCanAccessClipboard)); + ui->linksIncludedInFocusChain->setChecked(settings->testAttribute(QWebEngineSettings::LinksIncludedInFocusChain)); + ui->localStorageEnabled->setChecked(settings->testAttribute(QWebEngineSettings::LocalStorageEnabled)); + ui->localContentCanAccessRemoteUrls->setChecked(settings->testAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls)); + ui->xssAuditingEnabled->setChecked(settings->testAttribute(QWebEngineSettings::XSSAuditingEnabled)); + ui->spatialNavigationEnabled->setChecked(settings->testAttribute(QWebEngineSettings::SpatialNavigationEnabled)); + ui->localContentCanAccessFileUrls->setChecked(settings->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)); + ui->hyperlinkAuditingEnabled->setChecked(settings->testAttribute(QWebEngineSettings::HyperlinkAuditingEnabled)); + ui->scrollAnimatorEnabled->setChecked(settings->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled)); + ui->errorPagesEnabled->setChecked(settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)); + ui->ppapiPluginsEnabled->setChecked(settings->testAttribute(QWebEngineSettings::PluginsEnabled)); + ui->fullscreenSupportEnabled->setChecked(settings->testAttribute(QWebEngineSettings::FullScreenSupportEnabled)); + ui->screenCaptureEnabled->setChecked(settings->testAttribute(QWebEngineSettings::ScreenCaptureEnabled)); + ui->webglEnabled->setChecked(settings->testAttribute(QWebEngineSettings::WebGLEnabled)); + ui->canvasEnabled->setChecked(settings->testAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled)); + ui->autoloadIcons->setChecked(settings->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)); + ui->touchIconsEnabled->setChecked(settings->testAttribute(QWebEngineSettings::TouchIconsEnabled)); + ui->focusOnNavigationEnabled->setChecked(settings->testAttribute(QWebEngineSettings::FocusOnNavigationEnabled)); + ui->printElementBackgrounds->setChecked(settings->testAttribute(QWebEngineSettings::PrintElementBackgrounds)); + ui->allowRunningInsecureContent->setChecked(settings->testAttribute(QWebEngineSettings::AllowRunningInsecureContent)); + ui->allowGeolocationOnInsecureContent->setChecked(settings->testAttribute(QWebEngineSettings::AllowGeolocationOnInsecureOrigins)); ui->javascriptCanActivateWindows->setChecked(settings->testAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript)); + ui->showScrollBars->setChecked(settings->testAttribute(QWebEngineSettings::ShowScrollBars)); // policy ui->cookiePolicy->setCurrentIndex(m_profile->persistentCookiesPolicy()); diff --git a/plugins/ProfileEditor/forms/profileview.ui b/plugins/ProfileEditor/forms/profileview.ui index 1e6f94f..2e43bae 100644 --- a/plugins/ProfileEditor/forms/profileview.ui +++ b/plugins/ProfileEditor/forms/profileview.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>640</width> - <height>480</height> + <height>504</height> </rect> </property> <property name="windowTitle"> @@ -164,21 +164,21 @@ <property name="geometry"> <rect> <x>0</x> - <y>0</y> + <y>-88</y> <width>584</width> - <height>724</height> + <height>797</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> - <widget class="QCheckBox" name="autoloadImages_checkBox"> + <widget class="QCheckBox" name="autoloadImages"> <property name="text"> <string>Autoload images</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="autoloadIcons_checkBox"> + <widget class="QCheckBox" name="autoloadIcons"> <property name="text"> <string>Autoload icons</string> </property> @@ -227,135 +227,177 @@ </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_11"> + <widget class="QCheckBox" name="linksIncludedInFocusChain"> <property name="text"> - <string>CheckBox</string> + <string>Links included in focus chain</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_23"> + <widget class="QCheckBox" name="spatialNavigationEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Spatial navigation enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_25"> + <widget class="QCheckBox" name="focusOnNavigationEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Focus on navigation enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_24"> + <widget class="QCheckBox" name="touchIconsEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Touch icons enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_19"> + <widget class="Line" name="line_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="showScrollBars"> <property name="text"> - <string>CheckBox</string> + <string>Show scroll bars</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_22"> + <widget class="QCheckBox" name="scrollAnimatorEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Scroll animator enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_21"> + <widget class="QCheckBox" name="errorPagesEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Error pages enabled</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_14"> + <widget class="QCheckBox" name="localContentCanAccessRemoteUrls"> <property name="text"> - <string>CheckBox</string> + <string>Local content can access remote URLs</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_16"> + <widget class="QCheckBox" name="localContentCanAccessFileUrls"> <property name="text"> - <string>CheckBox</string> + <string>Local content can access file URLs</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_18"> + <widget class="QCheckBox" name="localStorageEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Local storage enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_17"> + <widget class="QCheckBox" name="webglEnabled"> <property name="text"> - <string>CheckBox</string> + <string>WebGL enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_15"> + <widget class="QCheckBox" name="canvasEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Accelerated 2D canvas enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_13"> + <widget class="Line" name="line_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="xssAuditingEnabled"> <property name="text"> - <string>CheckBox</string> + <string>XSS auditing enabled</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="hyperlinkAuditingEnabled"> + <property name="text"> + <string>Hyperlink auditing enabled</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_10"> + <widget class="QCheckBox" name="allowRunningInsecureContent"> <property name="text"> - <string>CheckBox</string> + <string>Allow running insecure content</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_7"> + <widget class="QCheckBox" name="allowGeolocationOnInsecureContent"> <property name="text"> - <string>CheckBox</string> + <string>Allow geolocation on insecure content</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_8"> + <widget class="QCheckBox" name="ppapiPluginsEnabled"> <property name="text"> - <string>CheckBox</string> + <string>PPAPI Plugins enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_5"> + <widget class="QCheckBox" name="fullscreenSupportEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Fullscreen support enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox_3"> + <widget class="QCheckBox" name="screenCaptureEnabled"> <property name="text"> - <string>CheckBox</string> + <string>Screen capture enabled</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkBox"> + <widget class="QCheckBox" name="printElementBackgrounds"> <property name="text"> - <string>CheckBox</string> + <string>Print element backgrounds</string> </property> </widget> </item> |