Improve setting ESP.

This commit is contained in:
Teo Mrnjavac 2016-02-19 16:57:49 +01:00
parent e27b9fc295
commit e91d213872
2 changed files with 50 additions and 59 deletions

View File

@ -462,16 +462,8 @@ ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current,
setNextEnabled( m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() ); setNextEnabled( m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() );
QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions(); if ( m_isEfi )
if ( m_isEfi && m_efiLabel && efiSystemPartitions.count() <= 1 ) //should never happen setupEfiSystemPartitionSelector();
{
m_efiLabel->show();
}
else if ( m_isEfi && m_efiLabel && efiSystemPartitions.count() > 1 )
{
m_efiLabel->show();
m_efiComboBox->show();
}
cDebug() << "Partition selected for Alongside."; cDebug() << "Partition selected for Alongside.";
} }
@ -592,16 +584,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current,
} ), } ),
[=] [=]
{ {
QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions(); if ( m_isEfi )
if ( m_isEfi && m_efiLabel && efiSystemPartitions.count() <= 1 ) //should never happen setupEfiSystemPartitionSelector();
{
m_efiLabel->show();
}
else if ( m_isEfi && m_efiLabel && efiSystemPartitions.count() > 1 )
{
m_efiLabel->show();
m_efiComboBox->show();
}
setNextEnabled( !m_beforePartitionBarsView->selectionModel()->selectedRows().isEmpty() ); setNextEnabled( !m_beforePartitionBarsView->selectionModel()->selectedRows().isEmpty() );
if ( !m_bootloaderComboBox.isNull() && if ( !m_bootloaderComboBox.isNull() &&
@ -841,9 +825,31 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
m_efiComboBox = new QComboBox( m_previewAfterFrame ); m_efiComboBox = new QComboBox( m_previewAfterFrame );
efiLayout->addWidget( m_efiComboBox ); efiLayout->addWidget( m_efiComboBox );
m_efiLabel->setBuddy( m_efiComboBox ); m_efiLabel->setBuddy( m_efiComboBox );
m_efiLabel->hide();
m_efiComboBox->hide(); m_efiComboBox->hide();
efiLayout->addStretch(); efiLayout->addStretch();
}
// Also handle selection behavior on beforeFrame.
QAbstractItemView::SelectionMode previewSelectionMode;
switch ( m_choice )
{
case Replace:
case Alongside:
previewSelectionMode = QAbstractItemView::SingleSelection;
break;
default:
previewSelectionMode = QAbstractItemView::NoSelection;
}
m_beforePartitionBarsView->setSelectionMode( previewSelectionMode );
m_beforePartitionLabelsView->setSelectionMode( previewSelectionMode );
}
void
ChoicePage::setupEfiSystemPartitionSelector()
{
Q_ASSERT( m_isEfi );
// Only the already existing ones: // Only the already existing ones:
QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions(); QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions();
@ -884,22 +890,6 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
} }
} }
// Also handle selection behavior on beforeFrame.
QAbstractItemView::SelectionMode previewSelectionMode;
switch ( m_choice )
{
case Replace:
case Alongside:
previewSelectionMode = QAbstractItemView::SingleSelection;
break;
default:
previewSelectionMode = QAbstractItemView::NoSelection;
}
m_beforePartitionBarsView->setSelectionMode( previewSelectionMode );
m_beforePartitionLabelsView->setSelectionMode( previewSelectionMode );
}
QComboBox* QComboBox*
ChoicePage::createBootloaderComboBox( QWidget* parent ) ChoicePage::createBootloaderComboBox( QWidget* parent )

View File

@ -88,6 +88,7 @@ private:
void setupActions(); void setupActions();
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const; OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
void doAlongsideApply(); void doAlongsideApply();
void setupEfiSystemPartitionSelector();
bool m_nextEnabled; bool m_nextEnabled;
PartitionCoreModule* m_core; PartitionCoreModule* m_core;