diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-11-18 18:43:35 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-11-18 18:43:35 +0100 |
commit | 7cb57c1c72bd4dfd56367a7f1130de0dbd5415d5 (patch) | |
tree | d48a7d02990b8ebf80bf74f42cde5d8f59421b48 /gui | |
parent | 3e0038ee3e35fc161624a3c3f94daf3d4fd824b9 (diff) |
gui: allow for disabling translation
Diffstat (limited to 'gui')
-rw-r--r-- | gui/images/english.png | bin | 0 -> 283 bytes | |||
-rw-r--r-- | gui/main.cpp | 7 | ||||
-rw-r--r-- | gui/opentrack-res.qrc | 1 | ||||
-rw-r--r-- | gui/options-dialog.cpp | 8 | ||||
-rw-r--r-- | gui/options-dialog.hpp | 1 | ||||
-rw-r--r-- | gui/options-dialog.ui | 70 |
6 files changed, 80 insertions, 7 deletions
diff --git a/gui/images/english.png b/gui/images/english.png Binary files differnew file mode 100644 index 00000000..187aabf9 --- /dev/null +++ b/gui/images/english.png 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 @@ <file>images/no-feed.png</file> <file>images/filter-16.png</file> <file>images/tracking-not-started.png</file> + <file>images/english.png</file> </qresource> </RCC> 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<void(bool)> pause_keybindings) : pause_keybindings(pause_keybindings) { @@ -89,6 +94,8 @@ OptionsDialog::OptionsDialog(std::function<void(bool)> 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 @@ <rect> <x>0</x> <y>0</y> - <width>510</width> - <height>621</height> + <width>525</width> + <height>603</height> </rect> </property> <property name="windowTitle"> @@ -337,6 +337,53 @@ </widget> </item> <item> + <widget class="QFrame" name="frame_3"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QCheckBox" name="disable_translation"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Never translate the application interface</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_29"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="opentrack-res.qrc">:/images/english.png</pixmap> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QGroupBox" name="groupBox_11"> <property name="title"> <string>Minimize to tray</string> @@ -353,6 +400,12 @@ </property> <item> <widget class="QCheckBox" name="trayp"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string>Enable tray</string> </property> @@ -360,6 +413,12 @@ </item> <item> <widget class="QCheckBox" name="tray_start"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string>Minimize to tray on startup when enabled</string> </property> @@ -378,7 +437,7 @@ </property> <property name="sizeHint" stdset="0"> <size> - <width>0</width> + <width>10</width> <height>0</height> </size> </property> @@ -1510,7 +1569,6 @@ <tabstop>bind_toggle_tracking</tabstop> <tabstop>bind_restart_tracking</tabstop> <tabstop>bind_tcomp_off_held</tabstop> - <tabstop>center_at_startup</tabstop> <tabstop>trayp</tabstop> <tabstop>tray_start</tabstop> <tabstop>use_center_as_translation_camera_offset</tabstop> @@ -1545,7 +1603,9 @@ <tabstop>tcomp_src_pitch_disable</tabstop> <tabstop>tcomp_src_roll_disable</tabstop> </tabstops> - <resources/> + <resources> + <include location="opentrack-res.qrc"/> + </resources> <connections/> <slots> <slot>startEngineClicked()</slot> |