Make sure we show info of the first device in the device combo box
This commit is contained in:
parent
cb546d02f9
commit
d476f9cba8
@ -51,29 +51,12 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
updateBootLoaderInstallPath();
|
updateBootLoaderInstallPath();
|
||||||
|
|
||||||
|
updateFromCurrentDevice();
|
||||||
|
|
||||||
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged,
|
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged,
|
||||||
[ this ]( const QString& /* text */ )
|
[ this ]( const QString& /* text */ )
|
||||||
{
|
{
|
||||||
QModelIndex index = m_ui->deviceComboBox->view()->currentIndex();
|
updateFromCurrentDevice();
|
||||||
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
|
||||||
PartitionModel* model = m_core->partitionModelForDevice( device );
|
|
||||||
m_ui->partitionTreeView->setModel( model );
|
|
||||||
|
|
||||||
// Must be done here because we need to have a model set to define
|
|
||||||
// individual column resize mode
|
|
||||||
QHeaderView* header = m_ui->partitionTreeView->header();
|
|
||||||
header->setSectionResizeMode( QHeaderView::ResizeToContents );
|
|
||||||
header->setSectionResizeMode( 0, QHeaderView::Stretch );
|
|
||||||
|
|
||||||
updateButtons();
|
|
||||||
// Establish connection here because selection model is destroyed when
|
|
||||||
// model changes
|
|
||||||
connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
|
||||||
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
|
||||||
{
|
|
||||||
updateButtons();
|
|
||||||
} );
|
|
||||||
connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::updateButtons );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged,
|
connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged,
|
||||||
@ -221,3 +204,32 @@ PartitionPage::updateBootLoaderInstallPath()
|
|||||||
return;
|
return;
|
||||||
m_core->setBootLoaderInstallPath( var.toString() );
|
m_core->setBootLoaderInstallPath( var.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PartitionPage::updateFromCurrentDevice()
|
||||||
|
{
|
||||||
|
QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
|
||||||
|
if ( !index.isValid() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Device* device = m_core->deviceModel()->deviceForIndex( index );
|
||||||
|
|
||||||
|
PartitionModel* model = m_core->partitionModelForDevice( device );
|
||||||
|
m_ui->partitionTreeView->setModel( model );
|
||||||
|
|
||||||
|
// Must be done here because we need to have a model set to define
|
||||||
|
// individual column resize mode
|
||||||
|
QHeaderView* header = m_ui->partitionTreeView->header();
|
||||||
|
header->setSectionResizeMode( QHeaderView::ResizeToContents );
|
||||||
|
header->setSectionResizeMode( 0, QHeaderView::Stretch );
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
|
// Establish connection here because selection model is destroyed when
|
||||||
|
// model changes
|
||||||
|
connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
|
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
||||||
|
{
|
||||||
|
updateButtons();
|
||||||
|
} );
|
||||||
|
connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::updateButtons );
|
||||||
|
}
|
||||||
|
@ -52,6 +52,7 @@ private:
|
|||||||
void updatePartitionToCreate( Device*, Partition* );
|
void updatePartitionToCreate( Device*, Partition* );
|
||||||
void editExistingPartition( Device*, Partition* );
|
void editExistingPartition( Device*, Partition* );
|
||||||
void updateBootLoaderInstallPath();
|
void updateBootLoaderInstallPath();
|
||||||
|
void updateFromCurrentDevice();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PARTITIONPAGE_H
|
#endif // PARTITIONPAGE_H
|
||||||
|
Loading…
Reference in New Issue
Block a user