[partition] Start sanitizing the Jobs on a Device

- having a struct with an obtuse API for adding jobs-that-need-to-happen-
  to-this-device is just not good for maintainability.
- break the build by making things private.
This commit is contained in:
Adriaan de Groot 2020-08-03 13:13:56 +02:00
parent c63d4ad2cc
commit c2929e93b3
2 changed files with 9 additions and 3 deletions

View File

@ -120,7 +120,7 @@ PartitionCoreModule::DeviceInfo::~DeviceInfo() {}
void void
PartitionCoreModule::DeviceInfo::forgetChanges() PartitionCoreModule::DeviceInfo::forgetChanges()
{ {
jobs.clear(); m_jobs.clear();
for ( auto it = PartitionIterator::begin( device.data() ); it != PartitionIterator::end( device.data() ); ++it ) for ( auto it = PartitionIterator::begin( device.data() ); it != PartitionIterator::end( device.data() ); ++it )
{ {
PartitionInfo::reset( *it ); PartitionInfo::reset( *it );
@ -132,16 +132,18 @@ PartitionCoreModule::DeviceInfo::forgetChanges()
bool bool
PartitionCoreModule::DeviceInfo::isDirty() const PartitionCoreModule::DeviceInfo::isDirty() const
{ {
if ( !jobs.isEmpty() ) if ( !m_jobs.isEmpty() )
{ {
return true; return true;
} }
for ( auto it = PartitionIterator::begin( device.data() ); it != PartitionIterator::end( device.data() ); ++it ) for ( auto it = PartitionIterator::begin( device.data() ); it != PartitionIterator::end( device.data() ); ++it )
{
if ( PartitionInfo::isDirty( *it ) ) if ( PartitionInfo::isDirty( *it ) )
{ {
return true; return true;
} }
}
return false; return false;
} }

View File

@ -255,13 +255,17 @@ private:
QScopedPointer< Device > device; QScopedPointer< Device > device;
QScopedPointer< PartitionModel > partitionModel; QScopedPointer< PartitionModel > partitionModel;
const QScopedPointer< Device > immutableDevice; const QScopedPointer< Device > immutableDevice;
Calamares::JobList jobs;
// To check if LVM VGs are deactivated // To check if LVM VGs are deactivated
bool isAvailable; bool isAvailable;
void forgetChanges(); void forgetChanges();
bool isDirty() const; bool isDirty() const;
const Calamares::JobList& jobs() const { return m_jobs; }
private:
Calamares::JobList m_jobs;
}; };
QList< DeviceInfo* > m_deviceInfos; QList< DeviceInfo* > m_deviceInfos;
QList< Partition* > m_efiSystemPartitions; QList< Partition* > m_efiSystemPartitions;