Add rename case to summary and grid cases (#9204)

* #9203 Summary Case : Add rename to right-click menu
* Janitor: Move ID and description to private fields
* Eclipse Case: Add rename to right-click menu
* Rename feature
This commit is contained in:
Magne Sjaastad
2022-08-17 22:12:23 -07:00
parent a36c07dd64
commit df16e1fe5c
38 changed files with 331 additions and 71 deletions

View File

@@ -85,6 +85,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.h
${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteUncheckedSubItemsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRenameSummaryCaseFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -173,6 +174,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteUncheckedSubItemsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRenameSummaryCaseFeature.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@@ -18,6 +18,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewInViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRenameCaseFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -40,6 +41,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewInViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRenameCaseFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor 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 "RicRenameCaseFeature.h"
#include "RimCase.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QInputDialog>
CAF_CMD_SOURCE_INIT( RicRenameCaseFeature, "RicRenameCaseFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRenameCaseFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRenameCaseFeature::onActionTriggered( bool isChecked )
{
auto rimCase = caf::SelectionManager::instance()->selectedItemOfType<RimCase>();
if ( !rimCase ) return;
bool ok;
QString userDefinedName = QInputDialog::getText( nullptr,
"Rename Case",
"Enter new name:",
QLineEdit::Normal,
rimCase->caseUserDescription(),
&ok );
if ( !ok ) return;
rimCase->setCustomCaseName( userDefinedName.trimmed() );
rimCase->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRenameCaseFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Rename" );
}

View File

@@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor 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 "cafCmdFeature.h"
class RicRenameCaseFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -96,7 +96,7 @@ void RicExecuteScriptForCasesFeature::onActionTriggered( bool isChecked )
for ( RimCase* rimCase : selection )
{
caseIdsInSelection.push_back( rimCase->caseId );
caseIdsInSelection.push_back( rimCase->caseId() );
}
}

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor 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 "RicRenameSummaryCaseFeature.h"
#include "RimSummaryCase.h"
#include "cafSelectionManager.h"
#include <QAction>
#include <QInputDialog>
CAF_CMD_SOURCE_INIT( RicRenameSummaryCaseFeature, "RicRenameSummaryCaseFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRenameSummaryCaseFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRenameSummaryCaseFeature::onActionTriggered( bool isChecked )
{
auto summaryCase = caf::SelectionManager::instance()->selectedItemOfType<RimSummaryCase>();
if ( !summaryCase ) return;
bool ok;
QString userDefinedName = QInputDialog::getText( nullptr,
"Rename Case",
"Enter new name:",
QLineEdit::Normal,
summaryCase->displayCaseName(),
&ok );
if ( !ok ) return;
summaryCase->setCustomCaseName( userDefinedName.trimmed() );
summaryCase->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRenameSummaryCaseFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Rename" );
}

View File

@@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor 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 "cafCmdFeature.h"
class RicRenameSummaryCaseFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -96,7 +96,7 @@ void RicReplaceCaseFeature::onActionTriggered( bool isChecked )
// Use the file base name as case user description
QFileInfo fi( fileName );
selectedCase->caseUserDescription = fi.baseName();
selectedCase->setCaseUserDescription( fi.baseName() );
// Find and update attached grid summary cases.
RimSummaryCaseMainCollection* sumCaseColl = RiaSummaryTools::summaryCaseMainCollection();

View File

@@ -28,7 +28,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -61,7 +61,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewWellMeasurementCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleWellLogCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewRftWellLogCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewRftSegmentWellLogPlotFeature.cpp
)
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewRftSegmentWellLogCurveFeature.h"
#include "RicNewRftSegmentWellLogPlotFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
@@ -43,12 +43,12 @@
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewRftSegmentWellLogCurveFeature, "RicNewRftSegmentWellLogCurveFeature" );
CAF_CMD_SOURCE_INIT( RicNewRftSegmentWellLogPlotFeature, "RicNewRftSegmentWellLogCurveFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewRftSegmentWellLogCurveFeature::isCommandEnabled()
bool RicNewRftSegmentWellLogPlotFeature::isCommandEnabled()
{
return true;
}
@@ -56,7 +56,7 @@ bool RicNewRftSegmentWellLogCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogCurveFeature::onActionTriggered( bool isChecked )
void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
{
auto rftCase = caf::SelectionManager::instance()->selectedItemOfType<RimRftCase>();
if ( !rftCase ) return;
@@ -91,10 +91,10 @@ void RicNewRftSegmentWellLogCurveFeature::onActionTriggered( bool isChecked )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogCurveFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& resultName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
void RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& resultName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
@@ -112,8 +112,8 @@ void RicNewRftSegmentWellLogCurveFeature::appendTrackAndCurveForBranchType( RimW
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogCurveFeature::setupActionLook( QAction* actionToSetup )
void RicNewRftSegmentWellLogPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Append RFT Segment Curve" );
actionToSetup->setText( "Create RFT Segment Plot" );
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
}

View File

@@ -28,7 +28,7 @@ class RimSummaryCase;
//==================================================================================================
///
//==================================================================================================
class RicNewRftSegmentWellLogCurveFeature : public caf::CmdFeature
class RicNewRftSegmentWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;