From 62c3898d8e18a872700948c46a61592b315e79de Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 22 Nov 2019 19:34:09 +0200 Subject: WebProfile refactoring - Remove WebProfileManager::Profile::value - Make WebProfile constructors protected, and WebProfileManager friend class --- src/webengine/webprofile.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'src/webengine/webprofile.h') diff --git a/src/webengine/webprofile.h b/src/webengine/webprofile.h index 37e3419..1ec2b88 100644 --- a/src/webengine/webprofile.h +++ b/src/webengine/webprofile.h @@ -19,29 +19,19 @@ #include #include +class WebProfileManager; class WebProfile : public Profile { + friend class WebProfileManager; + Q_OBJECT public: - // off-the-record constructor - explicit WebProfile(const QString &name, QObject *parent = nullptr); - // default constructor - explicit WebProfile(const QString &storageName, const QString &name, QObject *parent = nullptr); + static WebProfile *defaultProfile(); + static void setDefaultProfile(WebProfile *profile); ~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; - } - const QString name() const; void setName(const QString &name); @@ -79,9 +69,13 @@ public: void setSpellCheckEnabled(bool enable); -private: - static WebProfile *profile; +protected: + // off-the-record constructor + explicit WebProfile(const QString &name, QObject *parent = nullptr); + // default constructor + explicit WebProfile(const QString &storageName, const QString &name, QObject *parent = nullptr); +private: QString m_name; QString m_search = QString("about:blank"); QUrl m_homepage = QUrl("about:blank"); -- cgit v1.2.1