66
77#include < spdlog/spdlog.h>
88
9- SettingsManager::SettingsManager (ServiceProvider* service_provider) : m_service_provider{ service_provider } {
9+ SettingsManager::SettingsManager () {
1010 const std::filesystem::path settings_file = utils::get_root_folder () / detail::settings_filename;
1111
1212 const auto result = json::try_parse_json_file<detail::Settings>(settings_file);
@@ -18,7 +18,11 @@ SettingsManager::SettingsManager(ServiceProvider* service_provider) : m_service_
1818 spdlog::warn (" applying default settings" );
1919
2020 m_settings = {
21- detail::Settings{ {}, std::nullopt , 1.0 , false }
21+ detail::Settings{ .controls = {},
22+ .selected = std::nullopt ,
23+ .volume = 1.0 ,
24+ .discord = false ,
25+ .api_url = std::nullopt }
2226 };
2327 }
2428}
@@ -34,15 +38,17 @@ void detail::to_json(nlohmann::json& obj, const detail::Settings& settings) {
3438 { " controls" ,
3539 nlohmann::json{ { " inputs" , settings.controls }, { " selected" , settings.selected } },
3640 { " volume" , settings.volume },
37- { " discord" , settings.discord } }
41+ { " discord" , settings.discord },
42+ { " api_url" , settings.api_url } }
3843 };
3944}
4045
4146void detail::from_json (const nlohmann::json& obj, detail::Settings& settings) {
4247
43- ::json::check_for_no_additional_keys (obj, { " controls" , " volume" , " discord" });
48+ ::json::check_for_no_additional_keys (obj, { " controls" , " volume" , " discord" , " api_url " });
4449
4550 obj.at (" volume" ).get_to (settings.volume );
51+ obj.at (" api_url" ).get_to (settings.api_url );
4652 obj.at (" discord" ).get_to (settings.discord );
4753
4854 const auto & controls = obj.at (" controls" );
0 commit comments