aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/webprofile.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-05 18:07:27 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-05 18:07:27 +0200
commit0f41f33263b7d09b1cac3b66beb4b3c5931f68ce (patch)
tree284aacbb197520ea7092ea0172531aea188b6336 /src/webengine/webprofile.h
parentAdd QString cast to Configuration::value (diff)
downloadsmolbote-0f41f33263b7d09b1cac3b66beb4b3c5931f68ce.tar.xz
Fix clazy warnings in WebProfile
- add missing notify signals - add more properties - apply defaults to all profiles - update manpage
Diffstat (limited to 'src/webengine/webprofile.h')
-rw-r--r--src/webengine/webprofile.h82
1 files changed, 52 insertions, 30 deletions
diff --git a/src/webengine/webprofile.h b/src/webengine/webprofile.h
index 1e3ac64..31c5b44 100644
--- a/src/webengine/webprofile.h
+++ b/src/webengine/webprofile.h
@@ -18,15 +18,27 @@ class WebProfile : public QWebEngineProfile
{
Q_OBJECT
- Q_PROPERTY(QString search READ search WRITE setSearch)
- Q_PROPERTY(QUrl homepage READ homepage WRITE setHomepage)
- Q_PROPERTY(QUrl newtab READ newtab WRITE setNewtab)
+ Q_PROPERTY(QString search READ search WRITE setSearch NOTIFY searchChanged)
+ Q_PROPERTY(QUrl homepage READ homepage WRITE setHomepage NOTIFY homepageChanged)
+ Q_PROPERTY(QUrl newtab READ newtab WRITE setNewtab NOTIFY newtabChanged)
+
+ // QWebEngineProfile should-be properties
+ Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged)
+ Q_PROPERTY(QString persistentStoragePath READ persistentStoragePath WRITE setPersistentStoragePath NOTIFY persistentStoragePathChanged)
+
+ Q_PROPERTY(QString httpAcceptLanguage READ httpAcceptLanguage WRITE setHttpAcceptLanguage NOTIFY httpAcceptLanguageChanged)
+ Q_PROPERTY(int httpCacheMaximumSize READ httpCacheMaximumSize WRITE setHttpCacheMaximumSize NOTIFY httpCacheMaximumSizeChanged)
+ Q_PROPERTY(QString httpUserAgent READ httpUserAgent WRITE setHttpUserAgent NOTIFY httpUserAgentChanged)
+
+ Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged)
public:
- explicit WebProfile(const QHash<QString, QString> &defaults, QObject *parent = nullptr);
+ // off-the-record constructor
+ explicit WebProfile(QObject *parent = nullptr);
+ // default constructor
explicit WebProfile(const QString &name, QObject *parent = nullptr);
- ~WebProfile() override;
+ ~WebProfile() = default;
static void setDefaultProfile(WebProfile *profile)
{
@@ -43,30 +55,27 @@ public:
{
return m_name;
}
- QString search() const
- {
- return m_search;
- }
- void setSearch(const QString &url)
- {
- m_search = url;
- }
- QUrl homepage() const
- {
- return m_homepage;
- }
- void setHomepage(const QUrl &url)
- {
- m_homepage = url;
- }
- QUrl newtab() const
- {
- return m_newtab;
- }
- void setNewtab(const QUrl &url)
- {
- m_newtab = url;
- }
+
+ // search url
+ QString search() const;
+ void setSearch(const QString &url);
+
+ // homepage url
+ QUrl homepage() const;
+ void setHomepage(const QUrl &url);
+
+ // new tab url
+ QUrl newtab() const;
+ void setNewtab(const QUrl &url);
+
+ void setCachePath(const QString &path);
+ void setPersistentStoragePath(const QString &path);
+
+ void setHttpAcceptLanguage(const QString &httpAcceptLanguage);
+ void setHttpCacheMaximumSize(int maxSize);
+ void setHttpUserAgent(const QString &userAgent);
+
+ void setSpellCheckEnabled(bool enable);
void addBookmark(const QString &title, const QString &url)
{
@@ -77,6 +86,19 @@ public:
signals:
void addBookmarkRequested(const QString &title, const QString &url);
+ void searchChanged(const QString &url);
+ void homepageChanged(const QUrl &url);
+ void newtabChanged(const QUrl &url);
+
+ void cachePathChanged(const QString &path);
+ void persistentStoragePathChanged(const QString &path);
+
+ void httpAcceptLanguageChanged(const QString &httpAcceptLanguage);
+ void httpCacheMaximumSizeChanged(int maxSize);
+ void httpUserAgentChanged(const QString &userAgent);
+
+ void spellCheckEnabledChanged(bool enable);
+
private:
static WebProfile *profile;
@@ -86,7 +108,7 @@ private:
QUrl m_newtab = QUrl("about:blank");
};
-void loadProfile(WebProfile *profile, const QString &path);
+void loadProfile(WebProfile *profile, const QHash<QString, QString> &defaults, const QString &path);
//WebProfile *saveProfile(WebProfile *profile, const QString &path);
#endif // SMOLBOTE_WEBENGINEPROFILE_H