[partition] Introduce a check if the GPT-on-BIOS popup should be shown

The check is bogus right now, and it still always warns; but if
the `shouldWarnForGPTOnBIOS()` function is implemented, this will
fix issue 1701.
This commit is contained in:
Adriaan de Groot 2021-05-25 10:47:05 +02:00
parent ded7991dd6
commit d630c2aadf

View File

@ -395,6 +395,18 @@ PartitionViewStep::onActivate()
} }
} }
static bool
shouldWarnForGPTOnBIOS( const PartitionCoreModule* core )
{
if ( PartUtils::isEfiSystem() )
{
return false;
}
cDebug() << core->bootLoaderInstallPath();
return true;
}
void void
PartitionViewStep::onLeave() PartitionViewStep::onLeave()
@ -462,24 +474,25 @@ PartitionViewStep::onLeave()
{ {
cDebug() << "device: BIOS"; cDebug() << "device: BIOS";
// TODO: this *always* warns, which might be annoying, so it'd be
// best to find a way to detect that bios_grub partition.
QString message = tr( "Option to use GPT on BIOS" ); if ( shouldWarnForGPTOnBIOS( m_core ) )
QString description = tr( "A GPT partition table is the best option for all " {
"systems. This installer supports such a setup for " QString message = tr( "Option to use GPT on BIOS" );
"BIOS systems too." QString description = tr( "A GPT partition table is the best option for all "
"<br/><br/>" "systems. This installer supports such a setup for "
"To configure a GPT partition table on BIOS, " "BIOS systems too."
"(if not done so already) go back " "<br/><br/>"
"and set the partition table to GPT, next create a 8 MB " "To configure a GPT partition table on BIOS, "
"unformatted partition with the " "(if not done so already) go back "
"<strong>bios_grub</strong> flag enabled.<br/><br/>" "and set the partition table to GPT, next create a 8 MB "
"An unformatted 8 MB partition is necessary " "unformatted partition with the "
"to start %1 on a BIOS system with GPT." ) "<strong>bios_grub</strong> flag enabled.<br/><br/>"
.arg( branding->shortProductName() ); "An unformatted 8 MB partition is necessary "
"to start %1 on a BIOS system with GPT." )
.arg( branding->shortProductName() );
QMessageBox::information( m_manualPartitionPage, message, description ); QMessageBox::information( m_manualPartitionPage, message, description );
}
} }
Partition* root_p = m_core->findPartitionByMountPoint( "/" ); Partition* root_p = m_core->findPartitionByMountPoint( "/" );
@ -593,7 +606,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
// because it could take a while. Then when it's done, we can set up the widgets // because it could take a while. Then when it's done, we can set up the widgets
// and remove the spinner. // and remove the spinner.
m_future = new QFutureWatcher< void >(); m_future = new QFutureWatcher< void >();
connect( m_future, &QFutureWatcher< void >::finished, this, [this] { connect( m_future, &QFutureWatcher< void >::finished, this, [ this ] {
continueLoading(); continueLoading();
this->m_future->deleteLater(); this->m_future->deleteLater();
this->m_future = nullptr; this->m_future = nullptr;