|
|
@ -25,6 +25,7 @@
|
|
|
|
#include "core/PartitionModel.h"
|
|
|
|
#include "core/PartitionModel.h"
|
|
|
|
#include "core/OsproberEntry.h"
|
|
|
|
#include "core/OsproberEntry.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ReplaceWidget.h"
|
|
|
|
#include "PrettyRadioButton.h"
|
|
|
|
#include "PrettyRadioButton.h"
|
|
|
|
#include "ExpandableRadioButton.h"
|
|
|
|
#include "ExpandableRadioButton.h"
|
|
|
|
#include "PartitionPreview.h"
|
|
|
|
#include "PartitionPreview.h"
|
|
|
@ -213,7 +214,8 @@ ChoicePage::setupChoices()
|
|
|
|
iconSize ) );
|
|
|
|
iconSize ) );
|
|
|
|
grp->addButton( m_eraseButton->buttonWidget() );
|
|
|
|
grp->addButton( m_eraseButton->buttonWidget() );
|
|
|
|
|
|
|
|
|
|
|
|
m_replaceButton = new PrettyRadioButton;
|
|
|
|
m_replaceButton = createReplaceButton();
|
|
|
|
|
|
|
|
|
|
|
|
m_replaceButton->setIconSize( iconSize );
|
|
|
|
m_replaceButton->setIconSize( iconSize );
|
|
|
|
m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs,
|
|
|
|
m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs,
|
|
|
|
CalamaresUtils::Original,
|
|
|
|
CalamaresUtils::Original,
|
|
|
@ -307,31 +309,17 @@ ChoicePage::setupChoices()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExpandableRadioButton*
|
|
|
|
QComboBox*
|
|
|
|
ChoicePage::createEraseButton()
|
|
|
|
ChoicePage::createBootloaderComboBox( ExpandableRadioButton* parentButton )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ExpandableRadioButton* eraseButton = new ExpandableRadioButton;
|
|
|
|
QComboBox* bcb = new QComboBox;
|
|
|
|
if ( !m_isEfi )
|
|
|
|
bcb->setModel( m_core->bootLoaderModel() );
|
|
|
|
{
|
|
|
|
|
|
|
|
QWidget* eraseWidget = new QWidget;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* eraseLayout = new QHBoxLayout;
|
|
|
|
|
|
|
|
eraseWidget->setLayout( eraseLayout );
|
|
|
|
|
|
|
|
eraseLayout->setContentsMargins( 0, 0, 0, 0 );
|
|
|
|
|
|
|
|
QLabel* eraseBootloaderLabel = new QLabel( eraseWidget );
|
|
|
|
|
|
|
|
eraseLayout->addWidget( eraseBootloaderLabel );
|
|
|
|
|
|
|
|
eraseBootloaderLabel->setText( tr( "Boot loader location:" ) );
|
|
|
|
|
|
|
|
QComboBox* eraseBootloaderCombo = new QComboBox;
|
|
|
|
|
|
|
|
eraseLayout->addWidget( eraseBootloaderCombo );
|
|
|
|
|
|
|
|
eraseBootloaderLabel->setBuddy( eraseBootloaderCombo );
|
|
|
|
|
|
|
|
eraseBootloaderCombo->setModel( m_core->bootLoaderModel() );
|
|
|
|
|
|
|
|
eraseLayout->addStretch();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// When the chosen bootloader device changes, we update the choice in the PCM
|
|
|
|
// When the chosen bootloader device changes, we update the choice in the PCM
|
|
|
|
connect( eraseBootloaderCombo, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
|
|
|
|
connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
|
|
|
|
[=]( int newIndex )
|
|
|
|
[=]( int newIndex )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QVariant var = eraseBootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole );
|
|
|
|
QVariant var = bcb->itemData( newIndex, BootLoaderModel::BootLoaderPathRole );
|
|
|
|
if ( !var.isValid() )
|
|
|
|
if ( !var.isValid() )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
m_core->setBootLoaderInstallPath( var.toString() );
|
|
|
|
m_core->setBootLoaderInstallPath( var.toString() );
|
|
|
@ -339,26 +327,26 @@ ChoicePage::createEraseButton()
|
|
|
|
|
|
|
|
|
|
|
|
// If the user picks a new device, we update the bootloader choice to that
|
|
|
|
// If the user picks a new device, we update the bootloader choice to that
|
|
|
|
// same device automatically.
|
|
|
|
// same device automatically.
|
|
|
|
auto updateBootloaderDevice = [eraseBootloaderCombo]( Device* currd )
|
|
|
|
auto updateBootloaderDevice = [bcb]( Device* currd )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( !currd )
|
|
|
|
if ( !currd )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
QString devPath = currd->deviceNode();
|
|
|
|
QString devPath = currd->deviceNode();
|
|
|
|
for ( int i = 0; i < eraseBootloaderCombo->count(); ++i )
|
|
|
|
for ( int i = 0; i < bcb->count(); ++i )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QVariant var = eraseBootloaderCombo->itemData( i , BootLoaderModel::BootLoaderPathRole );
|
|
|
|
QVariant var = bcb->itemData( i , BootLoaderModel::BootLoaderPathRole );
|
|
|
|
if ( !var.isValid() )
|
|
|
|
if ( !var.isValid() )
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
if ( var.toString() == devPath )
|
|
|
|
if ( var.toString() == devPath )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
eraseBootloaderCombo->setCurrentIndex( i );
|
|
|
|
bcb->setCurrentIndex( i );
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
connect( this, &ChoicePage::deviceChosen,
|
|
|
|
connect( this, &ChoicePage::deviceChosen,
|
|
|
|
this, updateBootloaderDevice );
|
|
|
|
this, updateBootloaderDevice );
|
|
|
|
connect( eraseButton, &ExpandableRadioButton::expanded,
|
|
|
|
connect( parentButton, &ExpandableRadioButton::expanded,
|
|
|
|
this, [=]( bool expanded )
|
|
|
|
this, [=]( bool expanded )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( expanded )
|
|
|
|
if ( expanded )
|
|
|
@ -366,12 +354,69 @@ ChoicePage::createEraseButton()
|
|
|
|
}, Qt::QueuedConnection );
|
|
|
|
}, Qt::QueuedConnection );
|
|
|
|
// ^ Must be Queued so it's sure to run when the widget is already visible.
|
|
|
|
// ^ Must be Queued so it's sure to run when the widget is already visible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return bcb;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExpandableRadioButton*
|
|
|
|
|
|
|
|
ChoicePage::createEraseButton()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ExpandableRadioButton* eraseButton = new ExpandableRadioButton;
|
|
|
|
|
|
|
|
if ( !m_isEfi )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QWidget* eraseWidget = new QWidget;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* eraseLayout = new QHBoxLayout;
|
|
|
|
|
|
|
|
eraseWidget->setLayout( eraseLayout );
|
|
|
|
|
|
|
|
eraseLayout->setContentsMargins( 0, 0, 0, 0 );
|
|
|
|
|
|
|
|
QLabel* eraseBootloaderLabel = new QLabel( eraseWidget );
|
|
|
|
|
|
|
|
eraseLayout->addWidget( eraseBootloaderLabel );
|
|
|
|
|
|
|
|
eraseBootloaderLabel->setText( tr( "Boot loader location:" ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QComboBox* eraseBootloaderCombo = createBootloaderComboBox( eraseButton );
|
|
|
|
|
|
|
|
eraseLayout->addWidget( eraseBootloaderCombo );
|
|
|
|
|
|
|
|
eraseBootloaderLabel->setBuddy( eraseBootloaderCombo );
|
|
|
|
|
|
|
|
eraseLayout->addStretch();
|
|
|
|
|
|
|
|
|
|
|
|
eraseButton->setExpandableWidget( eraseWidget );
|
|
|
|
eraseButton->setExpandableWidget( eraseWidget );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return eraseButton;
|
|
|
|
return eraseButton;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExpandableRadioButton*
|
|
|
|
|
|
|
|
ChoicePage::createReplaceButton()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ExpandableRadioButton* replaceButton = new ExpandableRadioButton;
|
|
|
|
|
|
|
|
QWidget* replaceContainer = new QWidget;
|
|
|
|
|
|
|
|
QVBoxLayout* mainReplaceLayout = new QVBoxLayout;
|
|
|
|
|
|
|
|
replaceContainer->setLayout( mainReplaceLayout );
|
|
|
|
|
|
|
|
CalamaresUtils::unmarginLayout( mainReplaceLayout );
|
|
|
|
|
|
|
|
ReplaceWidget* replaceWidget = new ReplaceWidget( m_core, drivesCombo );
|
|
|
|
|
|
|
|
mainReplaceLayout->addWidget( replaceWidget );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( !m_isEfi )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QHBoxLayout* bootloaderLayout = new QHBoxLayout;
|
|
|
|
|
|
|
|
bootloaderLayout->setContentsMargins( 0, 0, 0, 0 );
|
|
|
|
|
|
|
|
QLabel* eraseBootloaderLabel = new QLabel( replaceButton );
|
|
|
|
|
|
|
|
bootloaderLayout->addWidget( eraseBootloaderLabel );
|
|
|
|
|
|
|
|
eraseBootloaderLabel->setText( tr( "Boot loader location:" ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QComboBox* eraseBootloaderCombo = createBootloaderComboBox( replaceButton );
|
|
|
|
|
|
|
|
bootloaderLayout->addWidget( eraseBootloaderCombo );
|
|
|
|
|
|
|
|
eraseBootloaderLabel->setBuddy( eraseBootloaderCombo );
|
|
|
|
|
|
|
|
bootloaderLayout->addStretch();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mainReplaceLayout->addLayout( bootloaderLayout );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
replaceButton->setExpandableWidget( replaceContainer );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return replaceButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief ChoicePage::selectedDevice queries the device picker (which may be a combo or
|
|
|
|
* @brief ChoicePage::selectedDevice queries the device picker (which may be a combo or
|
|
|
|
* a list view) to get a pointer to the currently selected Device.
|
|
|
|
* a list view) to get a pointer to the currently selected Device.
|
|
|
|