Rearrange asynchronous scan in PartitionCoreModule a bit.

This commit is contained in:
Teo Mrnjavac 2016-07-19 13:00:54 +02:00
parent 92eb947cc5
commit 45f6e6c55b
3 changed files with 17 additions and 6 deletions

View File

@ -105,11 +105,19 @@ PartitionCoreModule::PartitionCoreModule( QObject* parent )
if ( !KPMHelpers::initKPMcore() ) if ( !KPMHelpers::initKPMcore() )
qFatal( "Failed to initialize KPMcore backend" ); qFatal( "Failed to initialize KPMcore backend" );
FileSystemFactory::init(); FileSystemFactory::init();
init();
} }
void void
PartitionCoreModule::init() PartitionCoreModule::init()
{
QMutexLocker locker( &m_revertMutex );
doInit();
}
void
PartitionCoreModule::doInit()
{ {
CoreBackend* backend = CoreBackendManager::self()->backend(); CoreBackend* backend = CoreBackendManager::self()->backend();
QList< Device* > devices = backend->scanDevices( true ); QList< Device* > devices = backend->scanDevices( true );
@ -546,7 +554,7 @@ PartitionCoreModule::revert()
QMutexLocker locker( &m_revertMutex ); QMutexLocker locker( &m_revertMutex );
qDeleteAll( m_deviceInfos ); qDeleteAll( m_deviceInfos );
m_deviceInfos.clear(); m_deviceInfos.clear();
init(); doInit();
updateIsDirty(); updateIsDirty();
emit reverted(); emit reverted();
} }

View File

@ -64,6 +64,8 @@ public:
PartitionCoreModule( QObject* parent = nullptr ); PartitionCoreModule( QObject* parent = nullptr );
~PartitionCoreModule(); ~PartitionCoreModule();
void init();
DeviceModel* deviceModel() const; DeviceModel* deviceModel() const;
PartitionModel* partitionModelForDevice( Device* device ) const; PartitionModel* partitionModelForDevice( Device* device ) const;
@ -159,7 +161,7 @@ private:
bool m_isDirty = false; bool m_isDirty = false;
QString m_bootLoaderInstallPath; QString m_bootLoaderInstallPath;
void init(); void doInit();
void updateHasRootMountPoint(); void updateHasRootMountPoint();
void updateIsDirty(); void updateIsDirty();
void scanForEfiSystemPartitions(); void scanForEfiSystemPartitions();

View File

@ -58,8 +58,8 @@
PartitionViewStep::PartitionViewStep( QObject* parent ) PartitionViewStep::PartitionViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_widget( new QStackedWidget() )
, m_core( nullptr ) , m_core( nullptr )
, m_widget( new QStackedWidget() )
, m_choicePage( nullptr ) , m_choicePage( nullptr )
, m_manualPartitionPage( nullptr ) , m_manualPartitionPage( nullptr )
{ {
@ -69,6 +69,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_widget->addWidget( m_waitingWidget ); m_widget->addWidget( m_waitingWidget );
CALAMARES_RETRANSLATE( qobject_cast< WaitingWidget* >( m_waitingWidget )->setText( tr( "Gathering system information..." ) ); ) CALAMARES_RETRANSLATE( qobject_cast< WaitingWidget* >( m_waitingWidget )->setText( tr( "Gathering system information..." ) ); )
m_core = new PartitionCoreModule( this ); // Unusable before init is complete!
// We're not done loading, but we need the configuration map first. // We're not done loading, but we need the configuration map first.
} }
@ -76,8 +77,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
void void
PartitionViewStep::initPartitionCoreModule() PartitionViewStep::initPartitionCoreModule()
{ {
Q_ASSERT( !m_core ); Q_ASSERT( m_core );
m_core = new PartitionCoreModule( this ); m_core->init();
} }