2015-01-31 15:59:03 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2016-05-02 22:27:28 +00:00
|
|
|
#include "icons/IIconList.h"
|
2015-01-31 15:59:03 +00:00
|
|
|
#include <QString>
|
2015-02-02 00:09:28 +00:00
|
|
|
#include <QMap>
|
2015-01-31 15:59:03 +00:00
|
|
|
|
2016-11-06 20:58:54 +00:00
|
|
|
#include "QObjectPtr.h"
|
|
|
|
|
2015-01-31 15:59:03 +00:00
|
|
|
class QNetworkAccessManager;
|
|
|
|
class HttpMetaCache;
|
2015-02-02 00:09:28 +00:00
|
|
|
class BaseVersionList;
|
|
|
|
class BaseVersion;
|
2017-03-11 00:39:45 +00:00
|
|
|
|
|
|
|
namespace Meta
|
|
|
|
{
|
|
|
|
class Index;
|
|
|
|
}
|
2015-01-31 15:59:03 +00:00
|
|
|
|
|
|
|
#if defined(ENV)
|
2018-07-15 12:51:05 +00:00
|
|
|
#undef ENV
|
2015-01-31 15:59:03 +00:00
|
|
|
#endif
|
|
|
|
#define ENV (Env::getInstance())
|
|
|
|
|
2017-07-05 16:02:49 +00:00
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class Env
|
2015-01-31 15:59:03 +00:00
|
|
|
{
|
2021-11-20 15:22:22 +00:00
|
|
|
friend class Application;
|
2015-01-31 15:59:03 +00:00
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
struct Private;
|
|
|
|
Env();
|
|
|
|
~Env();
|
|
|
|
static void dispose();
|
2015-01-31 15:59:03 +00:00
|
|
|
public:
|
2021-11-20 15:22:22 +00:00
|
|
|
static Env* getInstance();
|
2015-01-31 15:59:03 +00:00
|
|
|
|
2021-11-17 12:20:10 +00:00
|
|
|
QNetworkAccessManager &network() const;
|
2015-01-31 18:21:47 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
shared_qobject_ptr<HttpMetaCache> metacache();
|
2015-01-31 15:59:03 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
std::shared_ptr<IIconList> icons();
|
2016-05-02 22:27:28 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
/// init the cache. FIXME: possible future hook point
|
|
|
|
void initHttpMetaCache();
|
2015-01-31 15:59:03 +00:00
|
|
|
|
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);
|
2015-01-31 15:59:03 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
void registerIconList(std::shared_ptr<IIconList> iconlist);
|
2016-05-02 22:27:28 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
shared_qobject_ptr<Meta::Index> metadataIndex();
|
2016-04-06 21:09:30 +00:00
|
|
|
|
2018-07-15 12:51:05 +00:00
|
|
|
QString getJarsPath();
|
|
|
|
void setJarsPath(const QString & path);
|
2018-08-01 18:05:18 +00:00
|
|
|
|
|
|
|
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 15:59:03 +00:00
|
|
|
protected:
|
2018-07-15 12:51:05 +00:00
|
|
|
Private * d;
|
2015-01-31 15:59:03 +00:00
|
|
|
};
|