Added case name and summary header file

This commit is contained in:
Magne Sjaastad 2016-06-27 13:23:00 +02:00
parent bbf1574feb
commit 0a08e0f545
2 changed files with 55 additions and 3 deletions

View File

@ -37,6 +37,15 @@ RimGridSummaryCase::RimGridSummaryCase()
{
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "Associated3DCase", "Main View", "", "", "");
CAF_PDM_InitField(&m_userName, "UserName", QString("User Name"), "Case Name", "", "", "");
m_userName.xmlCapability()->setIOReadable(false);
m_userName.xmlCapability()->setIOWritable(false);
m_userName.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_summaryHeaderFilename, "SummaryHeaderFile", QString("Summary Header File"), "Summary File", "", "", "");
m_summaryHeaderFilename.xmlCapability()->setIOReadable(false);
m_summaryHeaderFilename.xmlCapability()->setIOWritable(false);
m_summaryHeaderFilename.uiCapability()->setUiReadOnly(true);
}
//--------------------------------------------------------------------------------------------------
@ -53,6 +62,8 @@ RimGridSummaryCase::~RimGridSummaryCase()
void RimGridSummaryCase::setAssociatedEclipseCase(RimEclipseCase* eclipseCase)
{
m_eclipseCase = eclipseCase;
updateUiNames();
}
//--------------------------------------------------------------------------------------------------
@ -69,3 +80,33 @@ QString RimGridSummaryCase::summaryHeaderFilename() const
return possibleSumHeaderFileName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridSummaryCase::initAfterRead()
{
updateUiNames();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridSummaryCase::updateUiNames()
{
m_summaryHeaderFilename = summaryHeaderFilename();
m_userName = baseName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridSummaryCase::baseName() const
{
if (!m_eclipseCase()) return QString();
QFileInfo gridFileInfo(m_eclipseCase()->gridFileName());
return gridFileInfo.completeBaseName();
}

View File

@ -32,13 +32,24 @@ public:
RimGridSummaryCase();
virtual ~RimGridSummaryCase();
void setAssociatedEclipseCase(RimEclipseCase* eclipseCase);
RimEclipseCase* associatedEclipseCase() { return m_eclipseCase(); }
void setAssociatedEclipseCase(RimEclipseCase* eclipseCase);
RimEclipseCase* associatedEclipseCase() { return m_eclipseCase(); }
virtual QString summaryHeaderFilename() const override;
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void initAfterRead();
private:
void updateUiNames();
QString baseName() const;
virtual QString summaryHeaderFilename() const override;
private:
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
caf::PdmField<QString> m_userName;
caf::PdmField<QString> m_summaryHeaderFilename;
};