From b6d455a02bd338e9dc0faa09d4d8177ecd8d569a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 10 Apr 2016 15:53:05 +0200 Subject: NOISSUE reorganize and document libraries --- api/logic/Env.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 api/logic/Env.h (limited to 'api/logic/Env.h') diff --git a/api/logic/Env.h b/api/logic/Env.h new file mode 100644 index 00000000..4d8945d7 --- /dev/null +++ b/api/logic/Env.h @@ -0,0 +1,60 @@ +#pragma once + +#include +#include +#include + +#include "multimc_logic_export.h" + +class QNetworkAccessManager; +class HttpMetaCache; +class BaseVersionList; +class BaseVersion; +class WonkoIndex; + +#if defined(ENV) + #undef ENV +#endif +#define ENV (Env::getInstance()) + +class MULTIMC_LOGIC_EXPORT Env +{ + friend class MultiMC; +private: + Env(); +public: + static Env& getInstance(); + + // call when Qt stuff is being torn down + void destroy(); + + std::shared_ptr qnam(); + + std::shared_ptr metacache(); + + /// init the cache. FIXME: possible future hook point + void initHttpMetaCache(); + + /// Updates the application proxy settings from the settings object. + void updateProxySettings(QString proxyTypeStr, QString addr, int port, QString user, QString password); + + /// get a version list by name + std::shared_ptr getVersionList(QString component); + + /// get a version by list name and version name + std::shared_ptr getVersion(QString component, QString version); + + void registerVersionList(QString name, std::shared_ptr vlist); + + std::shared_ptr wonkoIndex(); + + QString wonkoRootUrl() const { return m_wonkoRootUrl; } + void setWonkoRootUrl(const QString &url) { m_wonkoRootUrl = url; } + +protected: + std::shared_ptr m_qnam; + std::shared_ptr m_metacache; + QMap> m_versionLists; + std::shared_ptr m_wonkoIndex; + QString m_wonkoRootUrl; +}; -- cgit v1.2.3