diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/images/english.png | bin | 0 -> 283 bytes | |||
-rw-r--r-- | gui/lang/ru_RU.ts | 97 | ||||
-rw-r--r-- | gui/main-window.cpp | 41 | ||||
-rw-r--r-- | gui/main-window.ui | 24 | ||||
-rw-r--r-- | gui/main.cpp | 9 | ||||
-rw-r--r-- | gui/mapping-window.hpp | 3 | ||||
-rw-r--r-- | gui/new_file_dialog.h | 3 | ||||
-rw-r--r-- | gui/opentrack-res.qrc | 1 | ||||
-rw-r--r-- | gui/options-dialog.cpp | 15 | ||||
-rw-r--r-- | gui/options-dialog.hpp | 5 | ||||
-rw-r--r-- | gui/options-dialog.ui | 92 |
11 files changed, 205 insertions, 85 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/lang/ru_RU.ts b/gui/lang/ru_RU.ts index fd7842af..9f5e0463 100644 --- a/gui/lang/ru_RU.ts +++ b/gui/lang/ru_RU.ts @@ -50,7 +50,7 @@ <context> <name>MainWindow</name> <message> - <location filename="../main-window.cpp" line="+90"/> + <location filename="../main-window.cpp" line="+97"/> <source>Create new empty config</source> <translation>Создать новый пустой профиль</translation> </message> @@ -77,18 +77,18 @@ </message> <message> <location line="+8"/> - <location line="+555"/> + <location line="+559"/> <source>Show the Octopus</source> <translation>Показать осьминожка</translation> </message> <message> - <location line="-555"/> - <location line="+555"/> + <location line="-559"/> + <location line="+559"/> <source>Hide the Octopus</source> <translation>Спрятать осьминожка</translation> </message> <message> - <location line="-548"/> + <location line="-552"/> <source>Tracker settings</source> <translation>Настройка источника данных</translation> </message> @@ -153,6 +153,19 @@ Exiting now.</source> </message> </context> <context> + <name>OptionsDialog</name> + <message> + <location filename="../options-dialog.cpp" line="+27"/> + <source>Joy button %1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+3"/> + <source>None</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>UI_new_config</name> <message> <location filename="../new_config.ui" line="+17"/> @@ -188,38 +201,38 @@ Exiting now.</source> <message> <location line="+67"/> <location line="+479"/> - <source>TZ</source> - <translation>Смещение по Z</translation> + <source>Z</source> + <translation>Смещение по оси Z</translation> </message> <message> <location line="-463"/> <location line="+409"/> - <source>pitch</source> - <translation>тангаж</translation> + <source>Pitch</source> + <translation>Тангаж</translation> </message> <message> <location line="-356"/> <location line="+315"/> - <source>TY</source> - <translation>Смещение по Y</translation> + <source>Y</source> + <translation>Смещение по оси Y</translation> </message> <message> <location line="-299"/> <location line="+277"/> - <source>TX</source> - <translation>Смещение по X</translation> + <source>X</source> + <translation>Смещение по оси X</translation> </message> <message> <location line="-230"/> <location line="+309"/> - <source>roll</source> - <translation>крен</translation> + <source>Roll</source> + <translation>Крен</translation> </message> <message> <location line="-293"/> <location line="+309"/> - <source>yaw</source> - <translation>рысканье</translation> + <source>Yaw</source> + <translation>Рысканье</translation> </message> <message> <location line="-200"/> @@ -328,9 +341,22 @@ Exiting now.</source> </message> </context> <context> + <name>new_file_dialog</name> + <message> + <location filename="../new_file_dialog.h" line="+42"/> + <source>File exists</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+1"/> + <source>This file already exists. Pick another name.</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>options_dialog</name> <message> - <location filename="../options-dialog.ui" line="+14"/> + <location filename="../options-dialog.ui" line="+20"/> <source>Options</source> <translation>Настройки</translation> </message> @@ -420,12 +446,17 @@ Exiting now.</source> <translation>Центрирование при запуске</translation> </message> <message> - <location line="+7"/> + <location line="+34"/> + <source>Never translate the application interface</source> + <translation></translation> + </message> + <message> + <location line="+20"/> <source>Minimize to tray</source> <translation>Настройка трея</translation> </message> <message> - <location line="+220"/> + <location line="+234"/> <location line="+69"/> <location line="+53"/> <source>°</source> @@ -437,17 +468,17 @@ Exiting now.</source> <translation>Включить</translation> </message> <message> - <location line="-486"/> + <location line="-488"/> <source>Minimize to tray on startup when enabled</source> <translation>Сворачивать в трей при запуске</translation> </message> <message> - <location line="-7"/> + <location line="-13"/> <source>Enable tray</source> <translation>Добавлять opentrack в трей</translation> </message> <message> - <location line="+34"/> + <location line="+40"/> <source>Camera</source> <translation>Камера</translation> </message> @@ -462,20 +493,12 @@ Exiting now.</source> <translation>Использование функции коррекции камеры</translation> </message> <message> - <location line="+7"/> - <source><html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect.</p> - -<p>You can derive it from the center pose as per the checkbox or specify it manually.</p> - -<p>You can specify both, and it can be helpful to specify pitch when moving toward the screen results in translating upward.</p></body></html></source> - <translation><html><head/><body><p>Используйте данную настройку для того, чтобы скорректировать работу камеры в случае, когда она у Вас расположена не четко напротив клипсы.</p> - -<p>Если у вас при зуме осьминожек убегает - то это то, что Вам нужно! Например: при "убегании" вниз добавьте тангажа.</p> - -<p>You can specify both, and it can be helpful to specify pitch when moving toward the screen results in translating upward.</p></body></html></translation> + <location line="+13"/> + <source>Specify an angle to rotate position tracking. It lets the tracker avoid moving on the X and Y axes when zooming, since camera isn't mounted perfectly in front of the model, but above or below.</source> + <translation>Используйте данную настройку для того, чтобы скорректировать работу камеры в случае, когда она у Вас расположена не четко напротив клипсы. Если у вас при зуме осьминожек убегает - то это то, что Вам нужно! Например: при "убегании" вниз добавьте тангажа.</translation> </message> <message> - <location line="+38"/> + <location line="+34"/> <location line="+206"/> <location line="+381"/> <location line="+47"/> @@ -681,12 +704,12 @@ Exiting now.</source> <message> <location line="-158"/> <source>Destination</source> - <translation>Игровая ось:</translation> + <translation>Игровая ось</translation> </message> <message> <location line="+28"/> <source>Source</source> - <translation>Исходная ось:</translation> + <translation>Исходная ось</translation> </message> <message> <location line="+184"/> diff --git a/gui/main-window.cpp b/gui/main-window.cpp index d3e0baa8..d760783b 100644 --- a/gui/main-window.cpp +++ b/gui/main-window.cpp @@ -42,7 +42,14 @@ MainWindow::MainWindow() : menu_action_mappings(&tray_menu) { ui.setupUi(this); - setFixedSize(size()); + + { + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + adjustSize(); + setFixedSize(size()); + setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | windowFlags()); + } + updateButtonState(false, false); if (group::ini_directory().size() == 0) @@ -566,19 +573,21 @@ bool mk_dialog(mem<dylib> lib, ptr<t>& orig) { if (orig && orig->isVisible()) { - orig->show(); - orig->raise(); + QDialog& d = *orig; + d.show(); + d.raise(); return false; } if (lib && lib->Dialog) { t* dialog = reinterpret_cast<t*>(lib->Dialog()); - dialog->setWindowFlags(Qt::Dialog); - // HACK: prevent stderr whining by adding a few pixels - dialog->setFixedSize(dialog->size() + QSize(4, 4)); - dialog->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - dialog->show(); + QDialog& d = *dialog; + d.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + d.adjustSize(); + d.setFixedSize(d.size()); + d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags()); + d.show(); orig.reset(dialog); @@ -613,18 +622,20 @@ static bool mk_window(ptr<t>* place, Args&&... params) { if (*place && (*place)->isVisible()) { - (*place)->show(); - (*place)->raise(); + QDialog& d = **place; + d.show(); + d.raise(); return false; } else { *place = make_unique<t>(std::forward<Args>(params)...); - (*place)->setWindowFlags(Qt::Dialog); - // HACK: prevent stderr whining by adding a few pixels - (*place)->setFixedSize((*place)->size() + QSize(4, 4)); - (*place)->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - (*place)->show(); + QDialog& d = **place; + d.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + d.adjustSize(); + d.setFixedSize(d.size()); + d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags()); + d.show(); return true; } } diff --git a/gui/main-window.ui b/gui/main-window.ui index 8bf78efd..33ee99d3 100644 --- a/gui/main-window.ui +++ b/gui/main-window.ui @@ -342,7 +342,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TZ</string> + <string>Z</string> </property> </widget> </item> @@ -358,7 +358,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>pitch</string> + <string>Pitch</string> </property> </widget> </item> @@ -411,7 +411,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TY</string> + <string>Y</string> </property> </widget> </item> @@ -427,7 +427,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TX</string> + <string>X</string> </property> </widget> </item> @@ -474,7 +474,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>roll</string> + <string>Roll</string> </property> </widget> </item> @@ -490,7 +490,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>yaw</string> + <string>Yaw</string> </property> </widget> </item> @@ -704,7 +704,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TX</string> + <string>X</string> </property> </widget> </item> @@ -726,7 +726,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TY</string> + <string>Y</string> </property> </widget> </item> @@ -767,7 +767,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>pitch</string> + <string>Pitch</string> </property> </widget> </item> @@ -783,7 +783,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>roll</string> + <string>Roll</string> </property> </widget> </item> @@ -799,7 +799,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>yaw</string> + <string>Yaw</string> </property> </widget> </item> @@ -821,7 +821,7 @@ <enum>QFrame::Raised</enum> </property> <property name="text"> - <string>TZ</string> + <string>Z</string> </property> </widget> </item> diff --git a/gui/main.cpp b/gui/main.cpp index de904f94..5cc041fb 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -141,10 +141,13 @@ main(int argc, char** argv) add_win32_path(); #endif - // QLocale::setDefault(QLocale("pl_PL")); // force i18n for testing + // QLocale::setDefault(QLocale("ru_RU")); // 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/mapping-window.hpp b/gui/mapping-window.hpp index 7648c994..06d969cc 100644 --- a/gui/mapping-window.hpp +++ b/gui/mapping-window.hpp @@ -4,11 +4,12 @@ #include "ui_mapping-window.h" #include <QWidget> +#include <QDialog> #include <QShowEvent> #include <QCloseEvent> #include <QCheckBox> -class MapWidget final : public QWidget +class MapWidget final : public QDialog { Q_OBJECT public: diff --git a/gui/new_file_dialog.h b/gui/new_file_dialog.h index 6ba3ede3..cd5ca528 100644 --- a/gui/new_file_dialog.h +++ b/gui/new_file_dialog.h @@ -39,7 +39,8 @@ private slots: if (text == "" || text == ".ini" || QFile(options::group::ini_directory() + "/" + text).exists()) { QMessageBox::warning(this, - "File exists", "This file already exists. Pick another name.", + tr("File exists"), + tr("This file already exists. Pick another name."), QMessageBox::Ok, QMessageBox::NoButton); return; } 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 2f40e39f..bafddb57 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -14,7 +14,7 @@ #include <QDialog> #include <QFileDialog> -static QString kopts_to_string(const key_opts& kopts) +QString OptionsDialog::kopts_to_string(const key_opts& kopts) { if (static_cast<QString>(kopts.guid) != "") { @@ -24,13 +24,18 @@ static QString kopts_to_string(const key_opts& kopts) if (mods & Qt::ControlModifier) mm += "Control+"; if (mods & Qt::AltModifier) mm += "Alt+"; if (mods & Qt::ShiftModifier) mm += "Shift+"; - return mm + "Joy button " + QString::number(btn); + return mm + tr("Joy button %1").arg(QString::number(btn)); } if (static_cast<QString>(kopts.keycode) == "") - return "None"; + return tr("None"); return kopts.keycode; } +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) { @@ -84,6 +89,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; @@ -130,6 +137,7 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) d.setLayout(&l); d.setFixedSize(QSize(500, 300)); d.setWindowFlags(Qt::Dialog); + setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | windowFlags()); d.setWindowModality(Qt::ApplicationModal); connect(&k, &KeyboardListener::key_pressed, @@ -165,6 +173,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 b0e285e8..8c62b278 100644 --- a/gui/options-dialog.hpp +++ b/gui/options-dialog.hpp @@ -3,10 +3,11 @@ #include "ui_options-dialog.h" #include "logic/shortcuts.h" #include <QObject> +#include <QDialog> #include <QWidget> #include <functional> -class OptionsDialog : public QWidget +class OptionsDialog : public QDialog { Q_OBJECT signals: @@ -18,8 +19,10 @@ private: std::function<void(bool)> pause_keybindings; Ui::options_dialog ui; void closeEvent(QCloseEvent *) override { doCancel(); } + static QString kopts_to_string(const key_opts& opts); 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 f6b8e3d6..2168fa8d 100644 --- a/gui/options-dialog.ui +++ b/gui/options-dialog.ui @@ -6,10 +6,16 @@ <rect> <x>0</x> <y>0</y> - <width>459</width> - <height>615</height> + <width>450</width> + <height>599</height> </rect> </property> + <property name="minimumSize"> + <size> + <width>450</width> + <height>0</height> + </size> + </property> <property name="windowTitle"> <string>Options</string> </property> @@ -27,7 +33,7 @@ <item> <widget class="QTabWidget" name="tabWidget"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -337,6 +343,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 +406,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 +419,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 +443,7 @@ </property> <property name="sizeHint" stdset="0"> <size> - <width>0</width> + <width>10</width> <height>0</height> </size> </property> @@ -406,12 +471,14 @@ </item> <item row="5" column="0"> <widget class="QLabel" name="label_17"> + <property name="minimumSize"> + <size> + <width>300</width> + <height>0</height> + </size> + </property> <property name="text"> - <string><html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect.</p> - -<p>You can derive it from the center pose as per the checkbox or specify it manually.</p> - -<p>You can specify both, and it can be helpful to specify pitch when moving toward the screen results in translating upward.</p></body></html></string> + <string>Specify an angle to rotate position tracking. It lets the tracker avoid moving on the X and Y axes when zooming, since camera isn't mounted perfectly in front of the model, but above or below.</string> </property> <property name="alignment"> <set>Qt::AlignJustify|Qt::AlignVCenter</set> @@ -810,7 +877,7 @@ <item> <widget class="QGroupBox" name="groupBox_"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -1514,7 +1581,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> @@ -1549,7 +1615,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> |