[partition] Apply coding style
This applies the new(er) style to the whole module, rather than just the files that recently changed.
This commit is contained in:
parent
c4eee7bb11
commit
cf913b87ff
@ -675,11 +675,15 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
// because it could take a while. Then when it's done, we can set up the widgets
|
// because it could take a while. Then when it's done, we can set up the widgets
|
||||||
// and remove the spinner.
|
// and remove the spinner.
|
||||||
m_future = new QFutureWatcher< void >();
|
m_future = new QFutureWatcher< void >();
|
||||||
connect( m_future, &QFutureWatcher< void >::finished, this, [this] {
|
connect( m_future,
|
||||||
continueLoading();
|
&QFutureWatcher< void >::finished,
|
||||||
this->m_future->deleteLater();
|
this,
|
||||||
this->m_future = nullptr;
|
[ this ]
|
||||||
} );
|
{
|
||||||
|
continueLoading();
|
||||||
|
this->m_future->deleteLater();
|
||||||
|
this->m_future = nullptr;
|
||||||
|
} );
|
||||||
|
|
||||||
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
||||||
m_future->setFuture( future );
|
m_future->setFuture( future );
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
static void
|
static void
|
||||||
sortDevices( DeviceModel::DeviceList& l )
|
sortDevices( DeviceModel::DeviceList& l )
|
||||||
{
|
{
|
||||||
std::sort( l.begin(), l.end(), []( const Device* dev1, const Device* dev2 ) {
|
std::sort( l.begin(),
|
||||||
return dev1->deviceNode() < dev2->deviceNode();
|
l.end(),
|
||||||
} );
|
[]( const Device* dev1, const Device* dev2 ) { return dev1->deviceNode() < dev2->deviceNode(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceModel::DeviceModel( QObject* parent )
|
DeviceModel::DeviceModel( QObject* parent )
|
||||||
|
@ -262,11 +262,9 @@ PartitionCoreModule::doInit()
|
|||||||
// Gives ownership of the Device* to the DeviceInfo object
|
// Gives ownership of the Device* to the DeviceInfo object
|
||||||
auto deviceInfo = new DeviceInfo( device );
|
auto deviceInfo = new DeviceInfo( device );
|
||||||
m_deviceInfos << deviceInfo;
|
m_deviceInfos << deviceInfo;
|
||||||
cDebug() << Logger::SubEntry
|
cDebug() << Logger::SubEntry << device->deviceNode() << device->capacity()
|
||||||
<< device->deviceNode()
|
<< Logger::RedactedName( "DevName", device->name() )
|
||||||
<< device->capacity()
|
<< Logger::RedactedName( "DevNamePretty", device->prettyName() );
|
||||||
<< Logger::RedactedName( "DevName", device->name() )
|
|
||||||
<< Logger::RedactedName( "DevNamePretty", device->prettyName() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -685,9 +683,8 @@ PartitionCoreModule::lvmPVs() const
|
|||||||
bool
|
bool
|
||||||
PartitionCoreModule::hasVGwithThisName( const QString& name ) const
|
PartitionCoreModule::hasVGwithThisName( const QString& name ) const
|
||||||
{
|
{
|
||||||
auto condition = [name]( DeviceInfo* d ) {
|
auto condition = [ name ]( DeviceInfo* d )
|
||||||
return dynamic_cast< LvmDevice* >( d->device.data() ) && d->device.data()->name() == name;
|
{ return dynamic_cast< LvmDevice* >( d->device.data() ) && d->device.data()->name() == name; };
|
||||||
};
|
|
||||||
|
|
||||||
return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end();
|
return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end();
|
||||||
}
|
}
|
||||||
@ -695,7 +692,8 @@ PartitionCoreModule::hasVGwithThisName( const QString& name ) const
|
|||||||
bool
|
bool
|
||||||
PartitionCoreModule::isInVG( const Partition* partition ) const
|
PartitionCoreModule::isInVG( const Partition* partition ) const
|
||||||
{
|
{
|
||||||
auto condition = [partition]( DeviceInfo* d ) {
|
auto condition = [ partition ]( DeviceInfo* d )
|
||||||
|
{
|
||||||
LvmDevice* vg = dynamic_cast< LvmDevice* >( d->device.data() );
|
LvmDevice* vg = dynamic_cast< LvmDevice* >( d->device.data() );
|
||||||
return vg && vg->physicalVolumes().contains( partition );
|
return vg && vg->physicalVolumes().contains( partition );
|
||||||
};
|
};
|
||||||
@ -964,9 +962,9 @@ PartitionCoreModule::layoutApply( Device* dev,
|
|||||||
const QString boot = QStringLiteral( "/boot" );
|
const QString boot = QStringLiteral( "/boot" );
|
||||||
const QString root = QStringLiteral( "/" );
|
const QString root = QStringLiteral( "/" );
|
||||||
const auto is_boot
|
const auto is_boot
|
||||||
= [&]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == boot || p->mountPoint() == boot; };
|
= [ & ]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == boot || p->mountPoint() == boot; };
|
||||||
const auto is_root
|
const auto is_root
|
||||||
= [&]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == root || p->mountPoint() == root; };
|
= [ & ]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == root || p->mountPoint() == root; };
|
||||||
|
|
||||||
const bool separate_boot_partition
|
const bool separate_boot_partition
|
||||||
= std::find_if( partList.constBegin(), partList.constEnd(), is_boot ) != partList.constEnd();
|
= std::find_if( partList.constBegin(), partList.constEnd(), is_boot ) != partList.constEnd();
|
||||||
@ -1089,10 +1087,14 @@ void
|
|||||||
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
|
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
|
||||||
{
|
{
|
||||||
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
||||||
connect( watcher, &QFutureWatcher< void >::finished, this, [watcher, callback] {
|
connect( watcher,
|
||||||
callback();
|
&QFutureWatcher< void >::finished,
|
||||||
watcher->deleteLater();
|
this,
|
||||||
} );
|
[ watcher, callback ]
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
watcher->deleteLater();
|
||||||
|
} );
|
||||||
|
|
||||||
QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev, true );
|
QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev, true );
|
||||||
watcher->setFuture( future );
|
watcher->setFuture( future );
|
||||||
|
@ -283,7 +283,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;
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
* to bother with one-byte accuracy (and anyway, a double has at least 50 bits
|
* to bother with one-byte accuracy (and anyway, a double has at least 50 bits
|
||||||
* at which point we're printing giga (or gibi) bytes).
|
* at which point we're printing giga (or gibi) bytes).
|
||||||
*/
|
*/
|
||||||
static inline QString formatByteSize( qint64 sizeValue )
|
static inline QString
|
||||||
|
formatByteSize( qint64 sizeValue )
|
||||||
{
|
{
|
||||||
return Capacity::formatByteSize( static_cast< double >( sizeValue ) );
|
return Capacity::formatByteSize( static_cast< double >( sizeValue ) );
|
||||||
}
|
}
|
||||||
|
@ -176,10 +176,14 @@ ChoicePage::init( PartitionCoreModule* core )
|
|||||||
|
|
||||||
|
|
||||||
// We need to do this because a PCM revert invalidates the deviceModel.
|
// We need to do this because a PCM revert invalidates the deviceModel.
|
||||||
connect( core, &PartitionCoreModule::reverted, this, [=] {
|
connect( core,
|
||||||
setModelToComboBox( m_drivesCombo, core->deviceModel() );
|
&PartitionCoreModule::reverted,
|
||||||
m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex );
|
this,
|
||||||
} );
|
[ = ]
|
||||||
|
{
|
||||||
|
setModelToComboBox( m_drivesCombo, core->deviceModel() );
|
||||||
|
m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex );
|
||||||
|
} );
|
||||||
setModelToComboBox( m_drivesCombo, core->deviceModel() );
|
setModelToComboBox( m_drivesCombo, core->deviceModel() );
|
||||||
|
|
||||||
connect( m_drivesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), this, &ChoicePage::applyDeviceChoice );
|
connect( m_drivesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), this, &ChoicePage::applyDeviceChoice );
|
||||||
@ -303,26 +307,30 @@ ChoicePage::setupChoices()
|
|||||||
#else
|
#else
|
||||||
auto buttonSignal = &QButtonGroup::idToggled;
|
auto buttonSignal = &QButtonGroup::idToggled;
|
||||||
#endif
|
#endif
|
||||||
connect( m_grp, buttonSignal, this, [this]( int id, bool checked ) {
|
connect( m_grp,
|
||||||
if ( checked ) // An action was picked.
|
buttonSignal,
|
||||||
{
|
this,
|
||||||
m_config->setInstallChoice( id );
|
[ this ]( int id, bool checked )
|
||||||
updateNextEnabled();
|
{
|
||||||
|
if ( checked ) // An action was picked.
|
||||||
|
{
|
||||||
|
m_config->setInstallChoice( id );
|
||||||
|
updateNextEnabled();
|
||||||
|
|
||||||
Q_EMIT actionChosen();
|
Q_EMIT actionChosen();
|
||||||
}
|
}
|
||||||
else // An action was unpicked, either on its own or because of another selection.
|
else // An action was unpicked, either on its own or because of another selection.
|
||||||
{
|
{
|
||||||
if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must
|
if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must
|
||||||
{
|
{
|
||||||
// set m_choice to NoChoice and reset previews.
|
// set m_choice to NoChoice and reset previews.
|
||||||
m_config->setInstallChoice( InstallChoice::NoChoice );
|
m_config->setInstallChoice( InstallChoice::NoChoice );
|
||||||
updateNextEnabled();
|
updateNextEnabled();
|
||||||
|
|
||||||
Q_EMIT actionChosen();
|
Q_EMIT actionChosen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
m_rightLayout->setStretchFactor( m_itemsLayout, 1 );
|
m_rightLayout->setStretchFactor( m_itemsLayout, 1 );
|
||||||
m_rightLayout->setStretchFactor( m_previewBeforeFrame, 0 );
|
m_rightLayout->setStretchFactor( m_previewBeforeFrame, 0 );
|
||||||
@ -401,11 +409,13 @@ ChoicePage::applyDeviceChoice()
|
|||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
{
|
{
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run( [=] {
|
QtConcurrent::run(
|
||||||
QMutexLocker locker( &m_coreMutex );
|
[ = ]
|
||||||
m_core->revertAllDevices();
|
{
|
||||||
} ),
|
QMutexLocker locker( &m_coreMutex );
|
||||||
[this] { continueApplyDeviceChoice(); },
|
m_core->revertAllDevices();
|
||||||
|
} ),
|
||||||
|
[ this ] { continueApplyDeviceChoice(); },
|
||||||
this );
|
this );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -493,11 +503,14 @@ ChoicePage::applyActionChoice( InstallChoice choice )
|
|||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
{
|
{
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run( [=] {
|
QtConcurrent::run(
|
||||||
QMutexLocker locker( &m_coreMutex );
|
[ = ]
|
||||||
m_core->revertDevice( selectedDevice() );
|
{
|
||||||
} ),
|
QMutexLocker locker( &m_coreMutex );
|
||||||
[=] {
|
m_core->revertDevice( selectedDevice() );
|
||||||
|
} ),
|
||||||
|
[ = ]
|
||||||
|
{
|
||||||
PartitionActions::doAutopartition( m_core, selectedDevice(), options );
|
PartitionActions::doAutopartition( m_core, selectedDevice(), options );
|
||||||
Q_EMIT deviceChosen();
|
Q_EMIT deviceChosen();
|
||||||
},
|
},
|
||||||
@ -514,10 +527,12 @@ ChoicePage::applyActionChoice( InstallChoice choice )
|
|||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
{
|
{
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run( [=] {
|
QtConcurrent::run(
|
||||||
QMutexLocker locker( &m_coreMutex );
|
[ = ]
|
||||||
m_core->revertDevice( selectedDevice() );
|
{
|
||||||
} ),
|
QMutexLocker locker( &m_coreMutex );
|
||||||
|
m_core->revertDevice( selectedDevice() );
|
||||||
|
} ),
|
||||||
[] {},
|
[] {},
|
||||||
this );
|
this );
|
||||||
}
|
}
|
||||||
@ -532,11 +547,14 @@ ChoicePage::applyActionChoice( InstallChoice choice )
|
|||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
{
|
{
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run( [=] {
|
QtConcurrent::run(
|
||||||
QMutexLocker locker( &m_coreMutex );
|
[ = ]
|
||||||
m_core->revertDevice( selectedDevice() );
|
{
|
||||||
} ),
|
QMutexLocker locker( &m_coreMutex );
|
||||||
[this] {
|
m_core->revertDevice( selectedDevice() );
|
||||||
|
} ),
|
||||||
|
[ this ]
|
||||||
|
{
|
||||||
// We need to reupdate after reverting because the splitter widget is
|
// We need to reupdate after reverting because the splitter widget is
|
||||||
// not a true view.
|
// not a true view.
|
||||||
updateActionChoicePreview( m_config->installChoice() );
|
updateActionChoicePreview( m_config->installChoice() );
|
||||||
@ -772,7 +790,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
|
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run(
|
QtConcurrent::run(
|
||||||
[this, current, homePartitionPath]( bool doReuseHomePartition ) {
|
[ this, current, homePartitionPath ]( bool doReuseHomePartition )
|
||||||
|
{
|
||||||
QMutexLocker locker( &m_coreMutex );
|
QMutexLocker locker( &m_coreMutex );
|
||||||
|
|
||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
@ -853,7 +872,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
m_reuseHomeCheckBox->isChecked() ),
|
m_reuseHomeCheckBox->isChecked() ),
|
||||||
[this, homePartitionPath] {
|
[ this, homePartitionPath ]
|
||||||
|
{
|
||||||
m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() );
|
m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() );
|
||||||
if ( !homePartitionPath->isEmpty() )
|
if ( !homePartitionPath->isEmpty() )
|
||||||
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
|
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
|
||||||
@ -1006,7 +1026,8 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
connect( m_afterPartitionSplitterWidget,
|
connect( m_afterPartitionSplitterWidget,
|
||||||
&PartitionSplitterWidget::partitionResized,
|
&PartitionSplitterWidget::partitionResized,
|
||||||
this,
|
this,
|
||||||
[this, sizeLabel]( const QString& path, qint64 size, qint64 sizeNext ) {
|
[ this, sizeLabel ]( const QString& path, qint64 size, qint64 sizeNext )
|
||||||
|
{
|
||||||
Q_UNUSED( path )
|
Q_UNUSED( path )
|
||||||
sizeLabel->setText(
|
sizeLabel->setText(
|
||||||
tr( "%1 will be shrunk to %2MiB and a new "
|
tr( "%1 will be shrunk to %2MiB and a new "
|
||||||
@ -1020,7 +1041,8 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
m_previewAfterFrame->show();
|
m_previewAfterFrame->show();
|
||||||
m_previewAfterLabel->show();
|
m_previewAfterLabel->show();
|
||||||
|
|
||||||
SelectionFilter filter = []( const QModelIndex& index ) {
|
SelectionFilter filter = []( const QModelIndex& index )
|
||||||
|
{
|
||||||
return PartUtils::canBeResized(
|
return PartUtils::canBeResized(
|
||||||
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ),
|
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ),
|
||||||
Logger::Once() );
|
Logger::Once() );
|
||||||
@ -1069,17 +1091,22 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
eraseBootloaderLabel->setText( tr( "Boot loader location:" ) );
|
eraseBootloaderLabel->setText( tr( "Boot loader location:" ) );
|
||||||
|
|
||||||
m_bootloaderComboBox = createBootloaderComboBox( eraseWidget );
|
m_bootloaderComboBox = createBootloaderComboBox( eraseWidget );
|
||||||
connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, [this]() {
|
connect( m_core->bootLoaderModel(),
|
||||||
if ( !m_bootloaderComboBox.isNull() )
|
&QAbstractItemModel::modelReset,
|
||||||
{
|
[ this ]()
|
||||||
Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() );
|
{
|
||||||
}
|
if ( !m_bootloaderComboBox.isNull() )
|
||||||
} );
|
{
|
||||||
|
Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox,
|
||||||
|
m_core->bootLoaderInstallPath() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
connect(
|
connect(
|
||||||
m_core,
|
m_core,
|
||||||
&PartitionCoreModule::deviceReverted,
|
&PartitionCoreModule::deviceReverted,
|
||||||
this,
|
this,
|
||||||
[this]( Device* dev ) {
|
[ this ]( Device* dev )
|
||||||
|
{
|
||||||
Q_UNUSED( dev )
|
Q_UNUSED( dev )
|
||||||
if ( !m_bootloaderComboBox.isNull() )
|
if ( !m_bootloaderComboBox.isNull() )
|
||||||
{
|
{
|
||||||
@ -1110,7 +1137,8 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectionFilter filter = []( const QModelIndex& index ) {
|
SelectionFilter filter = []( const QModelIndex& index )
|
||||||
|
{
|
||||||
return PartUtils::canBeReplaced(
|
return PartUtils::canBeReplaced(
|
||||||
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ),
|
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ),
|
||||||
Logger::Once() );
|
Logger::Once() );
|
||||||
@ -1217,18 +1245,22 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
|
|||||||
comboForBootloader->setModel( m_core->bootLoaderModel() );
|
comboForBootloader->setModel( m_core->bootLoaderModel() );
|
||||||
|
|
||||||
// When the chosen bootloader device changes, we update the choice in the PCM
|
// When the chosen bootloader device changes, we update the choice in the PCM
|
||||||
connect( comboForBootloader, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, [this]( int newIndex ) {
|
connect( comboForBootloader,
|
||||||
QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() );
|
QOverload< int >::of( &QComboBox::currentIndexChanged ),
|
||||||
if ( bootloaderCombo )
|
this,
|
||||||
{
|
[ this ]( int newIndex )
|
||||||
QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole );
|
{
|
||||||
if ( !var.isValid() )
|
QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() );
|
||||||
{
|
if ( bootloaderCombo )
|
||||||
return;
|
{
|
||||||
}
|
QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole );
|
||||||
m_core->setBootLoaderInstallPath( var.toString() );
|
if ( !var.isValid() )
|
||||||
}
|
{
|
||||||
} );
|
return;
|
||||||
|
}
|
||||||
|
m_core->setBootLoaderInstallPath( var.toString() );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
return comboForBootloader;
|
return comboForBootloader;
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,10 @@ CreatePartitionDialog::updateMountPointUi()
|
|||||||
void
|
void
|
||||||
CreatePartitionDialog::checkMountPointSelection()
|
CreatePartitionDialog::checkMountPointSelection()
|
||||||
{
|
{
|
||||||
validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), m_usedMountPoints, m_ui->mountPointExplanation, m_ui->buttonBox->button( QDialogButtonBox::Ok ));
|
validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ),
|
||||||
|
m_usedMountPoints,
|
||||||
|
m_ui->mountPointExplanation,
|
||||||
|
m_ui->buttonBox->button( QDialogButtonBox::Ok ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -69,22 +69,25 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
|
|||||||
|
|
||||||
replacePartResizerWidget();
|
replacePartResizerWidget();
|
||||||
|
|
||||||
connect( m_ui->formatRadioButton, &QAbstractButton::toggled, [this]( bool doFormat ) {
|
connect( m_ui->formatRadioButton,
|
||||||
replacePartResizerWidget();
|
&QAbstractButton::toggled,
|
||||||
|
[ this ]( bool doFormat )
|
||||||
|
{
|
||||||
|
replacePartResizerWidget();
|
||||||
|
|
||||||
m_ui->fileSystemLabel->setEnabled( doFormat );
|
m_ui->fileSystemLabel->setEnabled( doFormat );
|
||||||
m_ui->fileSystemComboBox->setEnabled( doFormat );
|
m_ui->fileSystemComboBox->setEnabled( doFormat );
|
||||||
|
|
||||||
if ( !doFormat )
|
if ( !doFormat )
|
||||||
{
|
{
|
||||||
m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) );
|
m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMountPointPicker();
|
updateMountPointPicker();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [this]( QString ) { updateMountPointPicker(); } );
|
m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [ this ]( QString ) { updateMountPointPicker(); } );
|
||||||
|
|
||||||
// File system
|
// File system
|
||||||
QStringList fsNames;
|
QStringList fsNames;
|
||||||
@ -295,5 +298,8 @@ EditExistingPartitionDialog::updateMountPointPicker()
|
|||||||
void
|
void
|
||||||
EditExistingPartitionDialog::checkMountPointSelection()
|
EditExistingPartitionDialog::checkMountPointSelection()
|
||||||
{
|
{
|
||||||
validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), m_usedMountPoints, m_ui->mountPointExplanation, m_ui->buttonBox->button( QDialogButtonBox::Ok ));
|
validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ),
|
||||||
|
m_usedMountPoints,
|
||||||
|
m_ui->mountPointExplanation,
|
||||||
|
m_ui->buttonBox->button( QDialogButtonBox::Ok ) );
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
* Since we don't have an oracle that can answer that question,
|
* Since we don't have an oracle that can answer that question,
|
||||||
* just pretend every system can do it.
|
* just pretend every system can do it.
|
||||||
*/
|
*/
|
||||||
static inline bool systemSupportsEncryptionAcceptably()
|
static inline bool
|
||||||
|
systemSupportsEncryptionAcceptably()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -53,7 +54,7 @@ EncryptWidget::EncryptWidget( QWidget* parent )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This is really ugly, but the character is unicode "unlocked"
|
// This is really ugly, but the character is unicode "unlocked"
|
||||||
m_ui->m_encryptionUnsupportedLabel->setText( QStringLiteral("🔓") );
|
m_ui->m_encryptionUnsupportedLabel->setText( QStringLiteral( "🔓" ) );
|
||||||
m_ui->m_encryptionUnsupportedLabel->show();
|
m_ui->m_encryptionUnsupportedLabel->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,10 @@ PartitionBarsView::PartitionBarsView( QWidget* parent )
|
|||||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
connect( this, &PartitionBarsView::clicked, this, [=]( const QModelIndex& index ) {
|
connect( this,
|
||||||
cDebug() << "Clicked row" << index.row();
|
&PartitionBarsView::clicked,
|
||||||
} );
|
this,
|
||||||
|
[ = ]( const QModelIndex& index ) { cDebug() << "Clicked row" << index.row(); } );
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +400,7 @@ void
|
|||||||
PartitionBarsView::setSelectionModel( QItemSelectionModel* selectionModel )
|
PartitionBarsView::setSelectionModel( QItemSelectionModel* selectionModel )
|
||||||
{
|
{
|
||||||
QAbstractItemView::setSelectionModel( selectionModel );
|
QAbstractItemView::setSelectionModel( selectionModel );
|
||||||
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } );
|
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [ = ] { viewport()->repaint(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -410,7 +411,8 @@ PartitionBarsView::setSelectionFilter( std::function< bool( const QModelIndex& )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QModelIndex PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers )
|
QModelIndex
|
||||||
|
PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers )
|
||||||
{
|
{
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,8 @@ setSelectedMountPoint( QComboBox& combo, const QString& selected )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validateMountPoint( const QString& mountPoint, const QStringList& inUse, QLabel* label, QPushButton* button )
|
bool
|
||||||
|
validateMountPoint( const QString& mountPoint, const QStringList& inUse, QLabel* label, QPushButton* button )
|
||||||
{
|
{
|
||||||
QString msg;
|
QString msg;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
@ -519,7 +519,7 @@ void
|
|||||||
PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel )
|
PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel )
|
||||||
{
|
{
|
||||||
QAbstractItemView::setSelectionModel( selectionModel );
|
QAbstractItemView::setSelectionModel( selectionModel );
|
||||||
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } );
|
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [ = ] { viewport()->repaint(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -451,15 +451,18 @@ void
|
|||||||
PartitionPage::onRevertClicked()
|
PartitionPage::onRevertClicked()
|
||||||
{
|
{
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run( [this] {
|
QtConcurrent::run(
|
||||||
QMutexLocker locker( &m_revertMutex );
|
[ this ]
|
||||||
|
{
|
||||||
|
QMutexLocker locker( &m_revertMutex );
|
||||||
|
|
||||||
int oldIndex = m_ui->deviceComboBox->currentIndex();
|
int oldIndex = m_ui->deviceComboBox->currentIndex();
|
||||||
m_core->revertAllDevices();
|
m_core->revertAllDevices();
|
||||||
m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex );
|
m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex );
|
||||||
updateFromCurrentDevice();
|
updateFromCurrentDevice();
|
||||||
} ),
|
} ),
|
||||||
[this] {
|
[ this ]
|
||||||
|
{
|
||||||
m_lastSelectedBootLoaderIndex = -1;
|
m_lastSelectedBootLoaderIndex = -1;
|
||||||
if ( m_ui->bootLoaderComboBox->currentIndex() < 0 )
|
if ( m_ui->bootLoaderComboBox->currentIndex() < 0 )
|
||||||
{
|
{
|
||||||
@ -606,7 +609,8 @@ PartitionPage::updateFromCurrentDevice()
|
|||||||
m_ui->partitionBarsView->selectionModel(),
|
m_ui->partitionBarsView->selectionModel(),
|
||||||
&QItemSelectionModel::currentChanged,
|
&QItemSelectionModel::currentChanged,
|
||||||
this,
|
this,
|
||||||
[=] {
|
[ = ]
|
||||||
|
{
|
||||||
QModelIndex selectedIndex = m_ui->partitionBarsView->selectionModel()->currentIndex();
|
QModelIndex selectedIndex = m_ui->partitionBarsView->selectionModel()->currentIndex();
|
||||||
selectedIndex = selectedIndex.sibling( selectedIndex.row(), 0 );
|
selectedIndex = selectedIndex.sibling( selectedIndex.row(), 0 );
|
||||||
m_ui->partitionBarsView->setCurrentIndex( selectedIndex );
|
m_ui->partitionBarsView->setCurrentIndex( selectedIndex );
|
||||||
@ -625,7 +629,7 @@ PartitionPage::updateFromCurrentDevice()
|
|||||||
// model changes
|
// model changes
|
||||||
connect( m_ui->partitionTreeView->selectionModel(),
|
connect( m_ui->partitionTreeView->selectionModel(),
|
||||||
&QItemSelectionModel::currentChanged,
|
&QItemSelectionModel::currentChanged,
|
||||||
[this]( const QModelIndex&, const QModelIndex& ) { updateButtons(); } );
|
[ this ]( const QModelIndex&, const QModelIndex& ) { updateButtons(); } );
|
||||||
connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::onPartitionModelReset );
|
connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::onPartitionModelReset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,14 +159,16 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize,
|
|||||||
m_itemToResizePath.clear();
|
m_itemToResizePath.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
PartitionSplitterItem itemToResize = _findItem( m_items, [path]( PartitionSplitterItem& item ) -> bool {
|
PartitionSplitterItem itemToResize = _findItem( m_items,
|
||||||
if ( path == item.itemPath )
|
[ path ]( PartitionSplitterItem& item ) -> bool
|
||||||
{
|
{
|
||||||
item.status = PartitionSplitterItem::Resizing;
|
if ( path == item.itemPath )
|
||||||
return true;
|
{
|
||||||
}
|
item.status = PartitionSplitterItem::Resizing;
|
||||||
return false;
|
return true;
|
||||||
} );
|
}
|
||||||
|
return false;
|
||||||
|
} );
|
||||||
|
|
||||||
if ( itemToResize.isNull() )
|
if ( itemToResize.isNull() )
|
||||||
{
|
{
|
||||||
@ -184,14 +186,16 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize,
|
|||||||
|
|
||||||
qint64 newSize = m_itemToResize.size - preferredSize;
|
qint64 newSize = m_itemToResize.size - preferredSize;
|
||||||
m_itemToResize.size = preferredSize;
|
m_itemToResize.size = preferredSize;
|
||||||
int opCount = _eachItem( m_items, [preferredSize]( PartitionSplitterItem& item ) -> bool {
|
int opCount = _eachItem( m_items,
|
||||||
if ( item.status == PartitionSplitterItem::Resizing )
|
[ preferredSize ]( PartitionSplitterItem& item ) -> bool
|
||||||
{
|
{
|
||||||
item.size = preferredSize;
|
if ( item.status == PartitionSplitterItem::Resizing )
|
||||||
return true;
|
{
|
||||||
}
|
item.size = preferredSize;
|
||||||
return false;
|
return true;
|
||||||
} );
|
}
|
||||||
|
return false;
|
||||||
|
} );
|
||||||
cDebug() << "each splitter item opcount:" << opCount;
|
cDebug() << "each splitter item opcount:" << opCount;
|
||||||
m_itemMinSize = minSize;
|
m_itemMinSize = minSize;
|
||||||
m_itemMaxSize = maxSize;
|
m_itemMaxSize = maxSize;
|
||||||
@ -358,19 +362,21 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
m_itemToResize.size = qRound64( span * percent );
|
m_itemToResize.size = qRound64( span * percent );
|
||||||
m_itemToResizeNext.size -= m_itemToResize.size - oldsize;
|
m_itemToResizeNext.size -= m_itemToResize.size - oldsize;
|
||||||
_eachItem( m_items, [this]( PartitionSplitterItem& item ) -> bool {
|
_eachItem( m_items,
|
||||||
if ( item.status == PartitionSplitterItem::Resizing )
|
[ this ]( PartitionSplitterItem& item ) -> bool
|
||||||
{
|
{
|
||||||
item.size = m_itemToResize.size;
|
if ( item.status == PartitionSplitterItem::Resizing )
|
||||||
return true;
|
{
|
||||||
}
|
item.size = m_itemToResize.size;
|
||||||
else if ( item.status == PartitionSplitterItem::ResizingNext )
|
return true;
|
||||||
{
|
}
|
||||||
item.size = m_itemToResizeNext.size;
|
else if ( item.status == PartitionSplitterItem::ResizingNext )
|
||||||
return true;
|
{
|
||||||
}
|
item.size = m_itemToResizeNext.size;
|
||||||
return false;
|
return true;
|
||||||
} );
|
}
|
||||||
|
return false;
|
||||||
|
} );
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
|
|
||||||
|
@ -46,9 +46,10 @@ ReplaceWidget::ReplaceWidget( PartitionCoreModule* core, QComboBox* devicesCombo
|
|||||||
m_ui->bootStatusLabel->clear();
|
m_ui->bootStatusLabel->clear();
|
||||||
|
|
||||||
updateFromCurrentDevice( devicesComboBox );
|
updateFromCurrentDevice( devicesComboBox );
|
||||||
connect( devicesComboBox, &QComboBox::currentTextChanged, this, [=]( const QString& /* text */ ) {
|
connect( devicesComboBox,
|
||||||
updateFromCurrentDevice( devicesComboBox );
|
&QComboBox::currentTextChanged,
|
||||||
} );
|
this,
|
||||||
|
[ = ]( const QString& /* text */ ) { updateFromCurrentDevice( devicesComboBox ); } );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE( onPartitionSelected(); );
|
CALAMARES_RETRANSLATE( onPartitionSelected(); );
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,16 @@ ScanningDialog::run( const QFuture< void >& future,
|
|||||||
theDialog->show();
|
theDialog->show();
|
||||||
|
|
||||||
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
||||||
connect( watcher, &QFutureWatcher< void >::finished, theDialog, [watcher, theDialog, callback] {
|
connect( watcher,
|
||||||
watcher->deleteLater();
|
&QFutureWatcher< void >::finished,
|
||||||
theDialog->hide();
|
theDialog,
|
||||||
theDialog->deleteLater();
|
[ watcher, theDialog, callback ]
|
||||||
callback();
|
{
|
||||||
} );
|
watcher->deleteLater();
|
||||||
|
theDialog->hide();
|
||||||
|
theDialog->deleteLater();
|
||||||
|
callback();
|
||||||
|
} );
|
||||||
|
|
||||||
watcher->setFuture( future );
|
watcher->setFuture( future );
|
||||||
}
|
}
|
||||||
|
@ -45,17 +45,25 @@ VolumeGroupBaseDialog::VolumeGroupBaseDialog( QString& vgName, QVector< const Pa
|
|||||||
updateOkButton();
|
updateOkButton();
|
||||||
updateTotalSize();
|
updateTotalSize();
|
||||||
|
|
||||||
connect( ui->pvList, &QListWidget::itemChanged, this, [&]( QListWidgetItem* ) {
|
connect( ui->pvList,
|
||||||
updateTotalSize();
|
&QListWidget::itemChanged,
|
||||||
updateOkButton();
|
this,
|
||||||
} );
|
[ & ]( QListWidgetItem* )
|
||||||
|
{
|
||||||
|
updateTotalSize();
|
||||||
|
updateOkButton();
|
||||||
|
} );
|
||||||
|
|
||||||
connect( ui->peSize, qOverload< int >( &QSpinBox::valueChanged ), this, [&]( int ) {
|
connect( ui->peSize,
|
||||||
updateTotalSectors();
|
qOverload< int >( &QSpinBox::valueChanged ),
|
||||||
updateOkButton();
|
this,
|
||||||
} );
|
[ & ]( int )
|
||||||
|
{
|
||||||
|
updateTotalSectors();
|
||||||
|
updateOkButton();
|
||||||
|
} );
|
||||||
|
|
||||||
connect( ui->vgName, &QLineEdit::textChanged, this, [&]( const QString& ) { updateOkButton(); } );
|
connect( ui->vgName, &QLineEdit::textChanged, this, [ & ]( const QString& ) { updateOkButton(); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
VolumeGroupBaseDialog::~VolumeGroupBaseDialog()
|
VolumeGroupBaseDialog::~VolumeGroupBaseDialog()
|
||||||
|
@ -26,7 +26,9 @@ Calamares::JobResult
|
|||||||
AutoMountManagementJob::exec()
|
AutoMountManagementJob::exec()
|
||||||
{
|
{
|
||||||
cVerbose() << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored )
|
cVerbose() << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored )
|
||||||
<< ( m_stored ? "restore" : m_disable ? "disable" : "enable" );
|
<< ( m_stored ? "restore"
|
||||||
|
: m_disable ? "disable"
|
||||||
|
: "enable" );
|
||||||
if ( m_stored )
|
if ( m_stored )
|
||||||
{
|
{
|
||||||
CalamaresUtils::Partition::automountRestore( m_stored );
|
CalamaresUtils::Partition::automountRestore( m_stored );
|
||||||
|
@ -157,9 +157,11 @@ getLVMVolumes()
|
|||||||
QStringList lvscanLines = QString::fromLocal8Bit( process.readAllStandardOutput() ).split( '\n' );
|
QStringList lvscanLines = QString::fromLocal8Bit( process.readAllStandardOutput() ).split( '\n' );
|
||||||
// Get the second column (`value(1)`) sinec that is the device name,
|
// Get the second column (`value(1)`) sinec that is the device name,
|
||||||
// remove quoting.
|
// remove quoting.
|
||||||
std::transform( lvscanLines.begin(), lvscanLines.end(), lvscanLines.begin(), []( const QString& lvscanLine ) {
|
std::transform( lvscanLines.begin(),
|
||||||
return lvscanLine.simplified().split( ' ' ).value( 1 ).replace( '\'', "" );
|
lvscanLines.end(),
|
||||||
} );
|
lvscanLines.begin(),
|
||||||
|
[]( const QString& lvscanLine )
|
||||||
|
{ return lvscanLine.simplified().split( ' ' ).value( 1 ).replace( '\'', "" ); } );
|
||||||
return lvscanLines;
|
return lvscanLines;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -69,8 +69,8 @@ AutoMountJobTests::testRunQueue()
|
|||||||
QVERIFY( !q.isRunning() );
|
QVERIFY( !q.isRunning() );
|
||||||
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QTimer::singleShot( std::chrono::milliseconds( 100 ), [&q]() { q.start(); } );
|
QTimer::singleShot( std::chrono::milliseconds( 100 ), [ &q ]() { q.start(); } );
|
||||||
QTimer::singleShot( std::chrono::milliseconds( 5000 ), [&loop]() { loop.quit(); } );
|
QTimer::singleShot( std::chrono::milliseconds( 5000 ), [ &loop ]() { loop.quit(); } );
|
||||||
connect( &q, &Calamares::JobQueue::finished, &loop, &QEventLoop::quit );
|
connect( &q, &Calamares::JobQueue::finished, &loop, &QEventLoop::quit );
|
||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@ getPartitionsForDevice_other( const QString& deviceName )
|
|||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.setProgram( "sh" );
|
process.setProgram( "sh" );
|
||||||
process.setArguments(
|
process.setArguments( { "-c",
|
||||||
{ "-c",
|
QString( "echo $(awk '{print \"/dev/\"$4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' "
|
||||||
QString( "echo $(awk '{print \"/dev/\"$4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' -e '/[1-9]/!d' | grep %1)" )
|
"-e '/[1-9]/!d' | grep %1)" )
|
||||||
.arg( deviceName ) } );
|
.arg( deviceName ) } );
|
||||||
process.start();
|
process.start();
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user