mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Build fixes after rebase/merge
This commit is contained in:
1 parent
d9d7507bcd
commit
27fbcdf2ec
3 files changed
+56
-75
No files matched your search
@@ -43,6 +43,10 @@ RiaPreferencesBatch::RiaPreferencesBatch()
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_exclusive );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_queueName, "queueName", "Default queue/partition name" );
|
||||
m_queueName.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
m_queueName.uiCapability()->setAttribute( caf::PdmUiComboBoxEditor::Keys::ENABLE_EDITABLE_CONTENT, true );
|
||||
m_queueName.uiCapability()->setAttribute( caf::PdmUiComboBoxEditor::Keys::ENABLE_AUTO_COMPLETE, false );
|
||||
m_queueName.uiCapability()->setAttribute( caf::PdmUiComboBoxEditor::Keys::ADJUST_WIDTH_TO_CONTENTS, true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_additionalLsfOptions, "additionalLsfOptions", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_additionalSlurmOptions, "additionalSlurmOptions", "" );
|
||||
@@ -97,24 +101,6 @@ void RiaPreferencesBatch::appendItems( caf::PdmUiOrdering& uiOrdering )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferencesBatch::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_queueName )
|
||||
{
|
||||
auto attr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
|
||||
if ( attr )
|
||||
{
|
||||
attr->enableEditableContent = true;
|
||||
attr->enableAutoComplete = false;
|
||||
attr->adjustWidthToContents = true;
|
||||
attr->notifyWhenTextIsEdited = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -45,9 +45,6 @@ public:
|
||||
|
||||
static QString selectQueue( RiaDefines::BatchSchedulerType scheduler, QString currentQueue );
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute );
|
||||
|
||||
private:
|
||||
caf::PdmField<size_t> m_maxParallelJobs;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::BatchSchedulerType>> m_batchScheduler;
|
||||
|
||||
@@ -174,8 +174,10 @@ void RimSingleJob::setStarted()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSingleJob::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
std::vector<caf::PdmUiTreeViewItemTag> RimSingleJob::treeItemTags()
|
||||
{
|
||||
std::vector<caf::PdmUiTreeViewItemTag> tagsToReturn;
|
||||
|
||||
static auto warnColor = QColor( RiaColorTools::toQColor( cvf::Color3f( cvf::Color3f::DARK_YELLOW ) ) );
|
||||
static auto contrastWarnColor =
|
||||
QColor( RiaColorTools::toQColor( RiaColorTools::contrastColor( cvf::Color3f( cvf::Color3f::DARK_YELLOW ) ) ) );
|
||||
@@ -184,71 +186,67 @@ void RimSingleJob::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUi
|
||||
static auto contrastWaitColor =
|
||||
QColor( RiaColorTools::toQColor( RiaColorTools::contrastColor( cvf::Color3f( cvf::Color3f::LIGHT_GRAY ) ) ) );
|
||||
|
||||
if ( auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute ) )
|
||||
if ( state() == JobState::Failed )
|
||||
{
|
||||
if ( state() == JobState::Failed )
|
||||
{
|
||||
auto txt = m_errorsDetected > 0 ? QString( "[%1]" ).arg( m_errorsDetected ) : "!!!";
|
||||
auto tag =
|
||||
caf::PdmUiTreeViewItemAttribute::createTag( QColor( Qt::red ), RiuGuiTheme::getColorByVariableName( "backgroundColor1" ), txt );
|
||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||
}
|
||||
else if ( state() == JobState::Queued )
|
||||
{
|
||||
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||
tag->text = "Waiting...";
|
||||
tag->bgColor = waitColor;
|
||||
tag->fgColor = contrastWaitColor;
|
||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||
}
|
||||
else if ( ( state() == JobState::Running ) || ( state() == JobState::Completed ) )
|
||||
{
|
||||
auto tag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||
auto txt = m_errorsDetected > 0 ? QString( "[%1]" ).arg( m_errorsDetected ) : "!!!";
|
||||
auto tag = caf::PdmUiTreeViewItemTag::create( QColor( Qt::red ), RiuGuiTheme::getColorByVariableName( "backgroundColor1" ), txt );
|
||||
tagsToReturn.push_back( std::move( tag ) );
|
||||
}
|
||||
else if ( state() == JobState::Queued )
|
||||
{
|
||||
auto tag = caf::PdmUiTreeViewItemTag::create();
|
||||
tag.text = "Waiting...";
|
||||
tag.bgColor = waitColor;
|
||||
tag.fgColor = contrastWaitColor;
|
||||
tagsToReturn.push_back( std::move( tag ) );
|
||||
}
|
||||
else if ( ( state() == JobState::Running ) || ( state() == JobState::Completed ) )
|
||||
{
|
||||
auto tag = caf::PdmUiTreeViewItemTag::create();
|
||||
|
||||
if ( state() == JobState::Running )
|
||||
if ( state() == JobState::Running )
|
||||
{
|
||||
if ( m_percentageDone == 0.0 )
|
||||
{
|
||||
if ( m_percentageDone == 0.0 )
|
||||
{
|
||||
tag->text = "Submitted";
|
||||
}
|
||||
else
|
||||
{
|
||||
tag->text = QString( "%1 %" ).arg( m_percentageDone, 0, 'f', 1 );
|
||||
}
|
||||
tag.text = "Submitted";
|
||||
}
|
||||
else
|
||||
{
|
||||
tag->text = "Done";
|
||||
}
|
||||
|
||||
double factor = m_percentageDone / 100.0;
|
||||
|
||||
cvf::Color3f viewColor = cvf::Color3f( cvf::Color3f::GREEN );
|
||||
viewColor.set( viewColor.r() * factor, viewColor.g() * factor, viewColor.b() * factor );
|
||||
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
|
||||
tag->bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
|
||||
tag->fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );
|
||||
treeItemAttribute->tags.push_back( std::move( tag ) );
|
||||
|
||||
if ( ( state() == JobState::Running ) && !isChildJob() )
|
||||
{
|
||||
auto timeTag = caf::PdmUiTreeViewItemAttribute::createTag( QColor( Qt::black ),
|
||||
QColor( Qt::white ),
|
||||
runTimeString().toUtf8().constData() );
|
||||
treeItemAttribute->tags.push_back( std::move( timeTag ) );
|
||||
tag.text = QString( "%1 %" ).arg( m_percentageDone, 0, 'f', 1 );
|
||||
}
|
||||
}
|
||||
if ( m_warningsDetected > 0 )
|
||||
else
|
||||
{
|
||||
auto warnTxt = QString( "[%1]" ).arg( m_warningsDetected );
|
||||
tag.text = "Done";
|
||||
}
|
||||
|
||||
auto warnTag = caf::PdmUiTreeViewItemAttribute::createTag( warnColor, contrastWarnColor, warnTxt );
|
||||
treeItemAttribute->tags.push_back( std::move( warnTag ) );
|
||||
auto iconTag = caf::PdmUiTreeViewItemAttribute::createTag();
|
||||
iconTag->icon = caf::IconProvider( ":/warning.png" );
|
||||
treeItemAttribute->tags.push_back( std::move( iconTag ) );
|
||||
double factor = m_percentageDone / 100.0;
|
||||
|
||||
cvf::Color3f viewColor = cvf::Color3f( cvf::Color3f::GREEN );
|
||||
viewColor.set( viewColor.r() * factor, viewColor.g() * factor, viewColor.b() * factor );
|
||||
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
|
||||
tag.bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
|
||||
tag.fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );
|
||||
tagsToReturn.push_back( std::move( tag ) );
|
||||
|
||||
if ( ( state() == JobState::Running ) && !isChildJob() )
|
||||
{
|
||||
auto timeTag = caf::PdmUiTreeViewItemTag::create( QColor( Qt::black ), QColor( Qt::white ), runTimeString().toUtf8().constData() );
|
||||
tagsToReturn.push_back( std::move( timeTag ) );
|
||||
}
|
||||
}
|
||||
if ( m_warningsDetected > 0 )
|
||||
{
|
||||
auto warnTxt = QString( "[%1]" ).arg( m_warningsDetected );
|
||||
|
||||
auto warnTag = caf::PdmUiTreeViewItemTag::create( warnColor, contrastWarnColor, warnTxt );
|
||||
tagsToReturn.push_back( std::move( warnTag ) );
|
||||
auto iconTag = caf::PdmUiTreeViewItemTag::create();
|
||||
iconTag.icon = caf::IconProvider( ":/warning.png" );
|
||||
tagsToReturn.push_back( std::move( iconTag ) );
|
||||
}
|
||||
|
||||
return tagsToReturn;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user