ASAPCabinetFE
 
Loading...
Searching...
No Matches
config_service.h
Go to the documentation of this file.
1
11#ifndef CONFIG_SERVICE_H
12#define CONFIG_SERVICE_H
13
15#include "iconfig_service.h"
16#include <nlohmann/json.hpp>
17#include <memory>
18#include <string>
19
31public:
41 ConfigService(const std::string& configPath, IKeybindProvider* keybindProvider);
42
46 ~ConfigService() override = default;
47
53 const Settings& getSettings() const override;
54
60 Settings& getMutableSettings() override;
61
68
76 bool isConfigValid() const override;
77
84 void loadConfig() override;
85
91 void saveConfig() override;
92
116 void updateWindowSetup(int& playfieldX, int& playfieldY, int& playfieldWidth, int& playfieldHeight,
117 int& backglassX, int& backglassY, int& backglassWidth, int& backglassHeight,
118 int& dmdX, int& dmdY, int& dmdWidth, int& dmdHeight,
119 int& topperX, int& topperY, int& topperWidth, int& topperHeight) override;
120
121private:
127 void applyPostProcessing();
128
136 void applyIniSettings(const std::optional<VPinballXIniSettings>& iniSettings);
137
145 void updateJsonWithIniValues(const std::optional<VPinballXIniSettings>& iniSettings);
146
147 std::string configPath_;
148 Settings settings_;
149 nlohmann::json jsonData_;
150 IKeybindProvider* keybindProvider_;
151};
152
153#endif // CONFIG_SERVICE_H
Concrete implementation of IConfigService for managing configuration.
Definition config_service.h:30
void saveConfig() override
Saves the current configuration data to the JSON file.
Definition config_service.cpp:148
Settings & getMutableSettings() override
Gets the current application settings (mutable).
Definition config_service.cpp:26
IKeybindProvider & getKeybindProvider() override
Gets the keybinding provider.
Definition config_service.cpp:30
bool isConfigValid() const override
Checks if the configuration is valid.
Definition config_service.cpp:38
const Settings & getSettings() const override
Gets the current application settings (read-only).
Definition config_service.cpp:22
~ConfigService() override=default
Virtual destructor for proper cleanup.
void loadConfig() override
Loads configuration data from the JSON file.
Definition config_service.cpp:97
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.
Definition config_service.cpp:254
Interface for configuration services (forward declaration).
Definition iconfig_service.h:30
Interface for keybind providers (forward declaration).
Definition ikeybind_provider.h:30
Defines the IConfigService interface for managing configuration in ASAPCabinetFE.
Definition settings.h:12
Defines the VPinballXIniReader class for reading VPX INI settings in ASAPCabinetFE.