diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-06 21:58:54 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-06 21:58:54 +0100 |
commit | 8b952b387041341f556edcf0bb34576a2fc88568 (patch) | |
tree | 804b8976355ef3950628647370e7dfc1bdf96b4f /api/logic/Env.h | |
parent | 37cc59c04d0573a42d67242135495c0a0729f965 (diff) | |
download | MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.gz MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.lz MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.tar.xz MultiMC-8b952b387041341f556edcf0bb34576a2fc88568.zip |
NOISSUE Refactor and sanitize MultiMC startup/shutdown
* Always create main window.
* Properly handle netowrk manager - it was created twice, leading to potential crashes.
Diffstat (limited to 'api/logic/Env.h')
-rw-r--r-- | api/logic/Env.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/api/logic/Env.h b/api/logic/Env.h index dcf1947f..989b4f3c 100644 --- a/api/logic/Env.h +++ b/api/logic/Env.h @@ -7,6 +7,8 @@ #include "multimc_logic_export.h" +#include "QObjectPtr.h" + class QNetworkAccessManager; class HttpMetaCache; class BaseVersionList; @@ -22,16 +24,15 @@ class MULTIMC_LOGIC_EXPORT Env { friend class MultiMC; private: + class Private; Env(); + ~Env(); public: static Env& getInstance(); - // call when Qt stuff is being torn down - void destroy(); - - std::shared_ptr<QNetworkAccessManager> qnam(); + QNetworkAccessManager &qnam() const; - std::shared_ptr<HttpMetaCache> metacache(); + shared_qobject_ptr<HttpMetaCache> metacache(); std::shared_ptr<IIconList> icons(); @@ -51,16 +52,11 @@ public: void registerIconList(std::shared_ptr<IIconList> iconlist); - std::shared_ptr<WonkoIndex> wonkoIndex(); + shared_qobject_ptr<WonkoIndex> wonkoIndex(); - QString wonkoRootUrl() const { return m_wonkoRootUrl; } - void setWonkoRootUrl(const QString &url) { m_wonkoRootUrl = url; } + QString wonkoRootUrl() const; + void setWonkoRootUrl(const QString &url); protected: - std::shared_ptr<QNetworkAccessManager> m_qnam; - std::shared_ptr<HttpMetaCache> m_metacache; - std::shared_ptr<IIconList> m_iconlist; - QMap<QString, std::shared_ptr<BaseVersionList>> m_versionLists; - std::shared_ptr<WonkoIndex> m_wonkoIndex; - QString m_wonkoRootUrl; + Private * d; }; |