Coding style fixes

This commit is contained in:
Aurélien Gâteau 2014-07-15 11:11:17 +02:00
parent 79bf4f3b5a
commit cbcd821943
8 changed files with 47 additions and 93 deletions

View File

@ -55,9 +55,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, Partition* freePar
}
if ( fixedPartitionType.isEmpty() )
{
m_ui->fixedPartitionLabel->hide();
}
else
{
m_ui->fixedPartitionLabel->setText( fixedPartitionType );
@ -70,10 +68,8 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, Partition* freePar
for ( auto fs : FileSystemFactory::map() )
{
if ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended )
{
fsNames << fs->name();
}
}
m_ui->fsComboBox->addItems( fsNames );
// Size

View File

@ -84,9 +84,7 @@ CreatePartitionJob::exec()
FileSystem& fs = m_partition->fileSystem();
if ( fs.type() == FileSystem::Unformatted )
{
return Calamares::JobResult::ok();
}
if ( !fs.create( report, partitionPath ) )
{

View File

@ -104,7 +104,5 @@ DeletePartitionJob::updatePreview()
// become sda5, sda6, sda7
Partition* parentPartition = dynamic_cast< Partition* >( m_partition->parent() );
if ( parentPartition && parentPartition->roles().has( PartitionRole::Extended ) )
{
parentPartition->adjustLogicalNumbers( m_partition->number(), -1 );
}
}

View File

@ -49,9 +49,7 @@ DeviceModel::data( const QModelIndex& index, int role ) const
{
int row = index.row();
if ( row < 0 || row >= m_devices.count() )
{
return QVariant();
}
Device* device = m_devices.at( row );
@ -59,13 +57,9 @@ DeviceModel::data( const QModelIndex& index, int role ) const
{
case Qt::DisplayRole:
if ( device->name().isEmpty() )
{
return device->deviceNode();
}
else
{
return device->name() + " " + device->deviceNode();
}
default:
return QVariant();
}
@ -76,8 +70,6 @@ DeviceModel::deviceForIndex( const QModelIndex& index ) const
{
int row = index.row();
if ( row < 0 || row >= m_devices.count() )
{
return nullptr;
}
return m_devices.at( row );
}

View File

@ -56,9 +56,7 @@ PartitionCoreModule::DeviceInfo::addInfoForPartition( PartitionInfo* partitionIn
{
Q_ASSERT( partitionInfo );
if ( infoForPartition( partitionInfo->partition ) )
{
return false;
}
m_partitionInfoHash.insert( partitionInfo->partition, partitionInfo );
return true;
}
@ -75,10 +73,8 @@ PartitionCoreModule::DeviceInfo::hasRootMountPoint() const
for ( auto info : m_partitionInfoHash )
{
if ( info->mountPoint == "/" )
{
return true;
}
}
return false;
}
@ -97,9 +93,7 @@ PartitionCoreModule::PartitionCoreModule( QObject* parent )
{
// FIXME: Should be done at startup
if ( !CalaPM::init() )
{
qFatal( "Failed to init CalaPM" );
}
CoreBackend* backend = CoreBackendManager::self()->backend();
auto devices = backend->scanDevices();
@ -221,9 +215,7 @@ PartitionCoreModule::jobs() const
{
QList< Calamares::job_ptr > lst;
for ( auto info : m_deviceInfos )
{
lst << info->jobs;
}
return lst;
}
@ -235,11 +227,9 @@ PartitionCoreModule::dumpQueue() const
{
cDebug() << "Device:" << info->device->name();
for ( auto job : info->jobs )
{
cDebug() << job->prettyName();
}
}
}
void
PartitionCoreModule::refreshPartitionModel( Device* device )
@ -264,10 +254,8 @@ void PartitionCoreModule::updateHasRootMountPoint()
}
if ( oldValue != m_hasRootMountPoint )
{
hasRootMountPointChanged( m_hasRootMountPoint );
}
}
PartitionCoreModule::DeviceInfo*
PartitionCoreModule::infoForDevice( Device* device ) const
@ -275,9 +263,7 @@ PartitionCoreModule::infoForDevice( Device* device ) const
for ( auto deviceInfo : m_deviceInfos )
{
if ( deviceInfo->device.data() == device )
{
return deviceInfo;
}
}
return nullptr;
}

View File

@ -52,9 +52,7 @@ PartitionModel::reload()
beginResetModel();
m_partitionList.clear();
if ( m_device )
{
fillPartitionList( m_device->partitionTable() );
}
endResetModel();
}
@ -75,9 +73,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
{
int row = index.row();
if ( row < 0 || row >= m_partitionList.count() )
{
return QVariant();
}
Partition* partition = m_partitionList.at( row );
@ -93,9 +89,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
QString prefix = partition->roles().has( PartitionRole::Logical )
? QStringLiteral( " " ) : QStringLiteral();
if ( PMUtils::isPartitionFreeSpace( partition ) )
{
return prefix + tr( "Free Space" );
}
else
{
return prefix + ( partition->partitionPath().isEmpty()
@ -104,9 +98,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
}
}
if ( col == FileSystemColumn )
{
return partition->fileSystem().name();
}
if ( col == MountPointColumn )
{
PartitionInfo* info = m_infoProvider->infoForPartition( partition );
@ -129,9 +121,7 @@ void
PartitionModel::fillPartitionList( PartitionNode* parent )
{
if ( !parent )
{
return;
}
for ( auto partition : parent->children() )
{
m_partitionList << partition;
@ -144,8 +134,6 @@ PartitionModel::partitionForIndex( const QModelIndex& index ) const
{
int row = index.row();
if ( row < 0 || row >= m_partitionList.count() )
{
return nullptr;
}
return m_partitionList.at( row );
}

View File

@ -118,9 +118,7 @@ PartitionPage::onNewPartitionTableClicked()
);
if ( answer != QMessageBox::Ok )
{
return;
}
m_core->createPartitionTable( device );
}
@ -136,9 +134,7 @@ PartitionPage::onCreateClicked()
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( model->device(), partition, this );
if ( dlg->exec() == QDialog::Accepted )
{
m_core->createPartition( model->device(), dlg->createPartitionInfo() );
}
delete dlg;
}