[partition] Reduce lambda-happiness
- Make some methods that are called mostly as slots, actual slots, instead of going through extra lambdas. - Use QOverload<>::of for disambiguation instead of homebrew casts.
This commit is contained in:
parent
7cfaba2d53
commit
92d9c9491a
@ -90,22 +90,9 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
|
||||
updateFromCurrentDevice();
|
||||
|
||||
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged,
|
||||
[ this ]( const QString& /* text */ )
|
||||
{
|
||||
updateFromCurrentDevice();
|
||||
} );
|
||||
connect( m_ui->bootLoaderComboBox, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||
[ this ]( const QString& /* text */ )
|
||||
{
|
||||
m_lastSelectedBootLoaderIndex = m_ui->bootLoaderComboBox->currentIndex();
|
||||
} );
|
||||
|
||||
connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged,
|
||||
[ this ]( const QString& /* text */ )
|
||||
{
|
||||
updateBootLoaderInstallPath();
|
||||
} );
|
||||
connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged, this, &PartitionPage::updateFromCurrentDevice );
|
||||
connect( m_ui->bootLoaderComboBox, QOverload<int>::of(&QComboBox::activated), this, &PartitionPage::updateSelectedBootLoaderIndex );
|
||||
connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged, this, &PartitionPage::updateBootLoaderInstallPath );
|
||||
|
||||
connect( m_core, &PartitionCoreModule::isDirtyChanged, m_ui->revertButton, &QWidget::setEnabled );
|
||||
|
||||
@ -512,6 +499,12 @@ PartitionPage::updateBootLoaderInstallPath()
|
||||
m_core->setBootLoaderInstallPath( var.toString() );
|
||||
}
|
||||
|
||||
void
|
||||
PartitionPage::updateSelectedBootLoaderIndex()
|
||||
{
|
||||
m_lastSelectedBootLoaderIndex = m_ui->bootLoaderComboBox->currentIndex();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionPage::updateFromCurrentDevice()
|
||||
{
|
||||
|
@ -50,6 +50,14 @@ public:
|
||||
int selectedDeviceIndex();
|
||||
void selectDeviceByIndex( int index );
|
||||
|
||||
private slots:
|
||||
/// @brief Update everything when the base device changes
|
||||
void updateFromCurrentDevice();
|
||||
/// @brief Update when the selected device for boot loader changes
|
||||
void updateBootLoaderInstallPath();
|
||||
/// @brief Explicitly selected boot loader path
|
||||
void updateSelectedBootLoaderIndex();
|
||||
|
||||
private:
|
||||
QScopedPointer< Ui_PartitionPage > m_ui;
|
||||
PartitionCoreModule* m_core;
|
||||
@ -67,8 +75,6 @@ private:
|
||||
|
||||
void updatePartitionToCreate( Device*, Partition* );
|
||||
void editExistingPartition( Device*, Partition* );
|
||||
void updateBootLoaderInstallPath();
|
||||
void updateFromCurrentDevice();
|
||||
void updateBootLoaderIndex();
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user