[partition] Apply coding style
This commit is contained in:
parent
e8b17b9878
commit
b43759c6a5
@ -227,7 +227,8 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
|
|||||||
QString firmwareType( PartUtils::isEfiSystem() ? QStringLiteral( "efi" ) : QStringLiteral( "bios" ) );
|
QString firmwareType( PartUtils::isEfiSystem() ? QStringLiteral( "efi" ) : QStringLiteral( "bios" ) );
|
||||||
gs->insert( "firmwareType", firmwareType );
|
gs->insert( "firmwareType", firmwareType );
|
||||||
|
|
||||||
gs->insert( "efiSystemPartition", CalamaresUtils::getString( configurationMap, "efiSystemPartition", QStringLiteral( "/boot/efi" ) ) );
|
gs->insert( "efiSystemPartition",
|
||||||
|
CalamaresUtils::getString( configurationMap, "efiSystemPartition", QStringLiteral( "/boot/efi" ) ) );
|
||||||
|
|
||||||
// Read and parse key efiSystemPartitionSize
|
// Read and parse key efiSystemPartitionSize
|
||||||
if ( configurationMap.contains( "efiSystemPartitionSize" ) )
|
if ( configurationMap.contains( "efiSystemPartitionSize" ) )
|
||||||
@ -243,7 +244,7 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::fillConfigurationFSTypes(const QVariantMap& configurationMap)
|
Config::fillConfigurationFSTypes( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
|
|
||||||
@ -256,15 +257,16 @@ Config::fillConfigurationFSTypes(const QVariantMap& configurationMap)
|
|||||||
if ( fsName.isEmpty() )
|
if ( fsName.isEmpty() )
|
||||||
{
|
{
|
||||||
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4";
|
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4";
|
||||||
fsRealName = PartUtils::canonicalFilesystemName( QStringLiteral("ext4"), &fsType );
|
fsRealName = PartUtils::canonicalFilesystemName( QStringLiteral( "ext4" ), &fsType );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fsRealName = PartUtils::canonicalFilesystemName( fsName, &fsType );
|
fsRealName = PartUtils::canonicalFilesystemName( fsName, &fsType );
|
||||||
if ( fsType == FileSystem::Type::Unknown )
|
if ( fsType == FileSystem::Type::Unknown )
|
||||||
{
|
{
|
||||||
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName << ") using ext4 instead";
|
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName
|
||||||
fsRealName = PartUtils::canonicalFilesystemName( QStringLiteral("ext4"), &fsType );
|
<< ") using ext4 instead";
|
||||||
|
fsRealName = PartUtils::canonicalFilesystemName( QStringLiteral( "ext4" ), &fsType );
|
||||||
}
|
}
|
||||||
else if ( fsRealName != fsName )
|
else if ( fsRealName != fsName )
|
||||||
{
|
{
|
||||||
@ -326,7 +328,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
m_requiredPartitionTableType = CalamaresUtils::getStringList( configurationMap, "requiredPartitionTableType" );
|
m_requiredPartitionTableType = CalamaresUtils::getStringList( configurationMap, "requiredPartitionTableType" );
|
||||||
gs->insert( "requiredPartitionTableType", m_requiredPartitionTableType );
|
gs->insert( "requiredPartitionTableType", m_requiredPartitionTableType );
|
||||||
|
|
||||||
fillGSConfigurationEFI(gs, configurationMap);
|
fillGSConfigurationEFI( gs, configurationMap );
|
||||||
fillConfigurationFSTypes( configurationMap );
|
fillConfigurationFSTypes( configurationMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ class Config : public QObject
|
|||||||
Q_PROPERTY( SwapChoice swapChoice READ swapChoice WRITE setSwapChoice NOTIFY swapChoiceChanged )
|
Q_PROPERTY( SwapChoice swapChoice READ swapChoice WRITE setSwapChoice NOTIFY swapChoiceChanged )
|
||||||
|
|
||||||
///@brief Name of the FS that will be used when erasing type disk (e.g. "default filesystem")
|
///@brief Name of the FS that will be used when erasing type disk (e.g. "default filesystem")
|
||||||
Q_PROPERTY( QString eraseModeFilesystem READ eraseFsType WRITE setEraseFsTypeChoice NOTIFY eraseModeFilesystemChanged )
|
Q_PROPERTY(
|
||||||
|
QString eraseModeFilesystem READ eraseFsType WRITE setEraseFsTypeChoice NOTIFY eraseModeFilesystemChanged )
|
||||||
|
|
||||||
Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL )
|
Q_PROPERTY( bool allowManualPartitioning READ allowManualPartitioning CONSTANT FINAL )
|
||||||
|
|
||||||
|
@ -115,10 +115,11 @@ PartitionViewStep::prettyName() const
|
|||||||
* empty strings and duplicates. The list is in-order of how the
|
* empty strings and duplicates. The list is in-order of how the
|
||||||
* jobs will be run.
|
* jobs will be run.
|
||||||
*/
|
*/
|
||||||
static QStringList jobDescriptions( const Calamares::JobList& jobs )
|
static QStringList
|
||||||
|
jobDescriptions( const Calamares::JobList& jobs )
|
||||||
{
|
{
|
||||||
QStringList jobsLines;
|
QStringList jobsLines;
|
||||||
for( const Calamares::job_ptr& job : qAsConst( jobs ) )
|
for ( const Calamares::job_ptr& job : qAsConst( jobs ) )
|
||||||
{
|
{
|
||||||
if ( !job->prettyDescription().isEmpty() )
|
if ( !job->prettyDescription().isEmpty() )
|
||||||
{
|
{
|
||||||
@ -132,7 +133,8 @@ static QStringList jobDescriptions( const Calamares::JobList& jobs )
|
|||||||
*
|
*
|
||||||
* Returns a (branded) string describing what @p choice will do.
|
* Returns a (branded) string describing what @p choice will do.
|
||||||
*/
|
*/
|
||||||
static QString modeDescription( Config::InstallChoice choice )
|
static QString
|
||||||
|
modeDescription( Config::InstallChoice choice )
|
||||||
{
|
{
|
||||||
const auto* branding = Calamares::Branding::instance();
|
const auto* branding = Calamares::Branding::instance();
|
||||||
static const char context[] = "PartitionViewStep";
|
static const char context[] = "PartitionViewStep";
|
||||||
@ -144,10 +146,12 @@ static QString modeDescription( Config::InstallChoice choice )
|
|||||||
.arg( branding->shortVersionedName() );
|
.arg( branding->shortVersionedName() );
|
||||||
break;
|
break;
|
||||||
case Config::InstallChoice::Erase:
|
case Config::InstallChoice::Erase:
|
||||||
return QCoreApplication::translate( context, "<strong>Erase</strong> disk and install %1." ).arg( branding->shortVersionedName() );
|
return QCoreApplication::translate( context, "<strong>Erase</strong> disk and install %1." )
|
||||||
|
.arg( branding->shortVersionedName() );
|
||||||
break;
|
break;
|
||||||
case Config::InstallChoice::Replace:
|
case Config::InstallChoice::Replace:
|
||||||
return QCoreApplication::translate( context, "<strong>Replace</strong> a partition with %1." ).arg( branding->shortVersionedName() );
|
return QCoreApplication::translate( context, "<strong>Replace</strong> a partition with %1." )
|
||||||
|
.arg( branding->shortVersionedName() );
|
||||||
break;
|
break;
|
||||||
case Config::InstallChoice::NoChoice:
|
case Config::InstallChoice::NoChoice:
|
||||||
case Config::InstallChoice::Manual:
|
case Config::InstallChoice::Manual:
|
||||||
@ -163,7 +167,8 @@ static QString modeDescription( Config::InstallChoice choice )
|
|||||||
* is used to provide context; when more than one disk is in use, the description
|
* is used to provide context; when more than one disk is in use, the description
|
||||||
* works differently.
|
* works differently.
|
||||||
*/
|
*/
|
||||||
static QString diskDescription( int listLength, const PartitionCoreModule::SummaryInfo& info, Config::InstallChoice choice )
|
static QString
|
||||||
|
diskDescription( int listLength, const PartitionCoreModule::SummaryInfo& info, Config::InstallChoice choice )
|
||||||
{
|
{
|
||||||
const auto* branding = Calamares::Branding::instance();
|
const auto* branding = Calamares::Branding::instance();
|
||||||
static const char context[] = "PartitionViewStep";
|
static const char context[] = "PartitionViewStep";
|
||||||
@ -173,27 +178,32 @@ static QString diskDescription( int listLength, const PartitionCoreModule::Summa
|
|||||||
switch ( choice )
|
switch ( choice )
|
||||||
{
|
{
|
||||||
case Config::Alongside:
|
case Config::Alongside:
|
||||||
return QCoreApplication::translate( context, "Install %1 <strong>alongside</strong> another operating system on disk "
|
return QCoreApplication::translate(
|
||||||
|
context,
|
||||||
|
"Install %1 <strong>alongside</strong> another operating system on disk "
|
||||||
"<strong>%2</strong> (%3)." )
|
"<strong>%2</strong> (%3)." )
|
||||||
.arg( branding->shortVersionedName() )
|
.arg( branding->shortVersionedName() )
|
||||||
.arg( info.deviceNode )
|
.arg( info.deviceNode )
|
||||||
.arg( info.deviceName );
|
.arg( info.deviceName );
|
||||||
break;
|
break;
|
||||||
case Config::Erase:
|
case Config::Erase:
|
||||||
return QCoreApplication::translate( context, "<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." )
|
return QCoreApplication::translate( context,
|
||||||
|
"<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." )
|
||||||
.arg( branding->shortVersionedName() )
|
.arg( branding->shortVersionedName() )
|
||||||
.arg( info.deviceNode )
|
.arg( info.deviceNode )
|
||||||
.arg( info.deviceName );
|
.arg( info.deviceName );
|
||||||
break;
|
break;
|
||||||
case Config::Replace:
|
case Config::Replace:
|
||||||
return QCoreApplication::translate( context, "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." )
|
return QCoreApplication::translate(
|
||||||
|
context, "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." )
|
||||||
.arg( branding->shortVersionedName() )
|
.arg( branding->shortVersionedName() )
|
||||||
.arg( info.deviceNode )
|
.arg( info.deviceNode )
|
||||||
.arg( info.deviceName );
|
.arg( info.deviceName );
|
||||||
break;
|
break;
|
||||||
case Config::NoChoice:
|
case Config::NoChoice:
|
||||||
case Config::Manual:
|
case Config::Manual:
|
||||||
return QCoreApplication::translate( context, "<strong>Manual</strong> partitioning on disk <strong>%1</strong> (%2)." )
|
return QCoreApplication::translate(
|
||||||
|
context, "<strong>Manual</strong> partitioning on disk <strong>%1</strong> (%2)." )
|
||||||
.arg( info.deviceNode )
|
.arg( info.deviceNode )
|
||||||
.arg( info.deviceName );
|
.arg( info.deviceName );
|
||||||
}
|
}
|
||||||
@ -201,7 +211,9 @@ static QString diskDescription( int listLength, const PartitionCoreModule::Summa
|
|||||||
}
|
}
|
||||||
else // multiple disk previews!
|
else // multiple disk previews!
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate( context, "Disk <strong>%1</strong> (%2)" ).arg( info.deviceNode ).arg( info.deviceName ) ;
|
return QCoreApplication::translate( context, "Disk <strong>%1</strong> (%2)" )
|
||||||
|
.arg( info.deviceNode )
|
||||||
|
.arg( info.deviceName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +228,7 @@ PartitionViewStep::prettyStatus() const
|
|||||||
cDebug() << "Summary for Partition" << list.length() << choice;
|
cDebug() << "Summary for Partition" << list.length() << choice;
|
||||||
if ( list.length() > 1 ) // There are changes on more than one disk
|
if ( list.length() > 1 ) // There are changes on more than one disk
|
||||||
{
|
{
|
||||||
modeText = modeDescription(choice);
|
modeText = modeDescription( choice );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( const auto& info : list )
|
for ( const auto& info : list )
|
||||||
@ -644,8 +656,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
||||||
m_future->setFuture( future );
|
m_future->setFuture( future );
|
||||||
|
|
||||||
m_core->initLayout( m_config->defaultFsType(),
|
m_core->initLayout( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() );
|
||||||
configurationMap.value( "partitionLayout" ).toList() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -447,14 +447,14 @@ isEfiSystem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEfiFilesystemSuitable(const Partition* candidate)
|
isEfiFilesystemSuitable( const Partition* candidate )
|
||||||
{
|
{
|
||||||
auto type = candidate->fileSystem().type();
|
auto type = candidate->fileSystem().type();
|
||||||
auto size = candidate->capacity(); // bytes
|
auto size = candidate->capacity(); // bytes
|
||||||
|
|
||||||
using CalamaresUtils::Units::operator""_MiB;
|
using CalamaresUtils::Units::operator""_MiB;
|
||||||
|
|
||||||
switch( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
case FileSystem::Type::Fat32:
|
case FileSystem::Type::Fat32:
|
||||||
if ( size >= 300_MiB )
|
if ( size >= 300_MiB )
|
||||||
|
@ -138,7 +138,7 @@ PartitionLayout::init( FileSystem::Type defaultFsType, const QVariantList& confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PartitionLayout::setDefaultFsType(FileSystem::Type defaultFsType)
|
PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType )
|
||||||
{
|
{
|
||||||
using FileSystem = FileSystem::Type;
|
using FileSystem = FileSystem::Type;
|
||||||
switch ( defaultFsType )
|
switch ( defaultFsType )
|
||||||
@ -158,7 +158,8 @@ PartitionLayout::setDefaultFsType(FileSystem::Type defaultFsType)
|
|||||||
case FileSystem::BitLocker:
|
case FileSystem::BitLocker:
|
||||||
#endif
|
#endif
|
||||||
// bad bad
|
// bad bad
|
||||||
cWarning() << "The selected default FS" << defaultFsType << "is not suitable." << "Using ext4 instead.";
|
cWarning() << "The selected default FS" << defaultFsType << "is not suitable."
|
||||||
|
<< "Using ext4 instead.";
|
||||||
defaultFsType = FileSystem::Ext4;
|
defaultFsType = FileSystem::Ext4;
|
||||||
break;
|
break;
|
||||||
case FileSystem::Ext2:
|
case FileSystem::Ext2:
|
||||||
@ -191,7 +192,8 @@ PartitionLayout::setDefaultFsType(FileSystem::Type defaultFsType)
|
|||||||
cWarning() << "The selected default FS" << defaultFsType << "is unusual, but not wrong.";
|
cWarning() << "The selected default FS" << defaultFsType << "is unusual, but not wrong.";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cWarning() << "The selected default FS" << defaultFsType << "is not known to Calamares." << "Using ext4 instead.";
|
cWarning() << "The selected default FS" << defaultFsType << "is not known to Calamares."
|
||||||
|
<< "Using ext4 instead.";
|
||||||
defaultFsType = FileSystem::Ext4;
|
defaultFsType = FileSystem::Ext4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +280,7 @@ PartitionLayout::createPartitions( Device* dev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto correctFS = [d=m_defaultFsType]( FileSystem::Type t ) { return t == FileSystem::Type::Unknown ? d : t; };
|
auto correctFS = [d = m_defaultFsType]( FileSystem::Type t ) { return t == FileSystem::Type::Unknown ? d : t; };
|
||||||
|
|
||||||
// Create the partitions.
|
// Create the partitions.
|
||||||
currentSector = firstSector;
|
currentSector = firstSector;
|
||||||
|
@ -270,11 +270,12 @@ ChoicePage::setupChoices()
|
|||||||
m_eraseButton->addOptionsComboBox( m_eraseSwapChoiceComboBox );
|
m_eraseButton->addOptionsComboBox( m_eraseSwapChoiceComboBox );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_config->eraseFsTypes().count() > 1)
|
if ( m_config->eraseFsTypes().count() > 1 )
|
||||||
{
|
{
|
||||||
m_eraseFsTypesChoiceComboBox = new QComboBox;
|
m_eraseFsTypesChoiceComboBox = new QComboBox;
|
||||||
m_eraseFsTypesChoiceComboBox->addItems(m_config->eraseFsTypes());
|
m_eraseFsTypesChoiceComboBox->addItems( m_config->eraseFsTypes() );
|
||||||
connect( m_eraseFsTypesChoiceComboBox, &QComboBox::currentTextChanged, m_config, &Config::setEraseFsTypeChoice );
|
connect(
|
||||||
|
m_eraseFsTypesChoiceComboBox, &QComboBox::currentTextChanged, m_config, &Config::setEraseFsTypeChoice );
|
||||||
connect( m_config, &Config::eraseModeFilesystemChanged, this, &ChoicePage::onActionChanged );
|
connect( m_config, &Config::eraseModeFilesystemChanged, this, &ChoicePage::onActionChanged );
|
||||||
m_eraseButton->addOptionsComboBox( m_eraseFsTypesChoiceComboBox );
|
m_eraseButton->addOptionsComboBox( m_eraseFsTypesChoiceComboBox );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user