Concrete implementation of IConfigService for managing configuration. More...
#include <config_service.h>
Public Member Functions | |
ConfigService (const std::string &configPath, IKeybindProvider *keybindProvider) | |
Constructs a ConfigService instance. | |
~ConfigService () override=default | |
Virtual destructor for proper cleanup. | |
const Settings & | getSettings () const override |
Gets the current application settings (read-only). | |
Settings & | getMutableSettings () override |
Gets the current application settings (mutable). | |
IKeybindProvider & | getKeybindProvider () override |
Gets the keybinding provider. | |
bool | isConfigValid () const override |
Checks if the configuration is valid. | |
void | loadConfig () override |
Loads configuration data from the JSON file. | |
void | saveConfig () override |
Saves the current configuration data to the JSON file. | |
void | updateWindowSetup (int &playfieldX, int &playfieldY, int &playfieldWidth, int &playfieldHeight, int &backglassX, int &backglassY, int &backglassWidth, int &backglassHeight, int &dmdX, int &dmdY, int &dmdWidth, int &dmdHeight, int &topperX, int &topperY, int &topperWidth, int &topperHeight) override |
Updates window setup coordinates and dimensions. | |
![]() | |
virtual | ~IConfigService ()=default |
Virtual destructor for proper cleanup of derived classes. | |
Concrete implementation of IConfigService for managing configuration.
This class implements the IConfigService interface to load, save, and validate JSON configuration data, manage keybindings, and apply VPinballX.ini settings when enabled. It handles file operations, post-processing of settings, and updates to window positions, providing a complete configuration solution for ASAPCabinetFE.
ConfigService::ConfigService | ( | const std::string & | configPath, |
IKeybindProvider * | keybindProvider | ||
) |
Constructs a ConfigService instance.
Initializes the configuration service with the specified configuration file path and keybind provider.
configPath | The file path to the configuration file. |
keybindProvider | Unique pointer to the IKeybindProvider implementation. |
|
overridevirtual |
Gets the keybinding provider.
Implements IConfigService.
|
overridevirtual |
Gets the current application settings (mutable).
Implements IConfigService.
|
overridevirtual |
Gets the current application settings (read-only).
Implements IConfigService.
|
overridevirtual |
Checks if the configuration is valid.
Validates essential parameters such as VPinballXPath and VPXTablesPath.
Implements IConfigService.
|
overridevirtual |
Loads configuration data from the JSON file.
Reads and parses the configuration file, applying defaults and VPinballX.ini settings if enabled.
Implements IConfigService.
|
overridevirtual |
Saves the current configuration data to the JSON file.
Writes the current settings and keybindings to the configuration file.
Implements IConfigService.
|
overridevirtual |
Updates window setup coordinates and dimensions.
Updates the configuration with the current window positions and sizes, then saves the changes to the JSON file.
playfieldX | Reference to the playfield window X coordinate. |
playfieldY | Reference to the playfield window Y coordinate. |
playfieldWidth | Reference to the playfield window width. |
playfieldHeight | Reference to the playfield window height. |
backglassX | Reference to the backglass window X coordinate. |
backglassY | Reference to the backglass window Y coordinate. |
backglassWidth | Reference to the backglass window width. |
backglassHeight | Reference to the backglass window height. |
dmdX | Reference to the DMD window X coordinate. |
dmdY | Reference to the DMD window Y coordinate. |
dmdWidth | Reference to the DMD window width. |
dmdHeight | Reference to the DMD window height. |
topperX | Reference to the topper window X coordinate. |
topperY | Reference to the topper window Y coordinate. |
topperWidth | Reference to the topper window width. |
topperHeight | Reference to the topper window height. |
Implements IConfigService.