|
|
@ -33,19 +33,6 @@
|
|
|
|
#include <backend/corebackendmanager.h>
|
|
|
|
#include <backend/corebackendmanager.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//- DeviceInfo --------------------------------------------
|
|
|
|
|
|
|
|
PartitionCoreModule::DeviceInfo::DeviceInfo( Device* dev )
|
|
|
|
|
|
|
|
: device( dev )
|
|
|
|
|
|
|
|
, partitionModel( new PartitionModel )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PartitionCoreModule::DeviceInfo::~DeviceInfo()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
delete partitionModel;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//- PartitionCoreModule -----------------------------------
|
|
|
|
|
|
|
|
PartitionCoreModule::PartitionCoreModule( QObject* parent )
|
|
|
|
PartitionCoreModule::PartitionCoreModule( QObject* parent )
|
|
|
|
: QObject( parent )
|
|
|
|
: QObject( parent )
|
|
|
|
, m_deviceModel( new DeviceModel( this ) )
|
|
|
|
, m_deviceModel( new DeviceModel( this ) )
|
|
|
@ -57,14 +44,14 @@ PartitionCoreModule::PartitionCoreModule( QObject* parent )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CoreBackend* backend = CoreBackendManager::self()->backend();
|
|
|
|
CoreBackend* backend = CoreBackendManager::self()->backend();
|
|
|
|
QList< Device* > lst = backend->scanDevices();
|
|
|
|
m_devices = backend->scanDevices();
|
|
|
|
m_deviceModel->init( lst );
|
|
|
|
for ( auto device : m_devices )
|
|
|
|
for ( auto device : lst )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DeviceInfo* info = new DeviceInfo( device );
|
|
|
|
PartitionModel* model = new PartitionModel;
|
|
|
|
info->partitionModel->init( device, &m_infoForPartitionHash );
|
|
|
|
model->init( device, &m_infoForPartitionHash );
|
|
|
|
m_devices << info;
|
|
|
|
m_partitionModelForDeviceHash[ device ] = model;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_deviceModel->init( m_devices );
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -83,45 +70,25 @@ PartitionCoreModule::deviceModel() const
|
|
|
|
PartitionModel*
|
|
|
|
PartitionModel*
|
|
|
|
PartitionCoreModule::partitionModelForDevice( Device* device ) const
|
|
|
|
PartitionCoreModule::partitionModelForDevice( Device* device ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for ( auto it : m_devices )
|
|
|
|
return m_partitionModelForDeviceHash[ device ];
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( it->device == device )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return it->partitionModel;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
PartitionCoreModule::createPartition( CreatePartitionJob* job )
|
|
|
|
PartitionCoreModule::createPartition( CreatePartitionJob* job )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DeviceInfo* info = deviceInfoForDevice( job->device() );
|
|
|
|
|
|
|
|
Q_ASSERT( info );
|
|
|
|
|
|
|
|
Q_ASSERT( !m_infoForPartitionHash.contains( job->partition() ) );
|
|
|
|
Q_ASSERT( !m_infoForPartitionHash.contains( job->partition() ) );
|
|
|
|
PartitionInfo* partitionInfo = new PartitionInfo( job->partition() );
|
|
|
|
PartitionInfo* partitionInfo = new PartitionInfo( job->partition() );
|
|
|
|
partitionInfo->mountPoint = job->mountPoint();
|
|
|
|
partitionInfo->mountPoint = job->mountPoint();
|
|
|
|
m_infoForPartitionHash[ job->partition() ] = partitionInfo;
|
|
|
|
m_infoForPartitionHash[ job->partition() ] = partitionInfo;
|
|
|
|
job->updatePreview();
|
|
|
|
job->updatePreview();
|
|
|
|
info->partitionModel->reload();
|
|
|
|
auto partitionModel = m_partitionModelForDeviceHash.value( job->device() );
|
|
|
|
|
|
|
|
Q_ASSERT( partitionModel );
|
|
|
|
|
|
|
|
partitionModel->reload();
|
|
|
|
m_jobs << Calamares::job_ptr( job );
|
|
|
|
m_jobs << Calamares::job_ptr( job );
|
|
|
|
|
|
|
|
|
|
|
|
dumpQueue();
|
|
|
|
dumpQueue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PartitionCoreModule::DeviceInfo*
|
|
|
|
|
|
|
|
PartitionCoreModule::deviceInfoForDevice( Device* device ) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for ( auto info : m_devices )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( info->device == device )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
PartitionCoreModule::deletePartition( Device* device, Partition* partition )
|
|
|
|
PartitionCoreModule::deletePartition( Device* device, Partition* partition )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -157,8 +124,9 @@ PartitionCoreModule::deletePartition( Device* device, Partition* partition )
|
|
|
|
m_jobs << Calamares::job_ptr( job );
|
|
|
|
m_jobs << Calamares::job_ptr( job );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DeviceInfo* info = deviceInfoForDevice( device );
|
|
|
|
auto partitionModel = m_partitionModelForDeviceHash.value( device );
|
|
|
|
info->partitionModel->reload();
|
|
|
|
Q_ASSERT( partitionModel );
|
|
|
|
|
|
|
|
partitionModel->reload();
|
|
|
|
|
|
|
|
|
|
|
|
dumpQueue();
|
|
|
|
dumpQueue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|