settings file and save/restore ui state
This commit is contained in:
26
src/settings.cpp
Normal file
26
src/settings.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "pch.h"
|
||||
#include "settings.h"
|
||||
#include "app.h"
|
||||
|
||||
Settings Settings::I;
|
||||
|
||||
bool Settings::load()
|
||||
{
|
||||
auto path = App::I.data_path + "/settings/pref.bin";
|
||||
BinaryStreamReader sr;
|
||||
if (sr.load(path))
|
||||
{
|
||||
I.props.clear();
|
||||
return I.read(sr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Settings::save()
|
||||
{
|
||||
auto path = App::I.data_path + "/settings/pref.bin";
|
||||
BinaryStreamWriter sw;
|
||||
sw.init();
|
||||
I.write(sw);
|
||||
return sw.save(path);
|
||||
}
|
||||
Reference in New Issue
Block a user