diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2021-03-17 11:54:43 +0100 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2021-05-08 10:44:03 +0200 |
| commit | 10684b6d82f1843eff3921da40802d335fb3cf5c (patch) | |
| tree | a80d403f0668686de90c2cd48786e7b5e5fc2128 /src/mainwindow.cpp | |
| parent | a2f36ec4d14ddf1bcee98e52a0f3a924804d06fb (diff) | |
| download | kristall-10684b6d82f1843eff3921da40802d335fb3cf5c.tar.gz | |
Further improves localization (#191). Allows switching and setting the chosen localization properly.
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4c7169b..d2eeaf8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,6 +33,12 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : ui->setupUi(this); + connect( // connect with "this" as context, so the connection will die when the window is destroyed + kristall::globals().localization.get(), &Localization::translationChanged, + this, [this]() { this->ui->retranslateUi(this); }, + Qt::DirectConnection + ); + this->url_status->setElideMode(Qt::ElideMiddle); this->statusBar()->addWidget(this->url_status); @@ -469,13 +475,17 @@ void MainWindow::on_actionSettings_triggered() dialog.setOptions(kristall::globals().options); dialog.setGeminiSslTrust(kristall::globals().trust.gemini); dialog.setHttpsSslTrust(kristall::globals().trust.https); + dialog.setLocale(kristall::globals().localization->locale); if(dialog.exec() != QDialog::Accepted) { kristall::setTheme(kristall::globals().options.theme); + kristall::globals().localization->setLocale(kristall::globals().localization->locale); this->setUiDensity(kristall::globals().options.ui_density, false); return; } + kristall::globals().localization->setLocale(dialog.locale()); + kristall::globals().trust.gemini = dialog.geminiSslTrust(); kristall::globals().trust.https = dialog.httpsSslTrust(); kristall::globals().options = dialog.options(); @@ -483,6 +493,7 @@ void MainWindow::on_actionSettings_triggered() kristall::globals().protocols = dialog.protocols(); kristall::globals().document_style = dialog.geminiStyle(); + kristall::saveLocale(); kristall::applySettings(); kristall::saveSettings(); |
