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