mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Convert to enum class
This commit is contained in:
@@ -56,17 +56,17 @@ RiuMessagePanel::RiuMessagePanel( QDockWidget* parent )
|
||||
void RiuMessagePanel::addMessage( RILogLevel messageLevel, const QString& msg )
|
||||
{
|
||||
QColor clr( Qt::black );
|
||||
if ( messageLevel == RI_LL_ERROR )
|
||||
if ( messageLevel == RILogLevel::RI_LL_ERROR )
|
||||
clr = Qt::red;
|
||||
else if ( messageLevel == RI_LL_WARNING )
|
||||
else if ( messageLevel == RILogLevel::RI_LL_WARNING )
|
||||
clr = QColor( 220, 100, 10 );
|
||||
else if ( messageLevel == RI_LL_DEBUG )
|
||||
else if ( messageLevel == RILogLevel::RI_LL_DEBUG )
|
||||
clr = QColor( 100, 100, 200 );
|
||||
|
||||
QTextCharFormat form = m_textEdit->currentCharFormat();
|
||||
form.setForeground( clr );
|
||||
form.setFontWeight( messageLevel == RI_LL_ERROR ? QFont::DemiBold : QFont::Normal );
|
||||
form.setFontItalic( messageLevel == RI_LL_DEBUG ? true : false );
|
||||
form.setFontWeight( messageLevel == RILogLevel::RI_LL_ERROR ? QFont::DemiBold : QFont::Normal );
|
||||
form.setFontItalic( messageLevel == RILogLevel::RI_LL_DEBUG ? true : false );
|
||||
m_textEdit->setCurrentCharFormat( form );
|
||||
m_textEdit->appendPlainText( msg );
|
||||
|
||||
@@ -75,7 +75,7 @@ void RiuMessagePanel::addMessage( RILogLevel messageLevel, const QString& msg )
|
||||
|
||||
if ( !RiaRegressionTestRunner::instance()->isRunningRegressionTests() )
|
||||
{
|
||||
if ( messageLevel == RI_LL_ERROR || messageLevel == RI_LL_WARNING )
|
||||
if ( messageLevel == RILogLevel::RI_LL_ERROR || messageLevel == RILogLevel::RI_LL_WARNING )
|
||||
{
|
||||
QDockWidget* parentDockWidget = dynamic_cast<QDockWidget*>( this->parent() );
|
||||
if ( parentDockWidget && !parentDockWidget->isVisible() )
|
||||
@@ -138,7 +138,7 @@ void RiuMessagePanel::slotClearMessages()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMessagePanelLogger::RiuMessagePanelLogger()
|
||||
: m_logLevel( RI_LL_WARNING )
|
||||
: m_logLevel( int( RILogLevel::RI_LL_WARNING ) )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void RiuMessagePanelLogger::setLevel( int logLevel )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMessagePanelLogger::error( const char* message )
|
||||
{
|
||||
writeToMessagePanel( RI_LL_ERROR, message );
|
||||
writeToMessagePanel( RILogLevel::RI_LL_ERROR, message );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -179,7 +179,7 @@ void RiuMessagePanelLogger::error( const char* message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMessagePanelLogger::warning( const char* message )
|
||||
{
|
||||
writeToMessagePanel( RI_LL_WARNING, message );
|
||||
writeToMessagePanel( RILogLevel::RI_LL_WARNING, message );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -187,7 +187,7 @@ void RiuMessagePanelLogger::warning( const char* message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMessagePanelLogger::info( const char* message )
|
||||
{
|
||||
writeToMessagePanel( RI_LL_INFO, message );
|
||||
writeToMessagePanel( RILogLevel::RI_LL_INFO, message );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -195,7 +195,7 @@ void RiuMessagePanelLogger::info( const char* message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMessagePanelLogger::debug( const char* message )
|
||||
{
|
||||
writeToMessagePanel( RI_LL_DEBUG, message );
|
||||
writeToMessagePanel( RILogLevel::RI_LL_DEBUG, message );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -203,7 +203,7 @@ void RiuMessagePanelLogger::debug( const char* message )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMessagePanelLogger::writeToMessagePanel( RILogLevel messageLevel, const char* message )
|
||||
{
|
||||
if ( messageLevel > m_logLevel )
|
||||
if ( int( messageLevel ) > m_logLevel )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void RiuProcessMonitor::addStringToLog( const QString& sTxt )
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if ( mainPlotWindow && mainPlotWindow->messagePanel() )
|
||||
{
|
||||
mainPlotWindow->messagePanel()->addMessage( RI_LL_INFO, sTxt );
|
||||
mainPlotWindow->messagePanel()->addMessage( RILogLevel::RI_LL_INFO, sTxt );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ void RiuPvtPlotWidget::slotPickerActivated( bool on )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPvtPlotPanel::RiuPvtPlotPanel( QDockWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_unitSystem( RiaEclipseUnitTools::UNITS_UNKNOWN )
|
||||
, m_unitSystem( RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN )
|
||||
, m_plotUpdater( new RiuPvtPlotUpdater( this ) )
|
||||
{
|
||||
m_phaseComboBox = new QComboBox( this );
|
||||
@@ -591,7 +591,7 @@ void RiuPvtPlotPanel::clearPlot()
|
||||
return;
|
||||
}
|
||||
|
||||
m_unitSystem = RiaEclipseUnitTools::UNITS_UNKNOWN;
|
||||
m_unitSystem = RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN;
|
||||
m_allFvfCurvesArr.clear();
|
||||
m_allViscosityCurvesArr.clear();
|
||||
m_fvfDynProps = FvfDynProps();
|
||||
@@ -756,11 +756,11 @@ QString RiuPvtPlotPanel::unitLabelFromCurveIdent( RiaEclipseUnitTools::UnitSyste
|
||||
{
|
||||
switch ( unitSystem )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
|
||||
return "rm3/sm3";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
|
||||
return "rb/stb";
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
|
||||
return "rcc/scc";
|
||||
default:
|
||||
return "";
|
||||
@@ -770,11 +770,11 @@ QString RiuPvtPlotPanel::unitLabelFromCurveIdent( RiaEclipseUnitTools::UnitSyste
|
||||
{
|
||||
switch ( unitSystem )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
|
||||
return "rm3/sm3";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
|
||||
return "rb/Mscf";
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
|
||||
return "rcc/scc";
|
||||
default:
|
||||
return "";
|
||||
@@ -785,11 +785,11 @@ QString RiuPvtPlotPanel::unitLabelFromCurveIdent( RiaEclipseUnitTools::UnitSyste
|
||||
{
|
||||
switch ( unitSystem )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_METRIC:
|
||||
return "cP";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_FIELD:
|
||||
return "cP";
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
case RiaEclipseUnitTools::UnitSystem::UNITS_LAB:
|
||||
return "cP";
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -67,7 +67,7 @@ void RiuQwtPlotTools::setCommonPlotBehaviour( QwtPlot* plot )
|
||||
plot->setAxisFont( QwtPlot::yRight, axisFont );
|
||||
|
||||
// Axis title font
|
||||
std::vector<QwtPlot::Axis> axes = { QwtPlot::xBottom, QwtPlot::xTop, QwtPlot::yLeft, QwtPlot::yRight };
|
||||
std::vector<QwtPlot::Axis> axes = {QwtPlot::xBottom, QwtPlot::xTop, QwtPlot::yLeft, QwtPlot::yRight};
|
||||
|
||||
for ( QwtPlot::Axis axis : axes )
|
||||
{
|
||||
@@ -131,14 +131,14 @@ void RiuQwtPlotTools::enableDateBasedBottomXAxis( QwtPlot*
|
||||
{
|
||||
QwtDateScaleDraw* scaleDraw = new QwtDateScaleDraw( Qt::UTC );
|
||||
|
||||
std::set<QwtDate::IntervalType> intervals = { QwtDate::Year,
|
||||
QwtDate::Month,
|
||||
QwtDate::Week,
|
||||
QwtDate::Day,
|
||||
QwtDate::Hour,
|
||||
QwtDate::Minute,
|
||||
QwtDate::Second,
|
||||
QwtDate::Millisecond };
|
||||
std::set<QwtDate::IntervalType> intervals = {QwtDate::Year,
|
||||
QwtDate::Month,
|
||||
QwtDate::Week,
|
||||
QwtDate::Day,
|
||||
QwtDate::Hour,
|
||||
QwtDate::Minute,
|
||||
QwtDate::Second,
|
||||
QwtDate::Millisecond};
|
||||
|
||||
for ( QwtDate::IntervalType interval : intervals )
|
||||
{
|
||||
@@ -161,7 +161,7 @@ QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType
|
||||
RiaQDateTimeTools::TimeFormatComponents timeComponents )
|
||||
{
|
||||
if ( dateComponents != RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED &&
|
||||
timeComponents != RiaQDateTimeTools::TIME_FORMAT_UNSPECIFIED )
|
||||
timeComponents != RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED )
|
||||
{
|
||||
return RiaQDateTimeTools::timeFormatString( timeFormat, timeComponents ) + "\n" +
|
||||
RiaQDateTimeTools::dateFormatString( dateFormat, dateComponents );
|
||||
@@ -172,13 +172,15 @@ QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType
|
||||
{
|
||||
case QwtDate::Millisecond:
|
||||
return RiaQDateTimeTools::timeFormatString( timeFormat,
|
||||
RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND );
|
||||
RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND );
|
||||
case QwtDate::Second:
|
||||
return RiaQDateTimeTools::timeFormatString( timeFormat, RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE_SECOND );
|
||||
return RiaQDateTimeTools::timeFormatString( timeFormat,
|
||||
RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND );
|
||||
case QwtDate::Minute:
|
||||
{
|
||||
QString fullFormat =
|
||||
RiaQDateTimeTools::timeFormatString( timeFormat, RiaQDateTimeTools::TIME_FORMAT_HOUR_MINUTE );
|
||||
RiaQDateTimeTools::timeFormatString( timeFormat,
|
||||
RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE );
|
||||
fullFormat += "\n";
|
||||
fullFormat +=
|
||||
RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY );
|
||||
@@ -186,7 +188,9 @@ QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType
|
||||
}
|
||||
case QwtDate::Hour:
|
||||
{
|
||||
QString fullFormat = RiaQDateTimeTools::timeFormatString( timeFormat, RiaQDateTimeTools::TIME_FORMAT_HOUR );
|
||||
QString fullFormat =
|
||||
RiaQDateTimeTools::timeFormatString( timeFormat,
|
||||
RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR );
|
||||
if ( !fullFormat.endsWith( "AP" ) )
|
||||
{
|
||||
fullFormat += ":00";
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
const QString& dateFormat,
|
||||
const QString& timeFormat,
|
||||
RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED,
|
||||
RiaQDateTimeTools::TimeFormatComponents timeComponents = RiaQDateTimeTools::TIME_FORMAT_UNSPECIFIED );
|
||||
RiaQDateTimeTools::TimeFormatComponents timeComponents = RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED );
|
||||
|
||||
static QString dateTimeFormatForInterval( QwtDate::IntervalType interval,
|
||||
const QString& dateFormat,
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QDockWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_unitSystem( RiaEclipseUnitTools::UNITS_UNKNOWN )
|
||||
, m_unitSystem( RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN )
|
||||
, m_swat( HUGE_VAL )
|
||||
, m_sgas( HUGE_VAL )
|
||||
, m_plotUpdater( new RiuRelativePermeabilityPlotUpdater( this ) )
|
||||
@@ -207,7 +207,7 @@ void RiuRelativePermeabilityPlotPanel::clearPlot()
|
||||
return;
|
||||
}
|
||||
|
||||
m_unitSystem = RiaEclipseUnitTools::UNITS_UNKNOWN;
|
||||
m_unitSystem = RiaEclipseUnitTools::UnitSystem::UNITS_UNKNOWN;
|
||||
m_allCurvesArr.clear();
|
||||
m_swat = HUGE_VAL;
|
||||
m_sgas = HUGE_VAL;
|
||||
|
||||
@@ -45,11 +45,11 @@ public:
|
||||
RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent = nullptr );
|
||||
~RiuSummaryQwtPlot() override;
|
||||
|
||||
void useDateBasedTimeAxis(
|
||||
const QString& dateFormat,
|
||||
const QString& timeFormat,
|
||||
RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED,
|
||||
RiaQDateTimeTools::TimeFormatComponents timeComponents = RiaQDateTimeTools::TIME_FORMAT_UNSPECIFIED );
|
||||
void useDateBasedTimeAxis( const QString& dateFormat,
|
||||
const QString& timeFormat,
|
||||
RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED,
|
||||
RiaQDateTimeTools::TimeFormatComponents timeComponents =
|
||||
RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED );
|
||||
|
||||
void useTimeBasedTimeAxis();
|
||||
void setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithmic );
|
||||
|
||||
Reference in New Issue
Block a user