[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
@ -560,3 +560,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
m_writeEtcDefaultKeyboard = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Config::retranslate()
|
||||
{
|
||||
}
|
||||
|
@ -58,6 +58,17 @@ public:
|
||||
*/
|
||||
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:
|
||||
void prettyStatusChanged();
|
||||
|
||||
|
@ -123,10 +123,6 @@ KeyboardModelsModel::KeyboardModelsModel( QObject* parent )
|
||||
}
|
||||
|
||||
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 ) {
|
||||
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
|
||||
} );
|
||||
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
|
||||
CALAMARES_RETRANSLATE_SLOT( &KeyboardPage::retranslate )
|
||||
}
|
||||
|
||||
KeyboardPage::~KeyboardPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void
|
||||
KeyboardPage::retranslate()
|
||||
{
|
||||
ui->retranslateUi( this );
|
||||
m_config->retranslate();
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
explicit KeyboardPage( Config* config, QWidget* parent = nullptr );
|
||||
~KeyboardPage() override;
|
||||
|
||||
void retranslate();
|
||||
|
||||
private:
|
||||
Ui::Page_Keyboard* ui;
|
||||
KeyBoardPreview* m_keyboardPreview;
|
||||
|
Loading…
Reference in New Issue
Block a user