mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 10:55:37 -04:00
[libcalamares] Reduce indentation-depth in apply() through early-return
This commit is contained in:
parent
33fec86ef6
commit
a4c1f07521
1 changed files with 25 additions and 17 deletions
|
@ -94,16 +94,25 @@ Config::ApplyPresets::apply( const char* fieldName )
|
||||||
if ( !prop.isValid() )
|
if ( !prop.isValid() )
|
||||||
{
|
{
|
||||||
cWarning() << "Applying invalid property" << fieldName;
|
cWarning() << "Applying invalid property" << fieldName;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
const QString key( fieldName );
|
const QString key( fieldName );
|
||||||
if ( !key.isEmpty() && m_c.d->m_presets->find( key ).isValid() )
|
if ( key.isEmpty() )
|
||||||
|
{
|
||||||
|
cWarning() << "Applying empty field";
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_c.d->m_presets->find( key ).isValid() )
|
||||||
{
|
{
|
||||||
cWarning() << "Applying duplicate property" << fieldName;
|
cWarning() << "Applying duplicate property" << fieldName;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
else if ( !key.isEmpty() && m_map.contains( key ) )
|
|
||||||
|
if ( m_map.contains( key ) )
|
||||||
{
|
{
|
||||||
|
// Key has an explicit setting
|
||||||
QVariantMap m = CalamaresUtils::getSubMap( m_map, key, m_bogus );
|
QVariantMap m = CalamaresUtils::getSubMap( m_map, key, m_bogus );
|
||||||
QVariant value = m[ "value" ];
|
QVariant value = m[ "value" ];
|
||||||
bool editable = CalamaresUtils::getBool( m, "editable", true );
|
bool editable = CalamaresUtils::getBool( m, "editable", true );
|
||||||
|
@ -114,7 +123,6 @@ Config::ApplyPresets::apply( const char* fieldName )
|
||||||
}
|
}
|
||||||
m_c.d->m_presets->append( PresetField { key, value, editable } );
|
m_c.d->m_presets->append( PresetField { key, value, editable } );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue