|
|
@ -39,14 +39,23 @@ namespace Private |
|
|
|
class Profile |
|
|
|
class Profile |
|
|
|
{ |
|
|
|
{ |
|
|
|
public: |
|
|
|
public: |
|
|
|
virtual QString baseDirectory() const = 0; |
|
|
|
virtual ~Profile() = default; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual QString rootPath() const = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief The base path against to which portable (relative) paths are resolved |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
virtual QString basePath() const = 0; |
|
|
|
|
|
|
|
|
|
|
|
virtual QString cacheLocation() const = 0; |
|
|
|
virtual QString cacheLocation() const = 0; |
|
|
|
virtual QString configLocation() const = 0; |
|
|
|
virtual QString configLocation() const = 0; |
|
|
|
virtual QString dataLocation() const = 0; |
|
|
|
virtual QString dataLocation() const = 0; |
|
|
|
virtual QString downloadLocation() const = 0; |
|
|
|
virtual QString downloadLocation() const = 0; |
|
|
|
|
|
|
|
|
|
|
|
virtual SettingsPtr applicationSettings(const QString &name) const = 0; |
|
|
|
virtual SettingsPtr applicationSettings(const QString &name) const = 0; |
|
|
|
|
|
|
|
|
|
|
|
virtual ~Profile() = default; |
|
|
|
QString configurationName() const; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief QCoreApplication::applicationName() with optional configuration name appended |
|
|
|
* @brief QCoreApplication::applicationName() with optional configuration name appended |
|
|
@ -57,8 +66,9 @@ namespace Private |
|
|
|
explicit Profile(const QString &configurationName); |
|
|
|
explicit Profile(const QString &configurationName); |
|
|
|
|
|
|
|
|
|
|
|
QString configurationSuffix() const; |
|
|
|
QString configurationSuffix() const; |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
QString m_configurationSuffix; |
|
|
|
QString m_configurationName; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/// Default implementation. Takes paths from system
|
|
|
|
/// Default implementation. Takes paths from system
|
|
|
@ -67,7 +77,8 @@ namespace Private |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit DefaultProfile(const QString &configurationName); |
|
|
|
explicit DefaultProfile(const QString &configurationName); |
|
|
|
|
|
|
|
|
|
|
|
QString baseDirectory() const override; |
|
|
|
QString rootPath() const override; |
|
|
|
|
|
|
|
QString basePath() const override; |
|
|
|
QString cacheLocation() const override; |
|
|
|
QString cacheLocation() const override; |
|
|
|
QString configLocation() const override; |
|
|
|
QString configLocation() const override; |
|
|
|
QString dataLocation() const override; |
|
|
|
QString dataLocation() const override; |
|
|
@ -90,7 +101,8 @@ namespace Private |
|
|
|
public: |
|
|
|
public: |
|
|
|
CustomProfile(const QString &rootPath, const QString &configurationName); |
|
|
|
CustomProfile(const QString &rootPath, const QString &configurationName); |
|
|
|
|
|
|
|
|
|
|
|
QString baseDirectory() const override; |
|
|
|
QString rootPath() const override; |
|
|
|
|
|
|
|
QString basePath() const override; |
|
|
|
QString cacheLocation() const override; |
|
|
|
QString cacheLocation() const override; |
|
|
|
QString configLocation() const override; |
|
|
|
QString configLocation() const override; |
|
|
|
QString dataLocation() const override; |
|
|
|
QString dataLocation() const override; |
|
|
@ -98,11 +110,12 @@ namespace Private |
|
|
|
SettingsPtr applicationSettings(const QString &name) const override; |
|
|
|
SettingsPtr applicationSettings(const QString &name) const override; |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
QDir m_rootDirectory; |
|
|
|
const QDir m_rootDir; |
|
|
|
static constexpr const char *cacheDirName = "cache"; |
|
|
|
const QDir m_baseDir; |
|
|
|
static constexpr const char *configDirName = "config"; |
|
|
|
const QString m_cacheLocation; |
|
|
|
static constexpr const char *dataDirName = "data"; |
|
|
|
const QString m_configLocation; |
|
|
|
static constexpr const char *downloadsDirName = "downloads"; |
|
|
|
const QString m_dataLocation; |
|
|
|
|
|
|
|
const QString m_downloadLocation; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class PathConverter |
|
|
|
class PathConverter |
|
|
|