From 6f3aa65bd69f5155fa1ee56dee840e2e7e1d3c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 31 Jan 2015 16:59:03 +0100 Subject: NOISSUE Split MultiMC app object into MultiMC and Env --- logic/Env.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 logic/Env.h (limited to 'logic/Env.h') 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 +#include + +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 qnam() + { + return m_qnam; + } + + std::shared_ptr 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 m_qnam; + std::shared_ptr m_metacache; +}; -- cgit v1.2.3