#4934 Preferences : More robust storing of data to registry

This commit is contained in:
Magne Sjaastad 2019-10-25 15:55:27 +02:00
parent 2f3fcf7eec
commit 72e3ddc35e
11 changed files with 19 additions and 12 deletions

View File

@ -312,7 +312,7 @@ bool RiaApplication::openFile( const QString& fileName )
}
else if ( fileType & RiaDefines::ANY_ECLIPSE_FILE )
{
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{fileName}, true );
loadingSucceded = RicImportGeneralDataFeature::openEclipseFilesFromFileNames( QStringList{ fileName }, true );
lastUsedDialogTag = RiaDefines::defaultDirectoryLabel( fileType );
}
@ -450,7 +450,7 @@ bool RiaApplication::loadProject( const QString& projectFileName,
// VL check regarding specific order mentioned in comment above...
m_preferences->lastUsedProjectFileName = fullPathProjectFileName;
caf::PdmSettings::writeFieldsToApplicationStore( m_preferences );
m_preferences->writePreferencesToApplicationStore();
for ( size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++ )
{
@ -707,7 +707,7 @@ bool RiaApplication::saveProjectAs( const QString& fileName, QString* errorMessa
}
m_preferences->lastUsedProjectFileName = fileName;
caf::PdmSettings::writeFieldsToApplicationStore( m_preferences );
m_preferences->writePreferencesToApplicationStore();
onProjectSaved();
@ -1186,7 +1186,8 @@ void RiaApplication::applyPreferences()
this->project()->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
this->project()->updateConnectedEditors();
}
caf::PdmSettings::writeFieldsToApplicationStore( m_preferences );
m_preferences->writePreferencesToApplicationStore();
}
//--------------------------------------------------------------------------------------------------

View File

@ -102,7 +102,6 @@
#include "cafAppEnum.h"
#include "cafEffectGenerator.h"
#include "cafFixedAtlasFont.h"
#include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h"
#include "cafPdmUiTreeView.h"
#include "cafProgressInfo.h"

View File

@ -26,6 +26,7 @@
#include "RifReaderSettings.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmSettings.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFieldHandle.h"
@ -793,3 +794,11 @@ std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> RiaPreferences::de
fontSizes[RiaDefines::PLOT_FONT] = defaultPlotFontSize();
return fontSizes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPreferences::writePreferencesToApplicationStore()
{
caf::PdmSettings::writeFieldsToApplicationStore( this );
}

View File

@ -88,6 +88,8 @@ public:
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
void writePreferencesToApplicationStore();
public: // Pdm Fields
caf::PdmField<caf::AppEnum<RiaGuiApplication::RINavigationPolicy>> navigationPolicy;

View File

@ -20,8 +20,6 @@
#include "RiaRegressionTestRunner.h"
#include "cafPdmSettings.h"
#include <QAction>
#include <QDir>

View File

@ -42,7 +42,6 @@
#include "Riu3DMainWindowTools.h"
#include "RiuPropertyViewTabWidget.h"
#include "cafPdmSettings.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
@ -162,7 +161,7 @@ void RicExportEclipseSectorModelFeature::executeCommand( RimEclipseView*
QString fileName = dirPath.absoluteFilePath( keyword + ".GRDECL" );
bool worked = RifEclipseInputFileTools::exportKeywords( fileName,
view->eclipseCase()->eclipseCaseData(),
{keyword},
{ keyword },
fileWriteMode,
min,
max,

View File

@ -24,7 +24,6 @@
#include "RiuMainWindow.h"
#include "cafPdmSettings.h"
#include "cafPdmUiPropertyViewDialog.h"
#include <QAction>

View File

@ -69,6 +69,7 @@ void RicCreatePlotFromTemplateByShortcutFeature::onActionTriggered( bool isCheck
fileName = fileNameSelectedInUi;
RiaApplication::instance()->preferences()->setDefaultPlotTemplatePath( fileName );
RiaApplication::instance()->preferences()->writePreferencesToApplicationStore();
}
auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases();

View File

@ -119,6 +119,7 @@ void RicSavePlotTemplateFeature::onActionTriggered( bool isChecked )
if ( ret == QMessageBox::Yes )
{
app->preferences()->appendPlotTemplateFolders( absPath );
app->preferences()->writePreferencesToApplicationStore();
}
}

View File

@ -49,7 +49,6 @@
#include "RimTimeStepFilter.h"
#include "RimTools.h"
#include "cafPdmSettings.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"

View File

@ -66,7 +66,6 @@
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeatureManager.h"
#include "cafMemoryInspector.h"
#include "cafPdmSettings.h"
#include "cafPdmUiPropertyView.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafPdmUiTreeView.h"