diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-01-31 16:59:03 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-04-02 11:30:24 +0200 |
commit | 6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f (patch) | |
tree | 28aaf76918d1ff0ffe2a437573bb1ab7a012c4ec /logic/Env.h | |
parent | e508728246043fcaf8bee565e73b15e15eb2e531 (diff) | |
download | MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.gz MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.lz MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.tar.xz MultiMC-6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f.zip |
NOISSUE Split MultiMC app object into MultiMC and Env
Diffstat (limited to 'logic/Env.h')
-rw-r--r-- | logic/Env.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/logic/Env.h b/logic/Env.h new file mode 100644 index 00000000..523c51f0 --- /dev/null +++ b/logic/Env.h @@ -0,0 +1,44 @@ +#pragma once + +#include <memory> +#include <QString> + +class QNetworkAccessManager; +class HttpMetaCache; + +#if defined(ENV) + #undef ENV +#endif +#define ENV (Env::getInstance()) + +class Env +{ + friend class MultiMC; +private: + Env(); +public: + static Env& getInstance(); + + // call when Qt stuff is being torn down + void destroy(); + + std::shared_ptr<QNetworkAccessManager> qnam() + { + return m_qnam; + } + + std::shared_ptr<HttpMetaCache> metacache() + { + return m_metacache; + } + + /// init the cache. FIXME: possible future hook point + void initHttpMetaCache(QString rootPath, QString staticDataPath); + + /// Updates the application proxy settings from the settings object. + void updateProxySettings(QString proxyTypeStr, QString addr, int port, QString user, QString password); + +protected: + std::shared_ptr<QNetworkAccessManager> m_qnam; + std::shared_ptr<HttpMetaCache> m_metacache; +}; |