Move osprober management out of ctor.

main
Teo Mrnjavac 10 years ago
parent a2f1d49983
commit 905835295a

@ -31,7 +31,6 @@
#include <gui/PartitionPage.h>
#include <gui/ReplacePage.h>
#include <gui/PartitionPreview.h>
#include "OsproberEntry.h"
#include "CalamaresVersion.h"
#include "utils/CalamaresUtilsGui.h"
@ -71,6 +70,49 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
timer->setSingleShot( true );
connect( timer, &QTimer::timeout,
[=]()
{
OsproberEntryList osproberEntries = runOsprober();
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();
timer->deleteLater();
} );
timer->start( 0 );
connect( m_core, &PartitionCoreModule::hasRootMountPointChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_choicePage, &ChoicePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_erasePage, &EraseDiskPage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_alongsidePage, &AlongsidePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_replacePage, &ReplacePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
}
PartitionViewStep::~PartitionViewStep()
{
if ( m_choicePage && m_choicePage->parent() == nullptr )
m_choicePage->deleteLater();
if ( m_manualPartitionPage && m_manualPartitionPage->parent() == nullptr )
m_manualPartitionPage->deleteLater();
}
OsproberEntryList
PartitionViewStep::runOsprober()
{
QString osproberOutput;
QProcess osprober;
@ -116,43 +158,10 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
}
osProberReport.append( osproberCleanLines.join( '\n' ) );
cDebug() << osProberReport;
Calamares::JobQueue::instance()->globalStorage()->insert( "osproberLines", osproberCleanLines );
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();
timer->deleteLater();
} );
timer->start( 0 );
connect( m_core, &PartitionCoreModule::hasRootMountPointChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_choicePage, &ChoicePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_erasePage, &EraseDiskPage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_alongsidePage, &AlongsidePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
connect( m_replacePage, &ReplacePage::nextStatusChanged,
this, &PartitionViewStep::nextStatusChanged );
}
Calamares::JobQueue::instance()->globalStorage()->insert( "osproberLines", osproberCleanLines );
PartitionViewStep::~PartitionViewStep()
{
if ( m_choicePage && m_choicePage->parent() == nullptr )
m_choicePage->deleteLater();
if ( m_manualPartitionPage && m_manualPartitionPage->parent() == nullptr )
m_manualPartitionPage->deleteLater();
return osproberEntries;
}

@ -24,6 +24,7 @@
#include "viewpages/ViewStep.h"
#include "PluginDllMacro.h"
#include "OsproberEntry.h"
class ChoicePage;
class EraseDiskPage;
@ -69,6 +70,7 @@ public:
QList< Calamares::job_ptr > jobs() const override;
private:
OsproberEntryList runOsprober();
bool canBeResized( const QString& partitionPath );
PartitionCoreModule* m_core;

Loading…
Cancel
Save