[partition] Apply coding style

This commit is contained in:
Adriaan de Groot 2021-07-12 15:42:54 +02:00
parent e8b17b9878
commit b43759c6a5
6 changed files with 117 additions and 100 deletions

View File

@ -227,7 +227,8 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
QString firmwareType( PartUtils::isEfiSystem() ? QStringLiteral( "efi" ) : QStringLiteral( "bios" ) );
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
if ( configurationMap.contains( "efiSystemPartitionSize" ) )
@ -263,7 +264,8 @@ Config::fillConfigurationFSTypes(const QVariantMap& configurationMap)
fsRealName = PartUtils::canonicalFilesystemName( fsName, &fsType );
if ( fsType == FileSystem::Type::Unknown )
{
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName << ") using ext4 instead";
cWarning() << "Partition-module setting *defaultFileSystemType* is bad (" << fsName
<< ") using ext4 instead";
fsRealName = PartUtils::canonicalFilesystemName( QStringLiteral( "ext4" ), &fsType );
}
else if ( fsRealName != fsName )

View File

@ -27,7 +27,8 @@ class Config : public QObject
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")
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 )

View File

@ -115,7 +115,8 @@ PartitionViewStep::prettyName() const
* empty strings and duplicates. The list is in-order of how the
* jobs will be run.
*/
static QStringList jobDescriptions( const Calamares::JobList& jobs )
static QStringList
jobDescriptions( const Calamares::JobList& jobs )
{
QStringList jobsLines;
for ( const Calamares::job_ptr& job : qAsConst( jobs ) )
@ -132,7 +133,8 @@ static QStringList jobDescriptions( const Calamares::JobList& jobs )
*
* 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();
static const char context[] = "PartitionViewStep";
@ -144,10 +146,12 @@ static QString modeDescription( Config::InstallChoice choice )
.arg( branding->shortVersionedName() );
break;
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;
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;
case Config::InstallChoice::NoChoice:
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
* 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();
static const char context[] = "PartitionViewStep";
@ -173,27 +178,32 @@ static QString diskDescription( int listLength, const PartitionCoreModule::Summa
switch ( choice )
{
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)." )
.arg( branding->shortVersionedName() )
.arg( info.deviceNode )
.arg( info.deviceName );
break;
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( info.deviceNode )
.arg( info.deviceName );
break;
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( info.deviceNode )
.arg( info.deviceName );
break;
case Config::NoChoice:
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.deviceName );
}
@ -201,7 +211,9 @@ static QString diskDescription( int listLength, const PartitionCoreModule::Summa
}
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 );
}
}
@ -644,8 +656,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->initLayout( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() );
}

View File

@ -158,7 +158,8 @@ PartitionLayout::setDefaultFsType(FileSystem::Type defaultFsType)
case FileSystem::BitLocker:
#endif
// 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;
break;
case FileSystem::Ext2:
@ -191,7 +192,8 @@ PartitionLayout::setDefaultFsType(FileSystem::Type defaultFsType)
cWarning() << "The selected default FS" << defaultFsType << "is unusual, but not wrong.";
break;
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;
}

View File

@ -274,7 +274,8 @@ ChoicePage::setupChoices()
{
m_eraseFsTypesChoiceComboBox = new QComboBox;
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 );
m_eraseButton->addOptionsComboBox( m_eraseFsTypesChoiceComboBox );
}