MultiMC5/api/logic/Env.h

66 lines
1.4 KiB
C
Raw Normal View History

#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)
2018-07-15 12:51:05 +00:00
#undef ENV
#endif
#define ENV (Env::getInstance())
class MULTIMC_LOGIC_EXPORT Env
{
2018-07-15 12:51:05 +00:00
friend class MultiMC;
private:
2018-07-15 12:51:05 +00:00
struct Private;
Env();
~Env();
static void dispose();
public:
2018-07-15 12:51:05 +00:00
static Env& getInstance();
2018-07-15 12:51:05 +00:00
QNetworkAccessManager &qnam() const;
2018-07-15 12:51:05 +00:00
shared_qobject_ptr<HttpMetaCache> metacache();
2018-07-15 12:51:05 +00:00
std::shared_ptr<IIconList> icons();
2018-07-15 12:51:05 +00:00
/// init the cache. FIXME: possible future hook point
void initHttpMetaCache();
2018-07-15 12:51:05 +00:00
/// Updates the application proxy settings from the settings object.
void updateProxySettings(QString proxyTypeStr, QString addr, int port, QString user, QString password);
2018-07-15 12:51:05 +00:00
void registerIconList(std::shared_ptr<IIconList> iconlist);
2018-07-15 12:51:05 +00:00
shared_qobject_ptr<Meta::Index> metadataIndex();
2018-07-15 12:51:05 +00:00
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 12:51:05 +00:00
Private * d;
};