[keyboard] Simplify back down to lambdas
- With debugging and untangling done, the lambdas are simple and short, so return to using them. One point of improvement might be to give the models suitable slots themselves, to avoid even this indirection.
This commit is contained in:
parent
0bf28b0b94
commit
2e5301c5c9
@ -84,47 +84,18 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
|
|||||||
|
|
||||||
connect( ui->layoutSelector->selectionModel(),
|
connect( ui->layoutSelector->selectionModel(),
|
||||||
&QItemSelectionModel::currentChanged,
|
&QItemSelectionModel::currentChanged,
|
||||||
this,
|
[this]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
|
||||||
&KeyboardPage::layoutChangedByUser );
|
connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [this]( int index ) {
|
||||||
connect( config->keyboardLayouts(),
|
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
|
||||||
&KeyboardLayoutModel::currentIndexChanged,
|
} );
|
||||||
this,
|
|
||||||
&KeyboardPage::layoutChangedByConfig );
|
|
||||||
|
|
||||||
connect( ui->variantSelector->selectionModel(),
|
connect( ui->variantSelector->selectionModel(),
|
||||||
&QItemSelectionModel::currentChanged,
|
&QItemSelectionModel::currentChanged,
|
||||||
this,
|
[this]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
|
||||||
&KeyboardPage::variantChangedByUser );
|
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) {
|
||||||
connect( config->keyboardVariants(),
|
|
||||||
&KeyboardVariantsModel::currentIndexChanged,
|
|
||||||
this,
|
|
||||||
&KeyboardPage::variantChangedByConfig );
|
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KeyboardPage::layoutChangedByUser( const QModelIndex& current, const QModelIndex& previous )
|
|
||||||
{
|
|
||||||
m_config->keyboardLayouts()->setCurrentIndex( current.row() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KeyboardPage::layoutChangedByConfig( int index )
|
|
||||||
{
|
|
||||||
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KeyboardPage::variantChangedByUser( const QModelIndex& current, const QModelIndex& previous )
|
|
||||||
{
|
|
||||||
m_config->keyboardVariants()->setCurrentIndex( current.row() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KeyboardPage::variantChangedByConfig( int index )
|
|
||||||
{
|
|
||||||
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
||||||
|
} );
|
||||||
|
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardPage::~KeyboardPage()
|
KeyboardPage::~KeyboardPage()
|
||||||
|
@ -37,13 +37,6 @@ public:
|
|||||||
explicit KeyboardPage( Config* config, QWidget* parent = nullptr );
|
explicit KeyboardPage( Config* config, QWidget* parent = nullptr );
|
||||||
~KeyboardPage() override;
|
~KeyboardPage() override;
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void layoutChangedByUser( const QModelIndex& current, const QModelIndex& previous );
|
|
||||||
void layoutChangedByConfig( int index );
|
|
||||||
|
|
||||||
void variantChangedByUser( const QModelIndex& current, const QModelIndex& previous );
|
|
||||||
void variantChangedByConfig( int index );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Page_Keyboard* ui;
|
Ui::Page_Keyboard* ui;
|
||||||
KeyBoardPreview* m_keyboardPreview;
|
KeyBoardPreview* m_keyboardPreview;
|
||||||
|
Loading…
Reference in New Issue
Block a user