From 7cb57c1c72bd4dfd56367a7f1130de0dbd5415d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 18 Nov 2016 18:43:35 +0100 Subject: gui: allow for disabling translation --- gui/images/english.png | Bin 0 -> 283 bytes gui/main.cpp | 7 +++-- gui/opentrack-res.qrc | 1 + gui/options-dialog.cpp | 8 ++++++ gui/options-dialog.hpp | 1 + gui/options-dialog.ui | 70 +++++++++++++++++++++++++++++++++++++++++++++---- 6 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 gui/images/english.png (limited to 'gui') diff --git a/gui/images/english.png b/gui/images/english.png new file mode 100644 index 00000000..187aabf9 Binary files /dev/null and b/gui/images/english.png differ diff --git a/gui/main.cpp b/gui/main.cpp index de904f94..8bc09537 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -143,8 +143,11 @@ main(int argc, char** argv) // QLocale::setDefault(QLocale("pl_PL")); // force i18n for testing - (void) t.load(QLocale(), "", "", QCoreApplication::applicationDirPath() + "/i18n", ".qm"); - (void) QCoreApplication::installTranslator(&t); + if (!QSettings(OPENTRACK_ORG).value("disable-translation", false).toBool()) + { + (void) t.load(QLocale(), "", "", QCoreApplication::applicationDirPath() + "/i18n", ".qm"); + (void) QCoreApplication::installTranslator(&t); + } do { diff --git a/gui/opentrack-res.qrc b/gui/opentrack-res.qrc index 7b7fee54..1a3728cd 100644 --- a/gui/opentrack-res.qrc +++ b/gui/opentrack-res.qrc @@ -7,5 +7,6 @@ images/no-feed.png images/filter-16.png images/tracking-not-started.png + images/english.png diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index 8f248dcf..79e0c2a0 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -36,6 +36,11 @@ QString OptionsDialog::kopts_to_string(const key_opts& kopts) return tr("None"); } +void OptionsDialog::set_disable_translation_state(bool value) +{ + QSettings(OPENTRACK_ORG).setValue("disable-translation", value); +} + OptionsDialog::OptionsDialog(std::function pause_keybindings) : pause_keybindings(pause_keybindings) { @@ -89,6 +94,8 @@ OptionsDialog::OptionsDialog(std::function pause_keybindings) : tie_setting(main.tracklogging_enabled, ui.tracklogging_enabled); + ui.disable_translation->setChecked(QSettings(OPENTRACK_ORG).value("disable-translation", false).toBool()); + struct tmp { key_opts& opt; @@ -170,6 +177,7 @@ void OptionsDialog::doOK() { main.b->save(); ui.game_detector->save(); + set_disable_translation_state(ui.disable_translation->isChecked()); close(); emit closing(); } diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp index d98cc4d5..5f6b64e0 100644 --- a/gui/options-dialog.hpp +++ b/gui/options-dialog.hpp @@ -23,4 +23,5 @@ private slots: void doOK(); void doCancel(); void bind_key(key_opts &kopts, QLabel* label); + void set_disable_translation_state(bool value); }; diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui index b13bbe4d..471bd712 100644 --- a/gui/options-dialog.ui +++ b/gui/options-dialog.ui @@ -6,8 +6,8 @@ 0 0 - 510 - 621 + 525 + 603 @@ -336,6 +336,53 @@ + + + + QFrame::NoFrame + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Never translate the application interface + + + + + + + + + + :/images/english.png + + + + + + @@ -353,6 +400,12 @@ + + + 0 + 0 + + Enable tray @@ -360,6 +413,12 @@ + + + 0 + 0 + + Minimize to tray on startup when enabled @@ -378,7 +437,7 @@ - 0 + 10 0 @@ -1510,7 +1569,6 @@ bind_toggle_tracking bind_restart_tracking bind_tcomp_off_held - center_at_startup trayp tray_start use_center_as_translation_camera_offset @@ -1545,7 +1603,9 @@ tcomp_src_pitch_disable tcomp_src_roll_disable - + + + startEngineClicked() -- cgit v1.2.3