[partition] C++ style
This commit is contained in:
parent
16fbe4dc8c
commit
ba21a221df
@ -209,8 +209,8 @@ PartitionViewStep::createSummaryWidget() const
|
|||||||
else // multiple disk previews!
|
else // multiple disk previews!
|
||||||
{
|
{
|
||||||
diskInfoLabel->setText( tr( "Disk <strong>%1</strong> (%2)" )
|
diskInfoLabel->setText( tr( "Disk <strong>%1</strong> (%2)" )
|
||||||
.arg( info.deviceNode )
|
.arg( info.deviceNode )
|
||||||
.arg( info.deviceName ) );
|
.arg( info.deviceName ) );
|
||||||
}
|
}
|
||||||
formLayout->addRow( diskInfoLabel );
|
formLayout->addRow( diskInfoLabel );
|
||||||
|
|
||||||
@ -219,9 +219,9 @@ PartitionViewStep::createSummaryWidget() const
|
|||||||
QVBoxLayout* field;
|
QVBoxLayout* field;
|
||||||
|
|
||||||
PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()->
|
PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()->
|
||||||
value( "drawNestedPartitions" ).toBool() ?
|
value( "drawNestedPartitions" ).toBool() ?
|
||||||
PartitionBarsView::DrawNestedPartitions :
|
PartitionBarsView::DrawNestedPartitions :
|
||||||
PartitionBarsView::NoNestedPartitions;
|
PartitionBarsView::NoNestedPartitions;
|
||||||
preview = new PartitionBarsView;
|
preview = new PartitionBarsView;
|
||||||
preview->setNestedPartitionsMode( mode );
|
preview->setNestedPartitionsMode( mode );
|
||||||
previewLabels = new PartitionLabelsView;
|
previewLabels = new PartitionLabelsView;
|
||||||
@ -259,7 +259,7 @@ PartitionViewStep::createSummaryWidget() const
|
|||||||
foreach ( const Calamares::job_ptr& job, jobs() )
|
foreach ( const Calamares::job_ptr& job, jobs() )
|
||||||
{
|
{
|
||||||
if ( !job->prettyDescription().isEmpty() )
|
if ( !job->prettyDescription().isEmpty() )
|
||||||
jobsLines.append( job->prettyDescription() );
|
jobsLines.append( job->prettyDescription() );
|
||||||
}
|
}
|
||||||
if ( !jobsLines.isEmpty() )
|
if ( !jobsLines.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -352,8 +352,8 @@ PartitionViewStep::isAtEnd() const
|
|||||||
if ( m_choicePage == m_widget->currentWidget() )
|
if ( m_choicePage == m_widget->currentWidget() )
|
||||||
{
|
{
|
||||||
if ( m_choicePage->currentChoice() == ChoicePage::Erase ||
|
if ( m_choicePage->currentChoice() == ChoicePage::Erase ||
|
||||||
m_choicePage->currentChoice() == ChoicePage::Replace ||
|
m_choicePage->currentChoice() == ChoicePage::Replace ||
|
||||||
m_choicePage->currentChoice() == ChoicePage::Alongside )
|
m_choicePage->currentChoice() == ChoicePage::Alongside )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ PartitionViewStep::onActivate()
|
|||||||
{
|
{
|
||||||
// if we're coming back to PVS from the next VS
|
// if we're coming back to PVS from the next VS
|
||||||
if ( m_widget->currentWidget() == m_choicePage &&
|
if ( m_widget->currentWidget() == m_choicePage &&
|
||||||
m_choicePage->currentChoice() == ChoicePage::Alongside )
|
m_choicePage->currentChoice() == ChoicePage::Alongside )
|
||||||
{
|
{
|
||||||
m_choicePage->applyActionChoice( ChoicePage::Alongside );
|
m_choicePage->applyActionChoice( ChoicePage::Alongside );
|
||||||
// m_choicePage->reset();
|
// m_choicePage->reset();
|
||||||
@ -389,7 +389,7 @@ PartitionViewStep::onLeave()
|
|||||||
if ( PartUtils::isEfiSystem() )
|
if ( PartUtils::isEfiSystem() )
|
||||||
{
|
{
|
||||||
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->
|
QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->
|
||||||
value( "efiSystemPartition").toString();
|
value( "efiSystemPartition" ).toString();
|
||||||
Partition* esp = m_core->findPartitionByMountPoint( espMountPoint );
|
Partition* esp = m_core->findPartitionByMountPoint( espMountPoint );
|
||||||
|
|
||||||
QString message;
|
QString message;
|
||||||
@ -443,7 +443,7 @@ PartitionViewStep::onLeave()
|
|||||||
// If the root partition is encrypted, and there's a separate boot
|
// If the root partition is encrypted, and there's a separate boot
|
||||||
// partition which is not encrypted
|
// partition which is not encrypted
|
||||||
if ( root_p->fileSystem().type() == FileSystem::Luks &&
|
if ( root_p->fileSystem().type() == FileSystem::Luks &&
|
||||||
boot_p->fileSystem().type() != FileSystem::Luks )
|
boot_p->fileSystem().type() != FileSystem::Luks )
|
||||||
{
|
{
|
||||||
message = tr( "Boot partition not encrypted" );
|
message = tr( "Boot partition not encrypted" );
|
||||||
description = tr( "A separate boot partition was set up together with "
|
description = tr( "A separate boot partition was set up together with "
|
||||||
@ -475,61 +475,45 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
// the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
|
// the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
if ( configurationMap.contains( "efiSystemPartition" ) &&
|
if ( configurationMap.contains( "efiSystemPartition" ) &&
|
||||||
configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
|
configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
|
||||||
!configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
|
!configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
|
||||||
{
|
|
||||||
gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
|
gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
|
gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "ensureSuspendToDisk" ) &&
|
if ( configurationMap.contains( "ensureSuspendToDisk" ) &&
|
||||||
configurationMap.value( "ensureSuspendToDisk" ).type() == QVariant::Bool )
|
configurationMap.value( "ensureSuspendToDisk" ).type() == QVariant::Bool )
|
||||||
{
|
|
||||||
gs->insert( "ensureSuspendToDisk", configurationMap.value( "ensureSuspendToDisk" ).toBool() );
|
gs->insert( "ensureSuspendToDisk", configurationMap.value( "ensureSuspendToDisk" ).toBool() );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "ensureSuspendToDisk", true );
|
gs->insert( "ensureSuspendToDisk", true );
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "neverCreateSwap" ) &&
|
if ( configurationMap.contains( "neverCreateSwap" ) &&
|
||||||
configurationMap.value( "neverCreateSwap" ).type() == QVariant::Bool )
|
configurationMap.value( "neverCreateSwap" ).type() == QVariant::Bool )
|
||||||
{
|
|
||||||
gs->insert( "neverCreateSwap", configurationMap.value( "neverCreateSwap" ).toBool() );
|
gs->insert( "neverCreateSwap", configurationMap.value( "neverCreateSwap" ).toBool() );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "neverCreateSwap", false );
|
gs->insert( "neverCreateSwap", false );
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "drawNestedPartitions" ) &&
|
if ( configurationMap.contains( "drawNestedPartitions" ) &&
|
||||||
configurationMap.value( "drawNestedPartitions" ).type() == QVariant::Bool )
|
configurationMap.value( "drawNestedPartitions" ).type() == QVariant::Bool )
|
||||||
{
|
{
|
||||||
gs->insert( "drawNestedPartitions",
|
gs->insert( "drawNestedPartitions",
|
||||||
configurationMap.value( "drawNestedPartitions", false ).toBool() );
|
configurationMap.value( "drawNestedPartitions", false ).toBool() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "drawNestedPartitions", false );
|
gs->insert( "drawNestedPartitions", false );
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "alwaysShowPartitionLabels" ) &&
|
if ( configurationMap.contains( "alwaysShowPartitionLabels" ) &&
|
||||||
configurationMap.value( "alwaysShowPartitionLabels" ).type() == QVariant::Bool )
|
configurationMap.value( "alwaysShowPartitionLabels" ).type() == QVariant::Bool )
|
||||||
{
|
{
|
||||||
gs->insert( "alwaysShowPartitionLabels",
|
gs->insert( "alwaysShowPartitionLabels",
|
||||||
configurationMap.value( "alwaysShowPartitionLabels", true ).toBool() );
|
configurationMap.value( "alwaysShowPartitionLabels", true ).toBool() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "alwaysShowPartitionLabels", true );
|
gs->insert( "alwaysShowPartitionLabels", true );
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "defaultFileSystemType" ) &&
|
if ( configurationMap.contains( "defaultFileSystemType" ) &&
|
||||||
configurationMap.value( "defaultFileSystemType" ).type() == QVariant::String &&
|
configurationMap.value( "defaultFileSystemType" ).type() == QVariant::String &&
|
||||||
!configurationMap.value( "defaultFileSystemType" ).toString().isEmpty() )
|
!configurationMap.value( "defaultFileSystemType" ).toString().isEmpty() )
|
||||||
{
|
{
|
||||||
QString typeString = configurationMap.value( "defaultFileSystemType" ).toString();
|
QString typeString = configurationMap.value( "defaultFileSystemType" ).toString();
|
||||||
gs->insert( "defaultFileSystemType", typeString );
|
gs->insert( "defaultFileSystemType", typeString );
|
||||||
@ -540,20 +524,16 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "defaultFileSystemType", QStringLiteral( "ext4" ) );
|
gs->insert( "defaultFileSystemType", QStringLiteral( "ext4" ) );
|
||||||
}
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "enableLuksAutomatedPartitioning" ) &&
|
if ( configurationMap.contains( "enableLuksAutomatedPartitioning" ) &&
|
||||||
configurationMap.value( "enableLuksAutomatedPartitioning" ).type() == QVariant::Bool )
|
configurationMap.value( "enableLuksAutomatedPartitioning" ).type() == QVariant::Bool )
|
||||||
{
|
{
|
||||||
gs->insert( "enableLuksAutomatedPartitioning",
|
gs->insert( "enableLuksAutomatedPartitioning",
|
||||||
configurationMap.value( "enableLuksAutomatedPartitioning" ).toBool() );
|
configurationMap.value( "enableLuksAutomatedPartitioning" ).toBool() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
gs->insert( "enableLuksAutomatedPartitioning", true );
|
gs->insert( "enableLuksAutomatedPartitioning", true );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Now that we have the config, we load the PartitionCoreModule in the background
|
// Now that we have the config, we load the PartitionCoreModule in the background
|
||||||
@ -568,7 +548,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
QFuture< void > future =
|
QFuture< void > future =
|
||||||
QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
||||||
watcher->setFuture( future );
|
watcher->setFuture( future );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,13 +563,13 @@ Calamares::RequirementsList PartitionViewStep::checkRequirements()
|
|||||||
{
|
{
|
||||||
Calamares::RequirementsList l;
|
Calamares::RequirementsList l;
|
||||||
l.append(
|
l.append(
|
||||||
{
|
{
|
||||||
QLatin1Literal("partitions"),
|
QLatin1Literal( "partitions" ),
|
||||||
[]{ return QString(); },
|
[]{ return QString(); },
|
||||||
[this]{ return tr("There are no partitons to install on."); },
|
[this]{ return tr( "There are no partitons to install on." ); },
|
||||||
false, // satisfied
|
false, // satisfied
|
||||||
true // required
|
true // required
|
||||||
});
|
} );
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user