diff options
Diffstat (limited to 'src/webengine/webprofilemanager.h')
-rw-r--r-- | src/webengine/webprofilemanager.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/webengine/webprofilemanager.h b/src/webengine/webprofilemanager.h index 2d9cd29..0e18d5f 100644 --- a/src/webengine/webprofilemanager.h +++ b/src/webengine/webprofilemanager.h @@ -18,28 +18,34 @@ #include <QSettings> #include <functional> +void profileMenu(QMenu *menu, const std::function<void(WebProfile *)> &callback, WebProfile *current = nullptr, bool checkable = false); + +class Browser; class WebProfileManager : public QObject { Q_OBJECT + + friend class Browser; + friend void profileMenu(QMenu *, const std::function<void(WebProfile *)> &, WebProfile *current, bool); + public: explicit WebProfileManager(QObject *parent); - ~WebProfileManager(); + ~WebProfileManager() override; + + static auto instance() -> const WebProfileManager *; + static void setInstance(WebProfileManager *ptr); /** Create a profile with specified id * param id The profile ID - * param path The path to the profile settings - * param isOffTheRecord Off-the-record toggle * return WebProfile* The profile, or nullptr if one could not be created */ - WebProfile *profile(const QString &id, const QString &path = QString(), bool isOffTheRecord = true); + WebProfile *profile(const QString &id) const; /** Set a profile for deletion * param id The profile ID * return void */ - void deleteProfile(const QString &id); - - void profileMenu(QMenu *menu, const std::function<void(WebProfile *)> &callback, WebProfile *current = nullptr, bool checkable = false) const; + [[deprecated]] void deleteProfile(const QString &id); const QStringList idList() const { @@ -56,6 +62,9 @@ public: return QString(); } +protected: + WebProfile *add(const QString &id, const QString &path = QString(), bool isOffTheRecord = true); + private: struct Profile { WebProfile *ptr = nullptr; |