@@ -24,28 +24,16 @@ namespace Nickvision::Application::Shared::Models
2424
2525 WindowGeometry Configuration::getWindowGeometry () const
2626 {
27- WindowGeometry geometry;
2827 if (!m_json[" WindowGeometry" ].is_object ())
2928 {
30- geometry.setWidth (800 );
31- geometry.setHeight (600 );
32- geometry.setIsMaximized (false );
33- return geometry;
29+ return { 800 , 600 , false };
3430 }
35- boost::json::object& obj{ m_json[" WindowGeometry" ].as_object () };
36- geometry.setWidth (obj[" Width" ].is_int64 () ? static_cast <long >(obj[" Width" ].as_int64 ()) : 800 );
37- geometry.setHeight (obj[" Height" ].is_int64 () ? static_cast <long >(obj[" Height" ].as_int64 ()) : 600 );
38- geometry.setIsMaximized (obj[" IsMaximized" ].is_bool () ? obj[" IsMaximized" ].as_bool () : false );
39- return geometry;
31+ return WindowGeometry (m_json[" WindowGeometry" ].as_object ());
4032 }
4133
4234 void Configuration::setWindowGeometry (const WindowGeometry& geometry)
4335 {
44- boost::json::object obj;
45- obj[" Width" ] = geometry.getWidth ();
46- obj[" Height" ] = geometry.getHeight ();
47- obj[" IsMaximized" ] = geometry.isMaximized ();
48- m_json[" WindowGeometry" ] = obj;
36+ m_json[" WindowGeometry" ] = geometry.toJson ();
4937 }
5038
5139 bool Configuration::getAutomaticallyCheckForUpdates () const
@@ -57,4 +45,4 @@ namespace Nickvision::Application::Shared::Models
5745 {
5846 m_json[" AutomaticallyCheckForUpdates" ] = check;
5947 }
60- }
48+ }
0 commit comments