mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 19:05:36 -04:00
[keyboard] Tear up connections between widgets and model
This commit is contained in:
parent
193efe1710
commit
87aafb2442
2 changed files with 8 additions and 15 deletions
|
@ -156,22 +156,25 @@ Config::Config( QObject* parent )
|
||||||
|
|
||||||
// Connect signals and slots
|
// Connect signals and slots
|
||||||
connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, [&]( int index ) {
|
connect( m_keyboardModelsModel, &KeyboardModelsModel::currentIndexChanged, [&]( int index ) {
|
||||||
|
// Set Xorg keyboard model
|
||||||
m_selectedModel = m_keyboardModelsModel->modelKey( index );
|
m_selectedModel = m_keyboardModelsModel->modelKey( index );
|
||||||
// Set Xorg keyboard model
|
cDebug() << "Setting model" << index << m_selectedModel;
|
||||||
QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) );
|
QProcess::execute( "setxkbmap", xkbmap_model_args( m_selectedModel ) );
|
||||||
emit prettyStatusChanged();
|
emit prettyStatusChanged();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, [&]( int index ) {
|
connect( m_keyboardLayoutsModel, &KeyboardLayoutModel::currentIndexChanged, [&]( int index ) {
|
||||||
m_selectedLayout = m_keyboardLayoutsModel->item( index ).first;
|
m_selectedLayout = m_keyboardLayoutsModel->item( index ).first;
|
||||||
|
cDebug() << "Setting layout" << index << m_selectedLayout;
|
||||||
updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) );
|
updateVariants( QPersistentModelIndex( m_keyboardLayoutsModel->index( index ) ) );
|
||||||
emit prettyStatusChanged();
|
emit prettyStatusChanged();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, [&]( int index ) {
|
connect( m_keyboardVariantsModel, &KeyboardVariantsModel::currentIndexChanged, [&]( int index ) {
|
||||||
|
// Set Xorg keyboard layout + variant
|
||||||
m_selectedVariant = m_keyboardVariantsModel->item( index )[ "key" ];
|
m_selectedVariant = m_keyboardVariantsModel->item( index )[ "key" ];
|
||||||
|
cDebug() << "Setting variant" << index << m_selectedVariant;
|
||||||
|
|
||||||
// Set Xorg keyboard layout
|
|
||||||
if ( m_setxkbmapTimer.isActive() )
|
if ( m_setxkbmapTimer.isActive() )
|
||||||
{
|
{
|
||||||
m_setxkbmapTimer.stop();
|
m_setxkbmapTimer.stop();
|
||||||
|
|
|
@ -52,22 +52,12 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
|
||||||
ui->KBPreviewLayout->addWidget( m_keyboardPreview );
|
ui->KBPreviewLayout->addWidget( m_keyboardPreview );
|
||||||
|
|
||||||
ui->physicalModelSelector->setModel( config->keyboardModels() );
|
ui->physicalModelSelector->setModel( config->keyboardModels() );
|
||||||
// Connect signals and slots
|
ui->layoutSelector->setModel( config->keyboardLayouts() );
|
||||||
connect(
|
|
||||||
ui->variantSelector, &QListWidget::currentItemChanged, this, &KeyboardPage::onListVariantCurrentItemChanged );
|
|
||||||
|
|
||||||
connect( ui->buttonRestore, &QPushButton::clicked, [this] {
|
connect( ui->buttonRestore, &QPushButton::clicked, [config=config] {
|
||||||
cDebug() << "Restore clicked";
|
config->keyboardModels()->setCurrentIndex();
|
||||||
// ui->physicalModelSelector->setCurrentIndex( m_defaultIndex );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
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 ); )
|
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue