diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 393054ba2..a5623bcdd 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -18,6 +18,7 @@ #include "ChoicePage.h" +#include "core/BootLoaderModel.h" #include "core/PartitionActions.h" #include "core/PartitionCoreModule.h" #include "core/DeviceModel.h" @@ -25,6 +26,7 @@ #include "core/OsproberEntry.h" #include "PrettyRadioButton.h" +#include "ExpandableRadioButton.h" #include "PartitionPreview.h" #include "utils/CalamaresUtilsGui.h" @@ -63,6 +65,7 @@ ChoicePage::ChoicePage( bool compactMode, QWidget* parent ) , m_replaceButton( nullptr ) , m_somethingElseButton( nullptr ) , m_lastSelectedDeviceIndex( -1 ) + , m_isEfi( false ) { setupUi( this ); if ( m_compactMode ) @@ -125,6 +128,7 @@ ChoicePage::init( PartitionCoreModule* core, { m_core = core; m_osproberEntries = osproberEntries; + m_isEfi = QDir( "/sys/firmware/efi/efivars" ).exists(); setupChoices(); @@ -190,8 +194,8 @@ ChoicePage::setupChoices() // 3) Manual // TBD: upgrade option? - QSize iconSize( CalamaresUtils::defaultIconSize().width() * 2, - CalamaresUtils::defaultIconSize().height() * 2 ); + QSize iconSize( CalamaresUtils::defaultIconSize().width() * 2.5, + CalamaresUtils::defaultIconSize().height() * 2.5 ); QButtonGroup* grp = new QButtonGroup( this ); m_alongsideButton = new PrettyRadioButton; @@ -201,7 +205,30 @@ ChoicePage::setupChoices() iconSize ) ); grp->addButton( m_alongsideButton->buttonWidget() ); - m_eraseButton = new PrettyRadioButton; + m_eraseButton = new ExpandableRadioButton; + if ( !m_isEfi ) + { + QWidget* eraseWidget = new QWidget; + { + eraseWidget->setLayout( new QHBoxLayout ); + QLabel* eraseBootloaderLabel = new QLabel( eraseWidget ); + eraseWidget->layout()->addWidget( eraseBootloaderLabel ); + eraseBootloaderLabel->setText( tr( "Boot loader location:" ) ); + QComboBox* eraseBootloaderCombo = new QComboBox; + eraseWidget->layout()->addWidget( eraseBootloaderCombo ); + eraseBootloaderLabel->setBuddy( eraseBootloaderCombo ); + eraseBootloaderCombo->setModel( m_core->bootLoaderModel() ); + connect( eraseBootloaderCombo, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ), + [=]( int /* index */ ) + { + QVariant var = eraseBootloaderCombo->currentData( BootLoaderModel::BootLoaderPathRole ); + if ( !var.isValid() ) + return; + m_core->setBootLoaderInstallPath( var.toString() ); + } ); + } + m_eraseButton->setExpandableWidget( eraseWidget ); + } m_eraseButton->setIconSize( iconSize ); m_eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto, CalamaresUtils::Original, diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index 232f2009b..12d3fc945 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -31,6 +31,7 @@ class QBoxLayout; class QLabel; class QListView; +class ExpandableRadioButton; class PartitionCoreModule; class PrettyRadioButton; @@ -83,10 +84,11 @@ private: Choice m_choice; bool m_compactMode; + bool m_isEfi; QWidget* m_drivesView; PrettyRadioButton* m_alongsideButton; - PrettyRadioButton* m_eraseButton; + ExpandableRadioButton* m_eraseButton; PrettyRadioButton* m_replaceButton; PrettyRadioButton* m_somethingElseButton;