From 7707fb4ed8ad8c951d9f41ce39823093d30a9f67 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 7 Jun 2018 13:03:47 +0200 Subject: Split webengine/webprofile into lib/web --- src/webengine/webprofile.h | 114 --------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 src/webengine/webprofile.h (limited to 'src/webengine/webprofile.h') diff --git a/src/webengine/webprofile.h b/src/webengine/webprofile.h deleted file mode 100644 index 31c5b44..0000000 --- a/src/webengine/webprofile.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/smolbote.hg - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef SMOLBOTE_WEBENGINEPROFILE_H -#define SMOLBOTE_WEBENGINEPROFILE_H - -#include -#include -#include -#include - -class WebProfile : public QWebEngineProfile -{ - Q_OBJECT - - 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: - // off-the-record constructor - explicit WebProfile(QObject *parent = nullptr); - // default constructor - explicit WebProfile(const QString &name, QObject *parent = nullptr); - - ~WebProfile() = default; - - static void setDefaultProfile(WebProfile *profile) - { - Q_CHECK_PTR(profile); - WebProfile::profile = profile; - } - static WebProfile *defaultProfile() - { - Q_CHECK_PTR(WebProfile::profile); - return WebProfile::profile; - } - - QString name() const - { - return m_name; - } - - // 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) - { - if(!title.isEmpty() && !url.isEmpty()) - emit addBookmarkRequested(title, url); - } - -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; - - QString m_name; - QString m_search = QString("about:blank"); - QUrl m_homepage = QUrl("about:blank"); - QUrl m_newtab = QUrl("about:blank"); -}; - -void loadProfile(WebProfile *profile, const QHash &defaults, const QString &path); -//WebProfile *saveProfile(WebProfile *profile, const QString &path); - -#endif // SMOLBOTE_WEBENGINEPROFILE_H -- cgit v1.2.1