Settings Class
(ScreenPlay::Settings)Global settings class for reading and writing settings. More...
Header: | #include <Settings> |
Public Functions
Settings(const shared_ptr<ScreenPlay::GlobalVariables> &globalVariables, QObject *parent = nullptr) | |
bool | anonymousTelemetry() const |
bool | autostart() const |
QString | decoder() const |
QString | gitBuildHash() const |
bool | highPriorityStart() const |
QString | language() const |
bool | offlineMode() const |
bool | pauseWallpaperWhenIngame() const |
bool | silentStart() const |
QVersionNumber | version() const |
Public Slots
void | setAnonymousTelemetry(bool anonymousTelemetry) |
void | setAutostart(bool autostart) |
void | setDecoder(QString decoder) |
void | setGitBuildHash(QString gitBuildHash) |
void | setHighPriorityStart(bool highPriorityStart) |
void | setLanguage(QString language) |
void | setOfflineMode(bool offlineMode) |
void | setPauseWallpaperWhenIngame(bool pauseWallpaperWhenIngame) |
void | setSilentStart(bool silentStart) |
void | setupWidgetAndWindowPaths() |
void | writeJsonFileFromResource(const QString &filename) |
bool | writeSingleSettingConfig(QString name, QVariant value) |
Signals
void | anonymousTelemetryChanged(bool anonymousTelemetry) |
void | autostartChanged(bool autostart) |
void | decoderChanged(QString decoder) |
void | gitBuildHashChanged(QString gitBuildHash) |
void | highPriorityStartChanged(bool highPriorityStart) |
void | languageChanged(QString language) |
void | offlineModeChanged(bool offlineMode) |
void | pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame) |
void | silentStartChanged(bool silentStart) |
Detailed Description
Used for:
- User configuration via AppDataLocalScreenPlayScreenPlay
- profiles.json - saved wallpaper and widgets config
- settings.json - saved settings like autostart and installedContentPath
- Computer\HKEY_CURRENT_USER\Software\ScreenPlay\ScreenPlay - ScreenPlayContentPath for steam plugin
- Communication via the SDK Connector
Currently we save the regular settings (not the setup of the wallpaper and widgets) in two different locations. This can change in the future!
Member Function Documentation
Settings::Settings(const shared_ptr<ScreenPlay::GlobalVariables> &globalVariables, QObject *parent = nullptr)
Constructor and sets up:
- Sets the git build hash via ScreenPlay.pro c++ define
- Checks the langauge via settings or system and available ones and installes a translator.
- Checks the paths for config folders in appdata
- Checks if settings.json and profiles.json are available. If first run it creates the default settings and profiles json.
- Parses the version and checks with the compiled one.
- Checks the absoluteStoragePath.
- Checks regisitry for steam plugin settings
- Parses autostart, anonymousTelemetry, highPriorityStart
- Checks ScreenPlayWallpaper and ScreenPlayWidgets executable paths.
More errorchecking is needed here. For example when the proile or settings json cannot to parsed, use the default settings.
[slot]
void Settings::setupWidgetAndWindowPaths()
To have a better developer experience we check if we use a debug version. Then we assume That the paths are the default QtCreator paths and set the widgets and wallpaper executable paths accordingly.
[slot]
void Settings::writeJsonFileFromResource(const QString &filename)
Writes the default JsonFile from the resources and the given filename. Currently we have two default json files:
- profiles.json
- settings.json
[slot]
bool Settings::writeSingleSettingConfig(QString name, QVariant value)
Save a single value with a given name (key) into the settings.json. Returns true
when successful otherise returns false
.