diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-11-28 12:00:08 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-02-05 13:56:10 +0000 |
commit | 4ef5831a398280cc26cbf359dcbb9878e77ab7fb (patch) | |
tree | adb8b7ac7a42b8130b178d1001a5c008c430d325 /src/core/web_engine_settings.h | |
parent | faec509a21b4700dbf271c4dcbb3a993f1c4042f (diff) |
Add settings to WebEngineProfiles
This patch adds settings to profiles so common settings might be shared
among all pages in a profile. The former global settings are now replaced
by the settings of the default profile.
Change-Id: I544420e07beeb52ef29b2360bc7929402650cd07
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'src/core/web_engine_settings.h')
-rw-r--r-- | src/core/web_engine_settings.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index 42dff4b3c..8ee7d8871 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -43,6 +43,7 @@ #include <QScopedPointer> #include <QHash> #include <QUrl> +#include <QSet> class BatchTimer; class WebContentsAdapter; @@ -52,14 +53,6 @@ namespace content { struct WebPreferences; } -class QWEBENGINE_EXPORT WebEngineSettingsDelegate { -public: - virtual ~WebEngineSettingsDelegate() {} - virtual void apply() = 0; - // Needs to be a valid pointer, the last available fallback (ex: global settings) should return itself. - virtual WebEngineSettings *fallbackSettings() const = 0; -}; - class QWEBENGINE_EXPORT WebEngineSettings { public: // Attributes. Names match the ones from the public widgets API. @@ -98,8 +91,10 @@ public: DefaultFixedFontSize }; - WebEngineSettings(WebEngineSettingsDelegate*); - virtual ~WebEngineSettings(); + explicit WebEngineSettings(WebEngineSettings *parentSettings = 0); + ~WebEngineSettings(); + + void setParentSettings(WebEngineSettings *parentSettings); void overrideWebPreferences(content::WebPreferences *prefs); @@ -118,16 +113,17 @@ public: void setDefaultTextEncoding(const QString &encoding); QString defaultTextEncoding() const; - void initDefaults(); + void initDefaults(bool offTheRecord = false); void scheduleApply(); + void scheduleApplyRecursively(); + private: void doApply(); void applySettingsToWebPreferences(content::WebPreferences *); void setWebContentsAdapter(WebContentsAdapter *adapter) { m_adapter = adapter; } WebContentsAdapter* m_adapter; - WebEngineSettingsDelegate* m_delegate; QHash<Attribute, bool> m_attributes; QHash<FontFamily, QString> m_fontFamilies; QHash<FontSize, int> m_fontSizes; @@ -135,6 +131,9 @@ private: QScopedPointer<content::WebPreferences> webPreferences; QScopedPointer<BatchTimer> m_batchTimer; + WebEngineSettings *parentSettings; + QSet<WebEngineSettings *> childSettings; + friend class BatchTimer; friend class WebContentsAdapter; }; |