mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
System command command file merger (#4845)
* Move Import WellPaths command-file functionality into RicImportWellPaths * Add new RICF_init macros for command file objects * Make project save commands available in Python * Fix RiaLogging build errors * Move RiaLogging include from RiaGrpcServer.h to cpp file
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "RicfCommandResponse.h"
|
||||
#include "RicfFieldCapability.h"
|
||||
#include "RicfObjectCapability.h"
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#define RICF_InitField( field, keyword, default, uiName, iconResourceName, toolTip, whatsThis ) \
|
||||
@@ -30,6 +31,20 @@
|
||||
CAF_PDM_InitFieldNoDefault( field, keyword, uiName, iconResourceName, toolTip, whatsThis ); \
|
||||
AddRicfCapabilityToField( field )
|
||||
|
||||
#define RICF_HEADER_INIT \
|
||||
CAF_CMD_HEADER_INIT; \
|
||||
CAF_PDM_HEADER_INIT
|
||||
|
||||
// RICF_SOURCE_INIT calls CAF_FACTORY_REGISTER2 to avoid name conflicts with CAF_PDM_SOURCE_INIT
|
||||
#define RICF_SOURCE_INIT( ClassName, CommandIdName, CommandKeyword ) \
|
||||
const std::string& ClassName::idNameStatic() \
|
||||
{ \
|
||||
static std::string id = CommandIdName; \
|
||||
return id; \
|
||||
} \
|
||||
CAF_FACTORY_REGISTER2( caf::CmdFeature, ClassName, std::string, ClassName::idNameStatic() ); \
|
||||
CAF_PDM_SOURCE_INIT( ClassName, CommandKeyword )
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
|
||||
@@ -48,7 +48,17 @@ RicfCommandResponse::Status RicfCommandResponse::status() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicfCommandResponse::sanitizedResponseMessage() const
|
||||
{
|
||||
return m_messages.join( ";;" );
|
||||
QString completeMessage = m_messages.join( ";;" );
|
||||
completeMessage.replace( '\n', ";;" );
|
||||
return completeMessage;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RicfCommandResponse::messages() const
|
||||
{
|
||||
return m_messages;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -72,11 +82,11 @@ void RicfCommandResponse::setResult( caf::PdmObject* result )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandResponse::updateStatus( Status status, const QString& message )
|
||||
{
|
||||
QString cleanedMessage = message;
|
||||
cleanedMessage.replace( '\n', ";;" );
|
||||
m_status = std::max( m_status, status );
|
||||
if ( !message.isEmpty() )
|
||||
m_messages.push_back( QString( "%1: %2" ).arg( statusLabel( status ) ).arg( cleanedMessage ) );
|
||||
{
|
||||
m_messages.push_back( QString( "%1: %2" ).arg( statusLabel( status ) ).arg( message ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -87,9 +97,9 @@ QString RicfCommandResponse::statusLabel( Status status )
|
||||
switch ( status )
|
||||
{
|
||||
case COMMAND_WARNING:
|
||||
return "WARNING";
|
||||
return "Warning";
|
||||
case COMMAND_ERROR:
|
||||
return "ERROR";
|
||||
return "Error";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
|
||||
Status status() const;
|
||||
QString sanitizedResponseMessage() const;
|
||||
QStringList messages() const;
|
||||
caf::PdmObject* result() const;
|
||||
void setResult( caf::PdmObject* result );
|
||||
void updateStatus( Status status, const QString& message );
|
||||
|
||||
Reference in New Issue
Block a user