Continue asynchronously loading PartitionViewStep after config load.
This commit is contained in:
parent
3ba058d5b7
commit
9a67f6372c
@ -57,40 +57,43 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
|
||||
: Calamares::ViewStep( parent )
|
||||
, m_widget( new QStackedWidget() )
|
||||
, m_core( new PartitionCoreModule( this ) )
|
||||
, m_choicePage( new ChoicePage() )
|
||||
, m_choicePage( nullptr )
|
||||
, m_erasePage( new EraseDiskPage() )
|
||||
, m_alongsidePage( new AlongsidePage() )
|
||||
, m_manualPartitionPage( new PartitionPage( m_core ) )
|
||||
, m_replacePage( new ReplacePage( m_core ) )
|
||||
, m_compactMode( true )
|
||||
{
|
||||
m_widget->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
WaitingWidget* waitingWidget = new WaitingWidget( QString() );
|
||||
m_widget->addWidget( waitingWidget );
|
||||
CALAMARES_RETRANSLATE( waitingWidget->setText( tr( "Gathering system information..." ) ); )
|
||||
m_waitingWidget = new WaitingWidget( QString() );
|
||||
m_widget->addWidget( m_waitingWidget );
|
||||
CALAMARES_RETRANSLATE( qobject_cast< WaitingWidget* >( m_waitingWidget )->setText( tr( "Gathering system information..." ) ); )
|
||||
|
||||
QTimer* timer = new QTimer;
|
||||
timer->setSingleShot( true );
|
||||
connect( timer, &QTimer::timeout,
|
||||
[=]()
|
||||
{
|
||||
OsproberEntryList osproberEntries = PartUtils::runOsprober( m_core );
|
||||
// We're not done loading, but we need the configuration map first.
|
||||
}
|
||||
|
||||
m_choicePage->init( m_core, osproberEntries );
|
||||
m_erasePage->init( m_core );
|
||||
m_alongsidePage->init( m_core, osproberEntries );
|
||||
|
||||
m_widget->addWidget( m_choicePage );
|
||||
m_widget->addWidget( m_manualPartitionPage );
|
||||
m_widget->addWidget( m_alongsidePage );
|
||||
m_widget->addWidget( m_erasePage );
|
||||
m_widget->addWidget( m_replacePage );
|
||||
m_widget->removeWidget( waitingWidget );
|
||||
waitingWidget->deleteLater();
|
||||
void
|
||||
PartitionViewStep::continueLoading()
|
||||
{
|
||||
OsproberEntryList osproberEntries = PartUtils::runOsprober( m_core );
|
||||
|
||||
timer->deleteLater();
|
||||
} );
|
||||
timer->start( 0 );
|
||||
Q_ASSERT( !m_choicePage );
|
||||
m_choicePage = new ChoicePage( m_compactMode );
|
||||
|
||||
m_choicePage->init( m_core, osproberEntries );
|
||||
m_erasePage->init( m_core );
|
||||
m_alongsidePage->init( m_core, osproberEntries );
|
||||
|
||||
m_widget->addWidget( m_choicePage );
|
||||
m_widget->addWidget( m_manualPartitionPage );
|
||||
m_widget->addWidget( m_alongsidePage );
|
||||
m_widget->addWidget( m_erasePage );
|
||||
m_widget->addWidget( m_replacePage );
|
||||
m_widget->removeWidget( m_waitingWidget );
|
||||
m_waitingWidget->deleteLater();
|
||||
m_waitingWidget = nullptr;
|
||||
|
||||
connect( m_core, &PartitionCoreModule::hasRootMountPointChanged,
|
||||
this, &PartitionViewStep::nextStatusChanged );
|
||||
@ -394,6 +397,14 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
gs->insert( "ensureSuspendToDisk", true );
|
||||
}
|
||||
|
||||
if ( configurationMap.contains( "compactMode" ) &&
|
||||
configurationMap.value( "compactMode" ).type() == QVariant::Bool )
|
||||
{
|
||||
m_compactMode = configurationMap.value( "compactMode", true ).toBool();
|
||||
}
|
||||
|
||||
QTimer::singleShot( 0, this, &PartitionViewStep::continueLoading );
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
explicit PartitionViewStep( QObject* parent = 0 );
|
||||
virtual ~PartitionViewStep();
|
||||
|
||||
void continueLoading();
|
||||
|
||||
QString prettyName() const override;
|
||||
QWidget* createSummaryWidget() const override;
|
||||
|
||||
@ -76,6 +78,10 @@ private:
|
||||
AlongsidePage* m_alongsidePage;
|
||||
PartitionPage* m_manualPartitionPage;
|
||||
ReplacePage* m_replacePage;
|
||||
|
||||
QWidget* m_waitingWidget;
|
||||
|
||||
bool m_compactMode;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory )
|
||||
|
Loading…
Reference in New Issue
Block a user