#1677 Store dialog data in project file

This commit is contained in:
Magne Sjaastad
2017-06-30 16:14:15 +02:00
parent f8f57d3184
commit 78a779424f
8 changed files with 189 additions and 22 deletions

View File

@@ -89,6 +89,7 @@ ${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.h
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.h
${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.h
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.h
${CEE_CURRENT_LIST_DIR}RimDialogData.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -176,6 +177,7 @@ ${CEE_CURRENT_LIST_DIR}RimCheckableNamedObject.cpp
${CEE_CURRENT_LIST_DIR}RimGridTimeHistoryCurve.cpp
${CEE_CURRENT_LIST_DIR}RimGeometrySelectionItem.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.cpp
${CEE_CURRENT_LIST_DIR}RimDialogData.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimDialogData.h"
#include "ExportCommands/RicExportCarfinUi.h"
CAF_PDM_SOURCE_INIT(RimDialogData, "RimDialogData");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDialogData::RimDialogData()
{
CAF_PDM_InitObject("Dialog Data", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_exportCarfin, "ExportCarfin", "ExportCarfin", "", "", "");
m_exportCarfin = new RicExportCarfinUi;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicExportCarfinUi* RimDialogData::exportCarfin() const
{
return m_exportCarfin;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimDialogData::exportCarfinDataAsString() const
{
return m_exportCarfin->writeObjectToXmlString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDialogData::setExportCarfinDataFromString(const QString& data)
{
m_exportCarfin->readObjectFromXmlString(data, caf::PdmDefaultObjectFactory::instance());
m_exportCarfin->resolveReferencesRecursively();
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmChildField.h"
class RicExportCarfinUi;
//==================================================================================================
///
///
//==================================================================================================
class RimDialogData : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimDialogData();
RicExportCarfinUi* exportCarfin() const;
QString exportCarfinDataAsString() const;
void setExportCarfinDataFromString(const QString& data);
private:
caf::PdmChildField<RicExportCarfinUi*> m_exportCarfin;
};

View File

@@ -31,6 +31,7 @@
#include "RimCaseCollection.h"
#include "RimCommandObject.h"
#include "RimContextCommandBuilder.h"
#include "RimDialogData.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimFlowPlotCollection.h"
@@ -121,6 +122,11 @@ RimProject::RimProject(void)
CAF_PDM_InitField(&m_showPlotWindow, "showPlotWindow", false, "Show Plot Window", "", "", "");
m_showPlotWindow.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_dialogData, "DialogData", "DialogData", "", "", "");
m_dialogData = new RimDialogData();
m_dialogData.uiCapability()->setUiHidden(true);
m_dialogData.uiCapability()->setUiTreeChildrenHidden(true);
// Obsolete fields. The content is moved to OilFields and friends
CAF_PDM_InitFieldNoDefault(&casesObsolete, "Reservoirs", "", "", "", "");
casesObsolete.uiCapability()->setUiHidden(true);
@@ -771,6 +777,14 @@ void RimProject::reloadCompletionTypeResultsInAllViews()
removeEclipseResultAndRedrawAllViews(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDialogData* RimProject::dialogData() const
{
return m_dialogData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -34,6 +34,7 @@ class RigMainGrid;
class RimCase;
class RimCommandObject;
class RimDialogData;
class RimEclipseCase;
class RimIdenticalGridCaseGroup;
class RimMainPlotCollection;
@@ -110,6 +111,7 @@ public:
void reloadCompletionTypeResultsInAllViews();
RimDialogData* dialogData() const;
protected:
// Overridden methods
@@ -126,6 +128,9 @@ private:
private:
caf::PdmField<QString> m_projectFileVersionString;
caf::PdmChildField<RimDialogData*> m_dialogData;
caf::PdmField<bool> m_show3DWindow;
caf::PdmField<bool> m_showPlotWindow;