Skip to content

Commit

Permalink
Review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Jan 29, 2024
1 parent 4b4920b commit 69cd06a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
16 changes: 5 additions & 11 deletions ApplicationLibCode/Commands/RicImportWellLogCsvFileFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "RimWellLogCsvFile.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuFileDialogTools.h"

#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"

#include "cafSelectionManager.h"

Expand All @@ -52,8 +52,7 @@ void RicImportWellLogCsvFileFeature::onActionTriggered( bool isChecked )
{
QString pathCacheName = "WELL_LOGS_DIR";

auto wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
if ( wellPath )
if ( auto wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>() )
{
RiaGuiApplication* app = RiaGuiApplication::instance();

Expand All @@ -63,18 +62,13 @@ void RicImportWellLogCsvFileFeature::onActionTriggered( bool isChecked )

if ( fileName.isEmpty() ) return;

RimWellLogCsvFile* wellLogCsvFile = new RimWellLogCsvFile;
wellLogCsvFile->setFileName( fileName );

RimOilField* oilField = RimProject::current()->activeOilField();

if ( oilField == nullptr ) return;

if ( !oilField->wellPathCollection )
{
oilField->wellPathCollection = std::make_unique<RimWellPathCollection>();
}
if ( !oilField->wellPathCollection ) oilField->wellPathCollection = std::make_unique<RimWellPathCollection>();

RimWellLogCsvFile* wellLogCsvFile = new RimWellLogCsvFile;
wellLogCsvFile->setFileName( fileName );
oilField->wellPathCollection->addWellLog( wellLogCsvFile, wellPath );

QString errorMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ void RimWellLogFile::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
void RimWellLogFile::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiDateEditorAttribute* attrib = dynamic_cast<caf::PdmUiDateEditorAttribute*>( attribute );
if ( attrib != nullptr )
if ( caf::PdmUiDateEditorAttribute* attrib = dynamic_cast<caf::PdmUiDateEditorAttribute*>( attribute ) )
{
attrib->dateFormat = RiaQDateTimeTools::dateFormatString();
}
Expand Down

0 comments on commit 69cd06a

Please sign in to comment.