[partition] C++ style

This commit is contained in:
Adriaan de Groot 2017-12-02 11:43:20 -05:00
parent 16fbe4dc8c
commit ba21a221df

View File

@ -389,7 +389,7 @@ PartitionViewStep::onLeave()
if ( PartUtils::isEfiSystem() )
{
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->
value( "efiSystemPartition").toString();
value( "efiSystemPartition" ).toString();
Partition* esp = m_core->findPartitionByMountPoint( espMountPoint );
QString message;
@ -477,33 +477,21 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( configurationMap.contains( "efiSystemPartition" ) &&
configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
!configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
{
gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
}
else
{
gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
}
if ( configurationMap.contains( "ensureSuspendToDisk" ) &&
configurationMap.value( "ensureSuspendToDisk" ).type() == QVariant::Bool )
{
gs->insert( "ensureSuspendToDisk", configurationMap.value( "ensureSuspendToDisk" ).toBool() );
}
else
{
gs->insert( "ensureSuspendToDisk", true );
}
if ( configurationMap.contains( "neverCreateSwap" ) &&
configurationMap.value( "neverCreateSwap" ).type() == QVariant::Bool )
{
gs->insert( "neverCreateSwap", configurationMap.value( "neverCreateSwap" ).toBool() );
}
else
{
gs->insert( "neverCreateSwap", false );
}
if ( configurationMap.contains( "drawNestedPartitions" ) &&
configurationMap.value( "drawNestedPartitions" ).type() == QVariant::Bool )
@ -512,9 +500,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
configurationMap.value( "drawNestedPartitions", false ).toBool() );
}
else
{
gs->insert( "drawNestedPartitions", false );
}
if ( configurationMap.contains( "alwaysShowPartitionLabels" ) &&
configurationMap.value( "alwaysShowPartitionLabels" ).type() == QVariant::Bool )
@ -523,9 +509,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
configurationMap.value( "alwaysShowPartitionLabels", true ).toBool() );
}
else
{
gs->insert( "alwaysShowPartitionLabels", true );
}
if ( configurationMap.contains( "defaultFileSystemType" ) &&
configurationMap.value( "defaultFileSystemType" ).type() == QVariant::String &&
@ -540,9 +524,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
}
}
else
{
gs->insert( "defaultFileSystemType", QStringLiteral( "ext4" ) );
}
if ( configurationMap.contains( "enableLuksAutomatedPartitioning" ) &&
configurationMap.value( "enableLuksAutomatedPartitioning" ).type() == QVariant::Bool )
@ -551,9 +533,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
configurationMap.value( "enableLuksAutomatedPartitioning" ).toBool() );
}
else
{
gs->insert( "enableLuksAutomatedPartitioning", true );
}
// Now that we have the config, we load the PartitionCoreModule in the background
@ -584,12 +564,12 @@ Calamares::RequirementsList PartitionViewStep::checkRequirements()
Calamares::RequirementsList l;
l.append(
{
QLatin1Literal("partitions"),
QLatin1Literal( "partitions" ),
[]{ return QString(); },
[this]{ return tr("There are no partitons to install on."); },
[this]{ return tr( "There are no partitons to install on." ); },
false, // satisfied
true // required
});
} );
return l;