2015-01-31 21:29:03 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QString>
|
2015-02-02 05:39:28 +05:30
|
|
|
#include <QMap>
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2015-02-01 16:14:47 +05:30
|
|
|
class IconList;
|
2015-01-31 21:29:03 +05:30
|
|
|
class QNetworkAccessManager;
|
|
|
|
class HttpMetaCache;
|
2015-02-02 05:39:28 +05:30
|
|
|
class BaseVersionList;
|
|
|
|
class BaseVersion;
|
2015-01-31 21:29:03 +05:30
|
|
|
|
|
|
|
#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();
|
|
|
|
|
2015-01-31 23:51:47 +05:30
|
|
|
std::shared_ptr<QNetworkAccessManager> qnam();
|
|
|
|
|
|
|
|
std::shared_ptr<HttpMetaCache> metacache();
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2015-02-01 16:14:47 +05:30
|
|
|
std::shared_ptr<IconList> icons();
|
|
|
|
|
2015-01-31 21:29:03 +05:30
|
|
|
/// 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);
|
|
|
|
|
2015-02-02 05:39:28 +05:30
|
|
|
/// get a version list by name
|
|
|
|
std::shared_ptr<BaseVersionList> getVersionList(QString component);
|
|
|
|
|
|
|
|
/// get a version by list name and version name
|
|
|
|
std::shared_ptr<BaseVersion> getVersion(QString component, QString version);
|
|
|
|
|
|
|
|
void registerVersionList(QString name, std::shared_ptr<BaseVersionList> vlist);
|
2015-01-31 21:29:03 +05:30
|
|
|
protected:
|
|
|
|
std::shared_ptr<QNetworkAccessManager> m_qnam;
|
|
|
|
std::shared_ptr<HttpMetaCache> m_metacache;
|
2015-02-01 16:14:47 +05:30
|
|
|
std::shared_ptr<IconList> m_icons;
|
2015-02-02 05:39:28 +05:30
|
|
|
QMap<QString, std::shared_ptr<BaseVersionList>> m_versionLists;
|
2015-01-31 21:29:03 +05:30
|
|
|
};
|