From c0632b62cfb62794ae858f0da2bff5850dbac070 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 28 May 2018 14:57:18 +0200 Subject: Profile properties --- src/webengine/webprofile.h | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'src/webengine/webprofile.h') diff --git a/src/webengine/webprofile.h b/src/webengine/webprofile.h index ddb642c..e11d7c5 100644 --- a/src/webengine/webprofile.h +++ b/src/webengine/webprofile.h @@ -17,8 +17,14 @@ class WebProfile : public QWebEngineProfile { Q_OBJECT + + //Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath) + Q_PROPERTY(QString search READ search WRITE setSearch) + Q_PROPERTY(QUrl homepage READ homepage WRITE setHomepage) + Q_PROPERTY(QUrl newtab READ newtab WRITE setNewtab) + public: - explicit WebProfile(QObject *parent = nullptr); + explicit WebProfile(const QHash &defaults, QObject *parent = nullptr); explicit WebProfile(const QString &name, QObject *parent = nullptr); ~WebProfile() override; @@ -34,13 +40,34 @@ public: return WebProfile::profile; } - QString name() const; + QString name() const + { + return m_name; + } QString search() const { return m_search; } - QUrl homepage() const; - QUrl newtab() const; + 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; + } void addBookmark(const QString &title, const QString &url) { @@ -51,18 +78,16 @@ public: signals: void addBookmarkRequested(const QString &title, const QString &url); -public slots: - void loadProfile(QHash conf); - void saveProfile(const QString &path = QString()); - private: static WebProfile *profile; - QString m_configPath; 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 QString &path); +//WebProfile *saveProfile(const QString &path); + #endif // SMOLBOTE_WEBENGINEPROFILE_H -- cgit v1.2.1