From f11d932d4baf1072ed431b4cd588ae0f4290a18d Mon Sep 17 00:00:00 2001 From: Bernhard Landauer Date: Sat, 21 Jan 2017 02:39:59 +0100 Subject: [PATCH] Style. --- .../gui/EditExistingPartitionDialog.cpp | 16 +++++++++------ src/modules/partition/gui/PartitionPage.cpp | 20 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index 5aa1e21f6..1909e48e8 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -67,7 +67,8 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox ); m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) ); - connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &EditExistingPartitionDialog::checkMountPointSelection ); + connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, + this, &EditExistingPartitionDialog::checkMountPointSelection ); replacePartResizerWidget(); @@ -300,11 +301,14 @@ EditExistingPartitionDialog::checkMountPointSelection() { const QString& selection = m_ui->mountPointComboBox->currentText(); - if (m_usedMountPoints.contains(selection)) { - m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one."); - m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - } else { + if ( m_usedMountPoints.contains( selection ) ) + { + m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) ); + m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false ); + } + else + { m_ui->labelMountPoint->setText( QString() ); - m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); + m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( true ); } } diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 6306c7a67..a4dfad423 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -177,7 +177,10 @@ PartitionPage::onCreateClicked() Partition* partition = model->partitionForIndex( index ); Q_ASSERT( partition ); - QPointer dlg = new CreatePartitionDialog( model->device(), partition->parent(), getCurrentUsedMountpoints(), this ); + QPointer dlg = new CreatePartitionDialog( model->device(), + partition->parent(), + getCurrentUsedMountpoints(), + this ); dlg->initFromFreeSpace( partition ); if ( dlg->exec() == QDialog::Accepted ) { @@ -269,7 +272,10 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) QStringList mountPoints = getCurrentUsedMountpoints(); mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); - QPointer dlg = new CreatePartitionDialog( device, partition->parent(), mountPoints, this ); + QPointer dlg = new CreatePartitionDialog( device, + partition->parent(), + mountPoints, + this ); dlg->initFromPartitionToCreate( partition ); if ( dlg->exec() == QDialog::Accepted ) { @@ -387,19 +393,19 @@ PartitionPage::updateBootLoaderIndex() QStringList PartitionPage::getCurrentUsedMountpoints() { - QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); + QModelIndex index = m_core->deviceModel()->index( + m_ui->deviceComboBox->currentIndex(), 0 ); if ( !index.isValid() ) return QStringList(); Device* device = m_core->deviceModel()->deviceForIndex( index ); QStringList mountPoints; - for (Partition* partition : device->partitionTable()->children()) { + for ( Partition* partition : device->partitionTable()->children() ) + { const QString& mountPoint = PartitionInfo::mountPoint( partition ); - - if (!mountPoint.isEmpty()) { + if ( !mountPoint.isEmpty() ) mountPoints << mountPoint; - } } return mountPoints;