mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Preferences : Added support for pdm objects recursively
This commit is contained in:
parent
0d14436b97
commit
11967c5161
@ -650,7 +650,7 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
riv->cellFaultResult()->updateVisibility();
|
||||
riv->faultResult()->updateVisibility();
|
||||
|
||||
|
||||
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
@ -1236,7 +1236,7 @@ bool RiaApplication::launchProcessForMultipleCases(const QString& program, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read fields of a Pdm object using QSettings
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
|
||||
void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object, const QString context)
|
||||
{
|
||||
QSettings settings;
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
@ -1247,10 +1247,24 @@ void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
|
||||
{
|
||||
caf::PdmFieldHandle* fieldHandle = fields[i];
|
||||
|
||||
if (settings.contains(fieldHandle->keyword()))
|
||||
std::vector<caf::PdmObject*> children;
|
||||
fieldHandle->childObjects(&children);
|
||||
for (size_t childIdx = 0; childIdx < children.size(); childIdx++)
|
||||
{
|
||||
QVariant val = settings.value(fieldHandle->keyword());
|
||||
fieldHandle->setValueFromUi(val);
|
||||
caf::PdmObject* child = children[childIdx];
|
||||
QString subContext = context + child->classKeyword() + "/";
|
||||
readFieldsFromApplicationStore(child, subContext);
|
||||
}
|
||||
|
||||
|
||||
if (children.size() == 0)
|
||||
{
|
||||
QString key = context + fieldHandle->keyword();
|
||||
if (settings.contains(key))
|
||||
{
|
||||
QVariant val = settings.value(key);
|
||||
fieldHandle->setValueFromUi(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1258,7 +1272,7 @@ void RiaApplication::readFieldsFromApplicationStore(caf::PdmObject* object)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Write fields of a Pdm object using QSettings
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object)
|
||||
void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object, const QString context)
|
||||
{
|
||||
CVF_ASSERT(object);
|
||||
|
||||
@ -1272,7 +1286,24 @@ void RiaApplication::writeFieldsToApplicationStore(const caf::PdmObject* object)
|
||||
{
|
||||
caf::PdmFieldHandle* fieldHandle = fields[i];
|
||||
|
||||
settings.setValue(fieldHandle->keyword(), fieldHandle->uiValue());
|
||||
std::vector<caf::PdmObject*> children;
|
||||
fieldHandle->childObjects(&children);
|
||||
for (size_t childIdx = 0; childIdx < children.size(); childIdx++)
|
||||
{
|
||||
caf::PdmObject* child = children[childIdx];
|
||||
QString subContext;
|
||||
if (context.isEmpty())
|
||||
{
|
||||
subContext = context + child->classKeyword() + "/";
|
||||
}
|
||||
|
||||
writeFieldsToApplicationStore(child, subContext);
|
||||
}
|
||||
|
||||
if (children.size() == 0)
|
||||
{
|
||||
settings.setValue(context + fieldHandle->keyword(), fieldHandle->uiValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,8 @@ public:
|
||||
void terminateProcess();
|
||||
|
||||
RiaPreferences* preferences();
|
||||
void readFieldsFromApplicationStore(caf::PdmObject* object);
|
||||
void writeFieldsToApplicationStore(const caf::PdmObject* object);
|
||||
void readFieldsFromApplicationStore(caf::PdmObject* object, const QString context = "");
|
||||
void writeFieldsToApplicationStore(const caf::PdmObject* object, const QString context = "");
|
||||
void applyPreferences();
|
||||
|
||||
cvf::Font* standardFont();
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
|
||||
caf::PdmField<RimResultSlot*> cellResult;
|
||||
caf::PdmField<RimCellEdgeResultSlot*> cellEdgeResult;
|
||||
caf::PdmField<RimFaultResultSlot*> cellFaultResult;
|
||||
caf::PdmField<RimFaultResultSlot*> faultResult;
|
||||
|
||||
caf::PdmField<RimCellRangeFilterCollection*> rangeFilterCollection;
|
||||
caf::PdmField<RimCellPropertyFilterCollection*> propertyFilterCollection;
|
||||
|
Loading…
Reference in New Issue
Block a user