diff options
Diffstat (limited to 'src/profilemanager.h')
-rw-r--r-- | src/profilemanager.h | 27 |
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 |