aboutsummaryrefslogtreecommitdiff
path: root/src/profilemanager.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-09-02 12:38:21 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-09-02 12:38:21 +0200
commitde6225509a584df31be1b28146e73d8ecf72c7eb (patch)
tree853f04d227e47f3685d156d0d4fb43a51723dba7 /src/profilemanager.h
parentPluginEditor: implement add plugin action (diff)
downloadsmolbote-de6225509a584df31be1b28146e73d8ecf72c7eb.tar.xz
Clean up ProfileManager
Diffstat (limited to 'src/profilemanager.h')
-rw-r--r--src/profilemanager.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/profilemanager.h b/src/profilemanager.h
index b2509a1..5ece510 100644
--- a/src/profilemanager.h
+++ b/src/profilemanager.h
@@ -15,21 +15,36 @@
typedef QMapIterator<QString, WebProfile *> ProfileIterator;
+#define profileManager ProfileManager::instance()
+
class WebProfile;
class ProfileManager : public QObject
{
Q_OBJECT
public:
- explicit ProfileManager(QObject *parent = nullptr);
- static WebProfile *loadProfile(const QString &path, const QHash<QString, QString> &defaults);
+ struct Profile
+ {
+ QString id;
+ WebProfile *profile = nullptr;
+ };
+
+ explicit ProfileManager(const QHash<QString, QString> &profileSection, QObject *parent = nullptr);
+
+ static void setInstance(ProfileManager *instance);
+ static ProfileManager *instance();
- static const QString id(WebProfile *profile);
- static WebProfile *profile(const QString &id);
- static const QMap<QString, WebProfile *>& profileList();
+ WebProfile *loadProfile(const QString &path);
+
+ const QString id(WebProfile *profile);
+ WebProfile *profile(const QString &id);
+ const QMap<QString, WebProfile *>& profileList();
private:
- static QMap<QString, WebProfile *> profiles;
+ QMap<QString, WebProfile *> profiles;
+
+ static ProfileManager *s_instance;
+ const QHash<QString, QString> defaults;
};
#endif // SMOLBOTE_PROFILEMANAGER_H