Hook up EncryptWidget in ChoicePage, plus improve next status handling.
This commit is contained in:
parent
0dfe627d52
commit
0cc9560a99
@ -121,6 +121,7 @@ ChoicePage::ChoicePage( QWidget* parent )
|
||||
m_previewAfterFrame->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
|
||||
m_previewAfterLabel->hide();
|
||||
m_previewAfterFrame->hide();
|
||||
m_encryptWidget->hide();
|
||||
// end
|
||||
}
|
||||
|
||||
@ -157,6 +158,9 @@ ChoicePage::init( PartitionCoreModule* core )
|
||||
static_cast< void ( QComboBox::* )( int ) >( &QComboBox::currentIndexChanged ),
|
||||
this, &ChoicePage::applyDeviceChoice );
|
||||
|
||||
connect( m_encryptWidget, &EncryptWidget::stateChanged,
|
||||
this, &ChoicePage::updateNextEnabled );
|
||||
|
||||
ChoicePage::applyDeviceChoice();
|
||||
}
|
||||
|
||||
@ -238,14 +242,8 @@ ChoicePage::setupChoices()
|
||||
if ( checked ) // An action was picked.
|
||||
{
|
||||
m_choice = static_cast< Choice >( id );
|
||||
if ( m_choice == Replace )
|
||||
{
|
||||
setNextEnabled( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
setNextEnabled( true );
|
||||
}
|
||||
updateNextEnabled();
|
||||
|
||||
emit actionChosen();
|
||||
}
|
||||
else // An action was unpicked, either on its own or because of another selection.
|
||||
@ -253,7 +251,8 @@ ChoicePage::setupChoices()
|
||||
if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must
|
||||
{ // set m_choice to NoChoice and reset previews.
|
||||
m_choice = NoChoice;
|
||||
setNextEnabled( false );
|
||||
updateNextEnabled();
|
||||
|
||||
emit actionChosen();
|
||||
}
|
||||
}
|
||||
@ -392,7 +391,7 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||
[]{},
|
||||
this );
|
||||
}
|
||||
setNextEnabled( !m_beforePartitionBarsView->selectionModel()->selectedRows().isEmpty() );
|
||||
updateNextEnabled();
|
||||
|
||||
connect( m_beforePartitionBarsView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ),
|
||||
this, SLOT( doReplaceSelectedPartition( QModelIndex, QModelIndex ) ),
|
||||
@ -415,7 +414,7 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||
},
|
||||
this );
|
||||
}
|
||||
setNextEnabled( !m_beforePartitionBarsView->selectionModel()->selectedRows().isEmpty() );
|
||||
updateNextEnabled();
|
||||
|
||||
connect( m_beforePartitionBarsView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ),
|
||||
this, SLOT( doAlongsideSetupSplitter( QModelIndex, QModelIndex ) ),
|
||||
@ -466,7 +465,7 @@ ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current,
|
||||
Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::ProductName ) );
|
||||
|
||||
setNextEnabled( m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() );
|
||||
updateNextEnabled();
|
||||
|
||||
if ( m_isEfi )
|
||||
setupEfiSystemPartitionSelector();
|
||||
@ -628,7 +627,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current,
|
||||
if ( m_isEfi )
|
||||
setupEfiSystemPartitionSelector();
|
||||
|
||||
setNextEnabled( !m_beforePartitionBarsView->selectionModel()->selectedRows().isEmpty() );
|
||||
updateNextEnabled();
|
||||
if ( !m_bootloaderComboBox.isNull() &&
|
||||
m_bootloaderComboBox->currentIndex() < 0 )
|
||||
m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex );
|
||||
@ -770,10 +769,12 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
|
||||
};
|
||||
m_beforePartitionBarsView->setSelectionFilter( filter );
|
||||
m_beforePartitionLabelsView->setSelectionFilter( filter );
|
||||
m_encryptWidget->hide();
|
||||
|
||||
break;
|
||||
}
|
||||
case Erase:
|
||||
m_encryptWidget->show();
|
||||
case Replace:
|
||||
{
|
||||
m_previewBeforeLabel->setText( tr( "Current:" ) );
|
||||
@ -854,6 +855,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
|
||||
m_previewAfterFrame->hide();
|
||||
m_previewBeforeLabel->setText( tr( "Current:" ) );
|
||||
m_previewAfterLabel->hide();
|
||||
m_encryptWidget->hide();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -903,7 +905,7 @@ ChoicePage::setupEfiSystemPartitionSelector()
|
||||
"partitioning to set up %1." )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::ShortProductName ) ) );
|
||||
setNextEnabled( false );
|
||||
updateNextEnabled();
|
||||
}
|
||||
else if ( efiSystemPartitions.count() == 1 ) //probably most usual situation
|
||||
{
|
||||
@ -1193,8 +1195,42 @@ ChoicePage::currentChoice() const
|
||||
|
||||
|
||||
void
|
||||
ChoicePage::setNextEnabled( bool enabled )
|
||||
ChoicePage::updateNextEnabled()
|
||||
{
|
||||
bool enabled = false;
|
||||
|
||||
switch ( m_choice )
|
||||
{
|
||||
case NoChoice:
|
||||
enabled = false;
|
||||
break;
|
||||
case Replace:
|
||||
enabled = !m_beforePartitionBarsView->selectionModel()->
|
||||
selectedRows().isEmpty();
|
||||
break;
|
||||
case Alongside:
|
||||
enabled = !m_beforePartitionBarsView->selectionModel()->
|
||||
selectedRows().isEmpty() &&
|
||||
m_beforePartitionBarsView->selectionModel()->
|
||||
currentIndex().isValid();
|
||||
break;
|
||||
case Erase:
|
||||
case Manual:
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if ( m_isEfi &&
|
||||
( m_choice == Alongside ||
|
||||
m_choice == Replace ) )
|
||||
{
|
||||
if ( m_core->efiSystemPartitions().count() == 0 )
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
if ( m_encryptWidget->isVisible() &&
|
||||
m_encryptWidget->state() == EncryptWidget::EncryptionUnconfirmed )
|
||||
enabled = false;
|
||||
|
||||
if ( enabled == m_nextEnabled )
|
||||
return;
|
||||
|
||||
|
@ -76,7 +76,7 @@ private slots:
|
||||
void doAlongsideSetupSplitter( const QModelIndex& current, const QModelIndex& previous );
|
||||
|
||||
private:
|
||||
void setNextEnabled( bool enabled );
|
||||
void updateNextEnabled();
|
||||
void setupChoices();
|
||||
QComboBox* createBootloaderComboBox( QWidget* parentButton );
|
||||
Device* selectedDevice();
|
||||
|
@ -32,7 +32,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="m_rightLayout" stretch="0,1,0,0,0">
|
||||
<layout class="QVBoxLayout" name="m_rightLayout" stretch="0,1,0,0,0,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_messageLabel">
|
||||
<property name="toolTip">
|
||||
@ -63,7 +63,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>729</width>
|
||||
<height>327</height>
|
||||
<height>276</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="m_itemsLayout">
|
||||
@ -93,6 +93,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="EncryptWidget" name="m_encryptWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_selectLabel">
|
||||
<property name="text">
|
||||
@ -197,6 +200,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>EncryptWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/EncryptWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user