commit
8e5f9bf0fc
6
CHANGES
6
CHANGES
@ -31,8 +31,10 @@ This release contains contributions from (alphabetically by first name):
|
|||||||
display-managers.
|
display-managers.
|
||||||
* *Partition* module: it is now possible to build without libparted. Since
|
* *Partition* module: it is now possible to build without libparted. Since
|
||||||
KPMCore may not need this library anymore, it is a dependency that will
|
KPMCore may not need this library anymore, it is a dependency that will
|
||||||
be dropped as soon as it is feasible. Add `-DCMAKE_DISABLE_FIND_PACKAGE_LIBPARTED=ON`
|
be dropped as soon as it is feasible. Add this to the CMake flags:
|
||||||
to the CMake flags to do so.
|
`-DCMAKE_DISABLE_FIND_PACKAGE_LIBPARTED=ON`
|
||||||
|
* *Partition* module: the location that is selected for the bootloader,
|
||||||
|
no longer changes when a new partition is created. #1098
|
||||||
* Python modules: several modules have had translations added. This is
|
* Python modules: several modules have had translations added. This is
|
||||||
usually only visible when the module runs as part of the *exec* step,
|
usually only visible when the module runs as part of the *exec* step,
|
||||||
when the module's *pretty name* is displayed. In addition, some error
|
when the module's *pretty name* is displayed. In addition, some error
|
||||||
|
@ -67,6 +67,8 @@ BootLoaderModel::createMbrItems()
|
|||||||
void
|
void
|
||||||
BootLoaderModel::update()
|
BootLoaderModel::update()
|
||||||
{
|
{
|
||||||
|
beginResetModel();
|
||||||
|
blockSignals( true );
|
||||||
clear();
|
clear();
|
||||||
createMbrItems();
|
createMbrItems();
|
||||||
|
|
||||||
@ -111,6 +113,8 @@ BootLoaderModel::update()
|
|||||||
createBootLoaderItem( tr( "Do not install a boot loader" ), QString(), false )
|
createBootLoaderItem( tr( "Do not install a boot loader" ), QString(), false )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
blockSignals( false );
|
||||||
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,12 +123,12 @@ BootLoaderModel::data( const QModelIndex& index, int role ) const
|
|||||||
{
|
{
|
||||||
if ( role == Qt::DisplayRole )
|
if ( role == Qt::DisplayRole )
|
||||||
{
|
{
|
||||||
if ( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString().isEmpty() )
|
QString displayRole = QStandardItemModel::data( index, Qt::DisplayRole ).toString();
|
||||||
return QStandardItemModel::data( index, Qt::DisplayRole ).toString();
|
QString pathRole = QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString();
|
||||||
|
if ( pathRole.isEmpty() )
|
||||||
|
return displayRole;
|
||||||
|
|
||||||
return tr( "%1 (%2)" )
|
return tr( "%1 (%2)" ).arg( displayRole, pathRole );
|
||||||
.arg( QStandardItemModel::data( index, Qt::DisplayRole ).toString() )
|
|
||||||
.arg( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString() );
|
|
||||||
}
|
}
|
||||||
return QStandardItemModel::data( index, role );
|
return QStandardItemModel::data( index, role );
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
|||||||
value( "alwaysShowPartitionLabels" ).toBool() );
|
value( "alwaysShowPartitionLabels" ).toBool() );
|
||||||
m_ui->deviceComboBox->setModel( m_core->deviceModel() );
|
m_ui->deviceComboBox->setModel( m_core->deviceModel() );
|
||||||
m_ui->bootLoaderComboBox->setModel( m_core->bootLoaderModel() );
|
m_ui->bootLoaderComboBox->setModel( m_core->bootLoaderModel() );
|
||||||
|
connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, this, &PartitionPage::restoreSelectedBootLoader );
|
||||||
PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()->
|
PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()->
|
||||||
value( "drawNestedPartitions" ).toBool() ?
|
value( "drawNestedPartitions" ).toBool() ?
|
||||||
PartitionBarsView::DrawNestedPartitions :
|
PartitionBarsView::DrawNestedPartitions :
|
||||||
@ -505,6 +506,47 @@ PartitionPage::updateSelectedBootLoaderIndex()
|
|||||||
cDebug() << "Selected bootloader index" << m_lastSelectedBootLoaderIndex;
|
cDebug() << "Selected bootloader index" << m_lastSelectedBootLoaderIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
findBootloader( const QAbstractItemModel* model, const QString& path )
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < model->rowCount(); ++i)
|
||||||
|
{
|
||||||
|
const auto index = model->index( i, 0, QModelIndex() );
|
||||||
|
cDebug() << i << model->itemData( index );
|
||||||
|
QVariant var = model->data( index, BootLoaderModel::BootLoaderPathRole );
|
||||||
|
if ( var.isValid() && var.toString() == path )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PartitionPage::restoreSelectedBootLoader()
|
||||||
|
{
|
||||||
|
const auto* model = m_ui->bootLoaderComboBox->model();
|
||||||
|
if ( model->rowCount() < 1 )
|
||||||
|
{
|
||||||
|
cDebug() << "No items in BootLoaderModel";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int r = -1;
|
||||||
|
if ( m_core->bootLoaderInstallPath().isEmpty() )
|
||||||
|
{
|
||||||
|
m_ui->bootLoaderComboBox->setCurrentIndex( 0 );
|
||||||
|
}
|
||||||
|
else if ( (r = findBootloader( model, m_core->bootLoaderInstallPath() )) >= 0 )
|
||||||
|
{
|
||||||
|
m_ui->bootLoaderComboBox->setCurrentIndex( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ui->bootLoaderComboBox->setCurrentIndex( 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PartitionPage::updateFromCurrentDevice()
|
PartitionPage::updateFromCurrentDevice()
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,8 @@ private slots:
|
|||||||
void updateBootLoaderInstallPath();
|
void updateBootLoaderInstallPath();
|
||||||
/// @brief Explicitly selected boot loader path
|
/// @brief Explicitly selected boot loader path
|
||||||
void updateSelectedBootLoaderIndex();
|
void updateSelectedBootLoaderIndex();
|
||||||
|
/// @brief After boot loader model changes, try to preserve previously set value
|
||||||
|
void restoreSelectedBootLoader();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer< Ui_PartitionPage > m_ui;
|
QScopedPointer< Ui_PartitionPage > m_ui;
|
||||||
|
Loading…
Reference in New Issue
Block a user