summaryrefslogtreecommitdiffstats
path: root/logic/Env.h
blob: 523c51f02239e945783ac186d4ae5c4814a46a8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
};