[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.
main
Adriaan de Groot 5 years ago
parent 0bf28b0b94
commit 2e5301c5c9

@ -84,49 +84,20 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
connect( ui->layoutSelector->selectionModel(),
&QItemSelectionModel::currentChanged,
this,
&KeyboardPage::layoutChangedByUser );
connect( config->keyboardLayouts(),
&KeyboardLayoutModel::currentIndexChanged,
this,
&KeyboardPage::layoutChangedByConfig );
[this]( const QModelIndex& current ) { m_config->keyboardLayouts()->setCurrentIndex( current.row() ); } );
connect( config->keyboardLayouts(), &KeyboardLayoutModel::currentIndexChanged, [this]( int index ) {
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
} );
connect( ui->variantSelector->selectionModel(),
&QItemSelectionModel::currentChanged,
this,
&KeyboardPage::variantChangedByUser );
connect( config->keyboardVariants(),
&KeyboardVariantsModel::currentIndexChanged,
this,
&KeyboardPage::variantChangedByConfig );
[this]( const QModelIndex& current ) { m_config->keyboardVariants()->setCurrentIndex( current.row() ); } );
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) {
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
} );
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 ) );
}
KeyboardPage::~KeyboardPage()
{
delete ui;

@ -37,13 +37,6 @@ public:
explicit KeyboardPage( Config* config, QWidget* parent = nullptr );
~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:
Ui::Page_Keyboard* ui;
KeyBoardPreview* m_keyboardPreview;

Loading…
Cancel
Save