mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 10:55:37 -04:00
[keyboard] Move responsibility for retranslation to Config
- only widgets get language change events, so we need to hook that up to the ViewSteps and inform the Config object so that it can (re)load translations for the keyboard data.
This commit is contained in:
parent
89a180ee58
commit
4387b8061e
5 changed files with 26 additions and 5 deletions
|
@ -560,3 +560,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
m_writeEtcDefaultKeyboard = true;
|
m_writeEtcDefaultKeyboard = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Config::retranslate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,17 @@ public:
|
||||||
*/
|
*/
|
||||||
KeyboardVariantsModel* keyboardVariants() const;
|
KeyboardVariantsModel* keyboardVariants() const;
|
||||||
|
|
||||||
|
/** @brief Call this to change application language
|
||||||
|
*
|
||||||
|
* The models (for keyboard model, layouts and variants) provide
|
||||||
|
* translations of strings in the xkb table, so need to be
|
||||||
|
* notified of language changes as well.
|
||||||
|
*
|
||||||
|
* Only widgets get LanguageChange events, so one of them will
|
||||||
|
* need to call this.
|
||||||
|
*/
|
||||||
|
void retranslate();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void prettyStatusChanged();
|
void prettyStatusChanged();
|
||||||
|
|
||||||
|
|
|
@ -123,10 +123,6 @@ KeyboardModelsModel::KeyboardModelsModel( QObject* parent )
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebug() << "Loaded" << m_list.count() << "keyboard models";
|
cDebug() << "Loaded" << m_list.count() << "keyboard models";
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE( if ( !s_kbtranslator ) { s_kbtranslator = new QTranslator; } cqDeleter<QTranslator> d { s_kbtranslator };
|
|
||||||
d.preserve
|
|
||||||
= CalamaresUtils::loadTranslator( QLocale(), QStringLiteral( "kb_" ), s_kbtranslator ); )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,10 +95,17 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
|
||||||
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) {
|
connect( config->keyboardVariants(), &KeyboardVariantsModel::currentIndexChanged, [this]( int index ) {
|
||||||
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
||||||
} );
|
} );
|
||||||
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
|
CALAMARES_RETRANSLATE_SLOT( &KeyboardPage::retranslate )
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardPage::~KeyboardPage()
|
KeyboardPage::~KeyboardPage()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
KeyboardPage::retranslate()
|
||||||
|
{
|
||||||
|
ui->retranslateUi( this );
|
||||||
|
m_config->retranslate();
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
explicit KeyboardPage( Config* config, QWidget* parent = nullptr );
|
explicit KeyboardPage( Config* config, QWidget* parent = nullptr );
|
||||||
~KeyboardPage() override;
|
~KeyboardPage() override;
|
||||||
|
|
||||||
|
void retranslate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Page_Keyboard* ui;
|
Ui::Page_Keyboard* ui;
|
||||||
KeyBoardPreview* m_keyboardPreview;
|
KeyBoardPreview* m_keyboardPreview;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue