[partition] Improve readability in edit-existing-partition

Pick out the condition and give it a name. The logic is the
same -- and is made worse because of the if() which looks
redundant at this point.
This commit is contained in:
Adriaan de Groot 2024-02-17 14:18:24 +01:00
parent 0dc3c5bf4a
commit a2b21ee087

View File

@ -130,10 +130,18 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
m_ui->fileSystemComboBox->setEnabled( m_ui->formatRadioButton->isChecked() ); m_ui->fileSystemComboBox->setEnabled( m_ui->formatRadioButton->isChecked() );
// Force a format if the existing device is a zfs device since reusing a zpool isn't currently supported // Force a format if the existing device is a zfs device since reusing a zpool isn't currently supported
m_ui->formatRadioButton->setChecked( m_partition->fileSystem().type() == FileSystem::Type::Zfs ); const bool partitionIsZFS = m_partition->fileSystem().type() == FileSystem::Type::Zfs;
m_ui->formatRadioButton->setEnabled( !( m_partition->fileSystem().type() == FileSystem::Type::Zfs ) ); if ( partitionIsZFS )
m_ui->keepRadioButton->setChecked( !( m_partition->fileSystem().type() == FileSystem::Type::Zfs ) ); {
m_ui->keepRadioButton->setEnabled( !( m_partition->fileSystem().type() == FileSystem::Type::Zfs ) ); m_ui->formatRadioButton->setChecked( true );
}
else
{
m_ui->formatRadioButton->setChecked( false );
}
m_ui->formatRadioButton->setEnabled( !partitionIsZFS );
m_ui->keepRadioButton->setChecked( !partitionIsZFS );
m_ui->keepRadioButton->setEnabled( !partitionIsZFS );
setFlagList( *( m_ui->m_listFlags ), m_partition->availableFlags(), PartitionInfo::flags( m_partition ) ); setFlagList( *( m_ui->m_listFlags ), m_partition->availableFlags(), PartitionInfo::flags( m_partition ) );
} }