aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/webprofile.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2019-11-22 19:34:09 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2019-11-22 20:05:31 +0200
commit62c3898d8e18a872700948c46a61592b315e79de (patch)
tree81f03b3012c07510202065f03aaec8cd1f9591fb /src/webengine/webprofile.h
parentConfiguration: only try reading it when cfg file can be opened (diff)
downloadsmolbote-62c3898d8e18a872700948c46a61592b315e79de.tar.xz
WebProfile refactoring
- Remove WebProfileManager::Profile::value - Make WebProfile constructors protected, and WebProfileManager friend class
Diffstat (limited to 'src/webengine/webprofile.h')
-rw-r--r--src/webengine/webprofile.h28
1 files changed, 11 insertions, 17 deletions
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 <QWebEngineSettings>
#include <profileinterface.h>
+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");