pollymc/launcher/Env.h

64 lines
1.3 KiB
C
Raw Normal View History

#pragma once
#include <memory>
#include "icons/IIconList.h"
#include <QString>
#include <QMap>
#include "QObjectPtr.h"
class QNetworkAccessManager;
class HttpMetaCache;
class BaseVersionList;
class BaseVersion;
namespace Meta
{
class Index;
}
#if defined(ENV)
2018-07-15 18:21:05 +05:30
#undef ENV
#endif
#define ENV (Env::getInstance())
class Env
{
2018-07-15 18:21:05 +05:30
friend class MultiMC;
private:
2018-07-15 18:21:05 +05:30
struct Private;
Env();
~Env();
static void dispose();
public:
2018-07-15 18:21:05 +05:30
static Env& getInstance();
2018-07-15 18:21:05 +05:30
QNetworkAccessManager &qnam() const;
2018-07-15 18:21:05 +05:30
shared_qobject_ptr<HttpMetaCache> metacache();
2018-07-15 18:21:05 +05:30
std::shared_ptr<IIconList> icons();
2018-07-15 18:21:05 +05:30
/// init the cache. FIXME: possible future hook point
void initHttpMetaCache();
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);
2018-07-15 18:21:05 +05:30
void registerIconList(std::shared_ptr<IIconList> iconlist);
2018-07-15 18:21:05 +05:30
shared_qobject_ptr<Meta::Index> metadataIndex();
2018-07-15 18:21:05 +05:30
QString getJarsPath();
void setJarsPath(const QString & path);
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;
protected:
2018-07-15 18:21:05 +05:30
Private * d;
};