diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-05-27 17:50:22 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-05-27 17:50:22 +0200 |
commit | 8221037c77be1f7c256b2575d4a9a4a9d58a9c0d (patch) | |
tree | d2e70f9603207dbebeb0238bf15af56e24af18dd /src/webengine | |
parent | Filter code refactoring (diff) | |
download | smolbote-8221037c77be1f7c256b2575d4a9a4a9d58a9c0d.tar.xz |
Profile improvements
* Some code refactoring
* Profile dialog UI is now only created when needed
* Profile selector dialog
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/webengineprofile.cpp | 10 | ||||
-rw-r--r-- | src/webengine/webengineprofile.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/webengine/webengineprofile.cpp b/src/webengine/webengineprofile.cpp index 814d38c..89cc301 100644 --- a/src/webengine/webengineprofile.cpp +++ b/src/webengine/webengineprofile.cpp @@ -27,8 +27,6 @@ WebEngineProfile::WebEngineProfile(QObject *parent) : QWebEngineProfile(parent) { // Off-the-record constructor - - m_profileDialog = new ProfileDialog(this); } WebEngineProfile::WebEngineProfile(const QString &storageName, QObject *parent) : @@ -37,8 +35,6 @@ WebEngineProfile::WebEngineProfile(const QString &storageName, QObject *parent) setPersistentStoragePath(sSettings->value("browser.profile.path").toString() + storageName); setCachePath(sSettings->value("browser.profile.path").toString() + storageName); - m_profileDialog = new ProfileDialog(this); - QString profilePath = persistentStoragePath() + "/profile.ini"; qDebug("Reading profile from [%s]", qUtf8Printable(profilePath)); QSettings config(profilePath, QSettings::IniFormat); @@ -110,10 +106,16 @@ WebEngineProfile::~WebEngineProfile() if(!isOffTheRecord()) { saveProfile(); } + if(m_profileDialog != nullptr) { + m_profileDialog->deleteLater(); + } } ProfileDialog *WebEngineProfile::dialog() { + if(m_profileDialog == nullptr) { + m_profileDialog = new ProfileDialog(this); + } return m_profileDialog; } diff --git a/src/webengine/webengineprofile.h b/src/webengine/webengineprofile.h index dfdd0f8..4b36940 100644 --- a/src/webengine/webengineprofile.h +++ b/src/webengine/webengineprofile.h @@ -41,7 +41,7 @@ public slots: void saveProfile(); private: - ProfileDialog *m_profileDialog; + ProfileDialog *m_profileDialog = nullptr; }; #endif // WEBENGINEPROFILE_H |