game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
core::SettingsController::Impl Class Reference
Collaboration diagram for core::SettingsController::Impl:

Public Member Functions

 Impl ()
std::string getConfigDirectory () const
std::string getLegacyConfFilePath () const
std::string getLegacyDataDirectory () const
std::string getLegacySettingsFilePath () const
std::string getSettingsFilePath () const
std::string getStateDirectory () const
std::string getStateFilePath () const
void initializeDefaults ()
void notifyChangedUnsafe (const std::string &section, const std::string &key, const OnSettingsChanged &callback)

Static Public Member Functions

static void applyAppSection (const nlohmann::json &j, AppSettings &s)
static void applyGamingLayoutSection (const nlohmann::json &j, AppSettings &s)
static void applyHomeAssistantSection (const nlohmann::json &j, AppSettings &s)
static void applyPanelStateSection (const nlohmann::json &j, AppSettings &s)
static void applyThemeSection (const nlohmann::json &j, AppSettings &s)
static bool checkSchemaVersionSafe (const nlohmann::json &j, const std::string &path)
static std::string envOrEmpty (const char *name)
static std::optional< nlohmann::json > readJsonFile (const std::string &path)
 Try to read+parse a JSON file.

Public Attributes

AppSettings appSettings_
bool dirty_ = false
std::mutex mutex_
OnSettingsChanged onSettingsChanged_
OnSettingsLoaded onSettingsLoaded_
OnSettingsSaved onSettingsSaved_
nlohmann::json rawConfigJson_
nlohmann::json rawStateJson_

Static Public Attributes

static constexpr int kSchemaVersion = 1

Detailed Description

Definition at line 33 of file settings_controller.cpp.

Constructor & Destructor Documentation

◆ Impl()

core::SettingsController::Impl::Impl ( )
inline

Definition at line 36 of file settings_controller.cpp.

References initializeDefaults().

Member Function Documentation

◆ applyAppSection()

◆ applyGamingLayoutSection()

◆ applyHomeAssistantSection()

void core::SettingsController::Impl::applyHomeAssistantSection ( const nlohmann::json & j,
AppSettings & s )
inlinestatic

◆ applyPanelStateSection()

◆ applyThemeSection()

void core::SettingsController::Impl::applyThemeSection ( const nlohmann::json & j,
AppSettings & s )
inlinestatic

◆ checkSchemaVersionSafe()

bool core::SettingsController::Impl::checkSchemaVersionSafe ( const nlohmann::json & j,
const std::string & path )
inlinestatic

Definition at line 167 of file settings_controller.cpp.

References Logger::error(), and kSchemaVersion.

Referenced by core::SettingsController::loadSettings().

◆ envOrEmpty()

std::string core::SettingsController::Impl::envOrEmpty ( const char * name)
inlinestatic

◆ getConfigDirectory()

std::string core::SettingsController::Impl::getConfigDirectory ( ) const
inline

Definition at line 96 of file settings_controller.cpp.

References envOrEmpty().

Referenced by getSettingsFilePath(), and getStateDirectory().

◆ getLegacyConfFilePath()

std::string core::SettingsController::Impl::getLegacyConfFilePath ( ) const
inline

Definition at line 156 of file settings_controller.cpp.

References getLegacyDataDirectory().

◆ getLegacyDataDirectory()

std::string core::SettingsController::Impl::getLegacyDataDirectory ( ) const
inline

Definition at line 130 of file settings_controller.cpp.

References envOrEmpty().

Referenced by getLegacyConfFilePath(), and getLegacySettingsFilePath().

◆ getLegacySettingsFilePath()

std::string core::SettingsController::Impl::getLegacySettingsFilePath ( ) const
inline

Definition at line 152 of file settings_controller.cpp.

References getLegacyDataDirectory().

◆ getSettingsFilePath()

std::string core::SettingsController::Impl::getSettingsFilePath ( ) const
inline

Definition at line 144 of file settings_controller.cpp.

References getConfigDirectory().

◆ getStateDirectory()

std::string core::SettingsController::Impl::getStateDirectory ( ) const
inline

Definition at line 110 of file settings_controller.cpp.

References envOrEmpty(), and getConfigDirectory().

Referenced by getStateFilePath().

◆ getStateFilePath()

std::string core::SettingsController::Impl::getStateFilePath ( ) const
inline

Definition at line 148 of file settings_controller.cpp.

References getStateDirectory().

◆ initializeDefaults()

void core::SettingsController::Impl::initializeDefaults ( )
inline

Definition at line 41 of file settings_controller.cpp.

References appSettings_, dirty_, rawConfigJson_, and rawStateJson_.

Referenced by Impl().

◆ notifyChangedUnsafe()

void core::SettingsController::Impl::notifyChangedUnsafe ( const std::string & section,
const std::string & key,
const OnSettingsChanged & callback )
inline

Definition at line 334 of file settings_controller.cpp.

References core::SettingsChangedEvent::section.

◆ readJsonFile()

std::optional< nlohmann::json > core::SettingsController::Impl::readJsonFile ( const std::string & path)
inlinestatic

Try to read+parse a JSON file.

Returns nullopt on missing-or-malformed. Logs (info/error respectively) so the caller can stay terse.

Definition at line 316 of file settings_controller.cpp.

References Logger::error().

Referenced by core::SettingsController::loadSettings().

Member Data Documentation

◆ appSettings_

AppSettings core::SettingsController::Impl::appSettings_

Definition at line 56 of file settings_controller.cpp.

Referenced by initializeDefaults().

◆ dirty_

bool core::SettingsController::Impl::dirty_ = false

Definition at line 65 of file settings_controller.cpp.

Referenced by initializeDefaults().

◆ kSchemaVersion

int core::SettingsController::Impl::kSchemaVersion = 1
staticconstexpr

◆ mutex_

std::mutex core::SettingsController::Impl::mutex_
mutable

Definition at line 66 of file settings_controller.cpp.

◆ onSettingsChanged_

OnSettingsChanged core::SettingsController::Impl::onSettingsChanged_

Definition at line 69 of file settings_controller.cpp.

◆ onSettingsLoaded_

OnSettingsLoaded core::SettingsController::Impl::onSettingsLoaded_

Definition at line 71 of file settings_controller.cpp.

◆ onSettingsSaved_

OnSettingsSaved core::SettingsController::Impl::onSettingsSaved_

Definition at line 70 of file settings_controller.cpp.

◆ rawConfigJson_

nlohmann::json core::SettingsController::Impl::rawConfigJson_

Definition at line 61 of file settings_controller.cpp.

Referenced by initializeDefaults().

◆ rawStateJson_

nlohmann::json core::SettingsController::Impl::rawStateJson_

Definition at line 62 of file settings_controller.cpp.

Referenced by initializeDefaults().


The documentation for this class was generated from the following file: