[partition] Don't reinitialize partition layout

Existing code reinitialized the layout, losing whatever
layout was set in the config. Refactor so that you can
access the partition-layout API, and change the default
FS through that -- which is the point of the code block
here in `doAutopartition()`, to look up the currently-
selected default FS.

Inspired by Santosh's work in #1903, #1759.
This commit is contained in:
Adriaan de Groot 2022-03-14 11:27:00 +01:00
parent c35da331a2
commit f60def5ecc
4 changed files with 7 additions and 13 deletions

View File

@ -52,8 +52,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_waitingWidget = new WaitingWidget( QString() );
m_widget->addWidget( m_waitingWidget );
CALAMARES_RETRANSLATE( if ( m_waitingWidget )
{ m_waitingWidget->setText( tr( "Gathering system information..." ) ); } );
CALAMARES_RETRANSLATE(
if ( m_waitingWidget ) { m_waitingWidget->setText( tr( "Gathering system information..." ) ); } );
m_core = new PartitionCoreModule( this ); // Unusable before init is complete!
// We're not done loading, but we need the configuration map first.
@ -691,7 +691,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
m_future->setFuture( future );
m_core->initLayout( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() );
m_core->partitionLayout().init( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() );
}

View File

@ -112,7 +112,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
// will log an error and set the type to Unknown if there's something wrong.
FileSystem::Type type = FileSystem::Unknown;
PartUtils::canonicalFilesystemName( o.defaultFsType, &type );
core->initLayout( type == FileSystem::Unknown ? FileSystem::Ext4 : type );
core->partitionLayout().setDefaultFsType( type == FileSystem::Unknown ? FileSystem::Ext4 : type );
core->createPartitionTable( dev, partType );

View File

@ -941,12 +941,6 @@ PartitionCoreModule::setBootLoaderInstallPath( const QString& path )
m_bootLoaderInstallPath = path;
}
void
PartitionCoreModule::initLayout( FileSystem::Type defaultFsType, const QVariantList& config )
{
m_partLayout.init( defaultFsType, config );
}
void
PartitionCoreModule::layoutApply( Device* dev,
qint64 firstSector,

View File

@ -160,11 +160,11 @@ public:
/// @brief Set the path where the bootloader will be installed
void setBootLoaderInstallPath( const QString& path );
/** @brief Initialize the default layout that will be applied
/** @brief Get the partition layout that will be applied.
*
* See PartitionLayout::init()
* Layouts are applied only for erase and replace operations.
*/
void initLayout( FileSystem::Type defaultFsType, const QVariantList& config = QVariantList() );
PartitionLayout& partitionLayout() { return m_partLayout; }
void layoutApply( Device* dev, qint64 firstSector, qint64 lastSector, QString luksPassphrase );
void layoutApply( Device* dev,