• Settings
  • Settings Class

    class ScreenPlay::Settings

    Global settings class for reading and writing settings. More...

    Header: #include <Settings>

    Public Functions

    Settings(const std::shared_ptr<GlobalVariables> &globalVariables, QObject *parent = nullptr)
    bool anonymousTelemetry() const
    bool autostart() const
    bool checkWallpaperVisible() const
    QString decoder() const
    ScreenPlay::Settings::DesktopEnvironment desktopEnvironment() const
    QString font() const
    QString gitBuildHash() const
    bool highPriorityStart() const
    ScreenPlay::Settings::Language language() const
    bool offlineMode() const
    void setupLanguage()
    bool silentStart() const
    bool steamVersion() const
    ScreenPlay::Settings::Theme theme() const
    ScreenPlay::FillMode::FillMode videoFillMode() const

    Public Slots

    bool retranslateUI()
    void setAnonymousTelemetry(bool anonymousTelemetry)
    void setAutostart(bool autostart)
    void setCheckWallpaperVisible(bool checkWallpaperVisible)
    void setDecoder(QString decoder)
    void setDesktopEnvironment(ScreenPlay::Settings::DesktopEnvironment desktopEnvironment)
    void setFont(QString font)
    void setGitBuildHash(QString gitBuildHash)
    void setHighPriorityStart(bool highPriorityStart)
    void setLanguage(ScreenPlay::Settings::Language language)
    void setOfflineMode(bool offlineMode)
    void setSilentStart(bool silentStart)
    void setSteamVersion(bool steamVersion)
    void setTheme(ScreenPlay::Settings::Theme theme)
    void setVideoFillMode(ScreenPlay::FillMode::FillMode videoFillMode)
    void setupWidgetAndWindowPaths()
    void writeJsonFileFromResource(const QString &filename)

    Signals

    void anonymousTelemetryChanged(bool anonymousTelemetry)
    void autostartChanged(bool autostart)
    void checkWallpaperVisibleChanged(bool checkWallpaperVisible)
    void decoderChanged(QString decoder)
    void desktopEnvironmentChanged(ScreenPlay::Settings::DesktopEnvironment desktopEnvironment)
    void fontChanged(QString font)
    void gitBuildHashChanged(QString gitBuildHash)
    void highPriorityStartChanged(bool highPriorityStart)
    void languageChanged(ScreenPlay::Settings::Language language)
    void offlineModeChanged(bool offlineMode)
    void silentStartChanged(bool silentStart)
    void steamVersionChanged(bool steamVersion)
    void themeChanged(ScreenPlay::Settings::Theme theme)
    void videoFillModeChanged(ScreenPlay::FillMode::FillMode videoFillMode)

    Detailed Description

    Used for:

    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 std::shared_ptr<GlobalVariables> &globalVariables, QObject *parent = nullptr)

    Constructor and sets up:

    1. Sets the git build hash via ScreenPlay.pro c++ define
    2. Checks the langauge via settings or system and available ones and installes a translator.
    3. Checks the AbsoluteStoragePath.
    4. Checks regisitry for steam plugin settings
    5. Parses autostart, anonymousTelemetry, highPriorityStart
    6. 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] bool Settings::retranslateUI()

    Check for supported langauges. If we use a langauge that not uses latin characters, we change the font. For example this happens for korean user. We ship google Noto Sans CJK KR Regular for this..

    [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:

    void Settings::setupLanguage()

    Checks if there is already a saved language. If not we try to use the system langauge. If we do not support the system language we use english.