summaryrefslogtreecommitdiffstats
path: root/api/logic/Env.h
blob: 276d762d711c4d79106881494c0e76d8308c5be6 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include <memory>
#include "icons/IIconList.h"
#include <QString>
#include <QMap>

#include "multimc_logic_export.h"

#include "QObjectPtr.h"

class QNetworkAccessManager;
class HttpMetaCache;
class BaseVersionList;
class BaseVersion;

namespace Meta
{
class Index;
}

#if defined(ENV)
	#undef ENV
#endif
#define ENV (Env::getInstance())


class MULTIMC_LOGIC_EXPORT Env
{
	friend class MultiMC;
private:
	struct Private;
	Env();
	~Env();
	static void dispose();
public:
	static Env& getInstance();

	QNetworkAccessManager &qnam() const;

	shared_qobject_ptr<HttpMetaCache> metacache();

	std::shared_ptr<IIconList> icons();

	/// 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);

	void registerIconList(std::shared_ptr<IIconList> iconlist);

	shared_qobject_ptr<Meta::Index> metadataIndex();

	QString getJarsPath();
	void setJarsPath(const QString & path);
protected:
	Private * d;
};