Add saving of filters

* The current filter is preserved across runs even if it's not explicitly saved.
  Saved filters are only updated with an explicit save - loading a filter then
  making a change just cahnges the current scratch filter, it doesn't update the
  saved filter until the user explicitly saves it.
This commit is contained in:
baldurk
2021-07-01 15:15:03 +01:00
parent c5457a141b
commit ca3e3afa66
4 changed files with 323 additions and 3 deletions
@@ -163,6 +163,18 @@ struct LegacyData
QVariantMap _ConfigSettings;
};
static rdcarray<rdcpair<rdcstr, CustomPersistentStorage *>> &GetCustomStorage()
{
static rdcarray<rdcpair<rdcstr, CustomPersistentStorage *>> ret;
return ret;
}
CustomPersistentStorage::CustomPersistentStorage(rdcstr name)
{
if(!name.empty())
GetCustomStorage().push_back({name, this});
}
QVariantMap PersistantConfig::storeValues() const
{
QVariantMap ret;
@@ -186,6 +198,11 @@ QVariantMap PersistantConfig::storeValues() const
ret[lit("ShaderViewer_FriendlyNaming")] = m_Legacy->_ShaderViewer_FriendlyNaming;
ret[lit("ConfigSettings")] = m_Legacy->_ConfigSettings;
for(const rdcpair<rdcstr, CustomPersistentStorage *> &ps : GetCustomStorage())
{
ps.second->save(ret[QString(ps.first)]);
}
return ret;
}
@@ -295,6 +312,9 @@ void PersistantConfig::applyValues(const QVariantMap &values)
if(saveConfig)
RENDERDOC_SaveConfigSettings();
for(const rdcpair<rdcstr, CustomPersistentStorage *> &ps : GetCustomStorage())
ps.second->load(values[QString(ps.first)]);
}
static QMutex RemoteHostLock;