[keyboard] Tear up connections between widgets and model
This commit is contained in:
parent
193efe1710
commit
87aafb2442
@ -156,22 +156,25 @@ Config::Config( QObject* parent )
|
||||
|
||||
// Connect signals and slots
|
||||
connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, [&]( int index ) {
|
||||
// Set Xorg keyboard model
|
||||
m_selectedModel = m_keyboardModelsModel->modelKey( index );
|
||||
// Set Xorg keyboard model
|
||||
cDebug() << "Setting model" << index << m_selectedModel;
|
||||
QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) );
|
||||
emit prettyStatusChanged();
|
||||
} );
|
||||
|
||||
connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, [&]( int index ) {
|
||||
m_selectedLayout = m_keyboardLayoutsModel->item( index ).first;
|
||||
cDebug() << "Setting layout" << index << m_selectedLayout;
|
||||
updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) );
|
||||
emit prettyStatusChanged();
|
||||
} );
|
||||
|
||||
connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, [&]( int index ) {
|
||||
// Set Xorg keyboard layout + variant
|
||||
m_selectedVariant = m_keyboardVariantsModel->item( index )[ "key" ];
|
||||
cDebug() << "Setting variant" << index << m_selectedVariant;
|
||||
|
||||
// Set Xorg keyboard layout
|
||||
if ( m_setxkbmapTimer.isActive() )
|
||||
{
|
||||
m_setxkbmapTimer.stop();
|
||||
|
@ -52,22 +52,12 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
|
||||
ui->KBPreviewLayout->addWidget( m_keyboardPreview );
|
||||
|
||||
ui->physicalModelSelector->setModel( config->keyboardModels() );
|
||||
// Connect signals and slots
|
||||
connect(
|
||||
ui->variantSelector, &QListWidget::currentItemChanged, this, &KeyboardPage::onListVariantCurrentItemChanged );
|
||||
ui->layoutSelector->setModel( config->keyboardLayouts() );
|
||||
|
||||
connect( ui->buttonRestore, &QPushButton::clicked, [this] {
|
||||
cDebug() << "Restore clicked";
|
||||
// ui->physicalModelSelector->setCurrentIndex( m_defaultIndex );
|
||||
connect( ui->buttonRestore, &QPushButton::clicked, [config=config] {
|
||||
config->keyboardModels()->setCurrentIndex();
|
||||
} );
|
||||
|
||||
connect( ui->physicalModelSelector, &QComboBox::currentTextChanged, [this]( const QString& text ) {
|
||||
cDebug() << "ComboBox changed to" << text;
|
||||
// QString model = m_models.value( text, "pc105" );
|
||||
|
||||
// Set Xorg keyboard model
|
||||
// QProcess::execute( "setxkbmap", QStringList { "-model", model } );
|
||||
} );
|
||||
|
||||
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user