mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-04 16:31:15 -05:00
save frequency snap value
This commit is contained in:
parent
8827ff9e26
commit
db434348a4
@ -121,6 +121,7 @@ AppConfig::AppConfig() {
|
||||
winH.store(0);
|
||||
winMax.store(false);
|
||||
themeId.store(0);
|
||||
snap.store(1);
|
||||
}
|
||||
|
||||
|
||||
@ -186,6 +187,15 @@ int AppConfig::getTheme() {
|
||||
}
|
||||
|
||||
|
||||
void AppConfig::setSnap(long long snapVal) {
|
||||
this->snap.store(snapVal);
|
||||
}
|
||||
|
||||
long long AppConfig::getSnap() {
|
||||
return snap.load();
|
||||
}
|
||||
|
||||
|
||||
bool AppConfig::save() {
|
||||
DataTree cfg;
|
||||
|
||||
@ -200,8 +210,8 @@ bool AppConfig::save() {
|
||||
*window_node->newChild("h") = winH.load();
|
||||
|
||||
*window_node->newChild("max") = winMax.load();
|
||||
|
||||
*window_node->newChild("theme") = themeId.load();
|
||||
*window_node->newChild("snap") = snap.load();
|
||||
}
|
||||
|
||||
DataNode *devices_node = cfg.rootNode()->newChild("devices");
|
||||
@ -275,6 +285,11 @@ bool AppConfig::load() {
|
||||
themeId.store(theme);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("snap")) {
|
||||
long long snapVal;
|
||||
win_node->getNext("snap")->element()->get(snapVal);
|
||||
snap.store(snapVal);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.rootNode()->hasAnother("devices")) {
|
||||
|
@ -55,7 +55,10 @@ public:
|
||||
|
||||
void setTheme(int themeId);
|
||||
int getTheme();
|
||||
|
||||
|
||||
void setSnap(long long snapVal);
|
||||
long long getSnap();
|
||||
|
||||
bool save();
|
||||
bool load();
|
||||
bool reset();
|
||||
@ -65,4 +68,5 @@ private:
|
||||
std::atomic_int winX,winY,winW,winH;
|
||||
std::atomic_bool winMax;
|
||||
std::atomic_int themeId;
|
||||
std::atomic_llong snap;
|
||||
};
|
||||
|
@ -319,6 +319,9 @@ AppFrame::AppFrame() :
|
||||
if (max) {
|
||||
this->Maximize();
|
||||
}
|
||||
|
||||
long long freqSnap = wxGetApp().getConfig()->getSnap();
|
||||
wxGetApp().setFrequencySnap(freqSnap);
|
||||
|
||||
ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme());
|
||||
|
||||
@ -528,6 +531,7 @@ void AppFrame::OnClose(wxCloseEvent& event) {
|
||||
wxGetApp().getConfig()->setWindow(this->GetPosition(), this->GetClientSize());
|
||||
wxGetApp().getConfig()->setWindowMaximized(this->IsMaximized());
|
||||
wxGetApp().getConfig()->setTheme(ThemeMgr::mgr.getTheme());
|
||||
wxGetApp().getConfig()->setSnap(wxGetApp().getFrequencySnap());
|
||||
wxGetApp().getConfig()->save();
|
||||
event.Skip();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user