2015-01-31 21:29:03 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2016-05-03 03:57:28 +05:30
|
|
|
#include "icons/IIconList.h"
|
2015-01-31 21:29:03 +05:30
|
|
|
#include <QString>
|
2015-02-02 05:39:28 +05:30
|
|
|
#include <QMap>
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2016-11-07 02:28:54 +05:30
|
|
|
#include "QObjectPtr.h"
|
|
|
|
|
2015-01-31 21:29:03 +05:30
|
|
|
class QNetworkAccessManager;
|
|
|
|
class HttpMetaCache;
|
2015-02-02 05:39:28 +05:30
|
|
|
class BaseVersionList;
|
|
|
|
class BaseVersion;
|
2017-03-11 06:09:45 +05:30
|
|
|
|
|
|
|
namespace Meta
|
|
|
|
{
|
|
|
|
class Index;
|
|
|
|
}
|
2015-01-31 21:29:03 +05:30
|
|
|
|
|
|
|
#if defined(ENV)
|
2018-07-15 18:21:05 +05:30
|
|
|
#undef ENV
|
2015-01-31 21:29:03 +05:30
|
|
|
#endif
|
|
|
|
#define ENV (Env::getInstance())
|
|
|
|
|
2017-07-05 21:32:49 +05:30
|
|
|
|
2021-07-25 22:41:59 +05:30
|
|
|
class Env
|
2015-01-31 21:29:03 +05:30
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
friend class MultiMC;
|
2015-01-31 21:29:03 +05:30
|
|
|
private:
|
2018-07-15 18:21:05 +05:30
|
|
|
struct Private;
|
|
|
|
Env();
|
|
|
|
~Env();
|
|
|
|
static void dispose();
|
2015-01-31 21:29:03 +05:30
|
|
|
public:
|
2018-07-15 18:21:05 +05:30
|
|
|
static Env& getInstance();
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
QNetworkAccessManager &qnam() const;
|
2015-01-31 23:51:47 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
shared_qobject_ptr<HttpMetaCache> metacache();
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
std::shared_ptr<IIconList> icons();
|
2016-05-03 03:57:28 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
/// init the cache. FIXME: possible future hook point
|
|
|
|
void initHttpMetaCache();
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
/// Updates the application proxy settings from the settings object.
|
|
|
|
void updateProxySettings(QString proxyTypeStr, QString addr, int port, QString user, QString password);
|
2015-01-31 21:29:03 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
void registerIconList(std::shared_ptr<IIconList> iconlist);
|
2016-05-03 03:57:28 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
shared_qobject_ptr<Meta::Index> metadataIndex();
|
2016-04-07 02:39:30 +05:30
|
|
|
|
2018-07-15 18:21:05 +05:30
|
|
|
QString getJarsPath();
|
|
|
|
void setJarsPath(const QString & path);
|
2018-08-01 23:35:18 +05:30
|
|
|
|
|
|
|
bool isFeatureEnabled(const QString & featureName) const;
|
|
|
|
void enableFeature(const QString & featureName, bool state = true);
|
|
|
|
void getEnabledFeatures(QSet<QString> & features) const;
|
|
|
|
void setEnabledFeatures(const QSet<QString> & features) const;
|
|
|
|
|
2015-01-31 21:29:03 +05:30
|
|
|
protected:
|
2018-07-15 18:21:05 +05:30
|
|
|
Private * d;
|
2015-01-31 21:29:03 +05:30
|
|
|
};
|