mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-22 05:30:44 +00:00
When loading settings, leave unspecified defaults alone.
This prevents new charts (such as CPAP_PressureSet, etc.) from being disabled by virtue of their being absent from existing settings.
This commit is contained in:
parent
8740ddf923
commit
d02e1dd235
@ -3462,6 +3462,18 @@ void gGraphView::SaveSettings(QString title)
|
|||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Merge and overwrite two hashes. (We can't use QHash::unite because it doesn't overwrite.)
|
||||||
|
// This is useful for loading settings, where we want to leave the defaults alone for features
|
||||||
|
// that don't yet have settings specified.
|
||||||
|
template <class T> inline void hashMerge(T & a, const T & b)
|
||||||
|
{
|
||||||
|
for (auto key : b.keys()) {
|
||||||
|
a[key] = b[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool gGraphView::LoadSettings(QString title)
|
bool gGraphView::LoadSettings(QString title)
|
||||||
{
|
{
|
||||||
QString filename = p_profile->Get("{DataFolder}/") + title.toLower() + ".shg";
|
QString filename = p_profile->Get("{DataFolder}/") + title.toLower() + ".shg";
|
||||||
@ -3568,10 +3580,9 @@ bool gGraphView::LoadSettings(QString title)
|
|||||||
if (layertype == LT_LineChart) {
|
if (layertype == LT_LineChart) {
|
||||||
gLineChart * lc = dynamic_cast<gLineChart *>(findLayer(g, LT_LineChart));
|
gLineChart * lc = dynamic_cast<gLineChart *>(findLayer(g, LT_LineChart));
|
||||||
if (lc) {
|
if (lc) {
|
||||||
lc->m_flags_enabled = flags_enabled;
|
hashMerge(lc->m_flags_enabled, flags_enabled);
|
||||||
lc->m_enabled = plots_enabled;
|
hashMerge(lc->m_enabled, plots_enabled);
|
||||||
|
hashMerge(lc->m_dot_enabled, dot_enabled);
|
||||||
lc->m_dot_enabled = dot_enabled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user