Add Keyboard localization option
User can choose QWERTY or AZERTY keyboard input
This commit is contained in:
@@ -4303,13 +4303,14 @@ void MapView::keyPressEvent (QKeyEvent *event)
|
|||||||
if (event->key() == Qt::Key_Space)
|
if (event->key() == Qt::Key_Space)
|
||||||
_mod_space_down = true;
|
_mod_space_down = true;
|
||||||
|
|
||||||
|
checkInputsSettings();
|
||||||
|
|
||||||
// movement
|
// movement
|
||||||
if (event->key() == Qt::Key_W)
|
if (event->key() == _inputs[0])
|
||||||
{
|
{
|
||||||
moving = 1.0f;
|
moving = 1.0f;
|
||||||
}
|
}
|
||||||
if (event->key() == Qt::Key_S)
|
if (event->key() == _inputs[1])
|
||||||
{
|
{
|
||||||
moving = -1.0f;
|
moving = -1.0f;
|
||||||
}
|
}
|
||||||
@@ -4332,20 +4333,20 @@ void MapView::keyPressEvent (QKeyEvent *event)
|
|||||||
turn = -0.75f;
|
turn = -0.75f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->key() == Qt::Key_D)
|
if (event->key() == _inputs[2])
|
||||||
{
|
{
|
||||||
strafing = 1.0f;
|
strafing = 1.0f;
|
||||||
}
|
}
|
||||||
if (event->key() == Qt::Key_A)
|
if (event->key() == _inputs[3])
|
||||||
{
|
{
|
||||||
strafing = -1.0f;
|
strafing = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->key() == Qt::Key_Q)
|
if (event->key() == _inputs[4])
|
||||||
{
|
{
|
||||||
updown = 1.0f;
|
updown = 1.0f;
|
||||||
}
|
}
|
||||||
if (event->key() == Qt::Key_E)
|
if (event->key() == _inputs[5])
|
||||||
{
|
{
|
||||||
updown = -1.0f;
|
updown = -1.0f;
|
||||||
}
|
}
|
||||||
@@ -4459,8 +4460,10 @@ void MapView::keyReleaseEvent (QKeyEvent* event)
|
|||||||
if (event->key() == Qt::Key_Space)
|
if (event->key() == Qt::Key_Space)
|
||||||
_mod_space_down = false;
|
_mod_space_down = false;
|
||||||
|
|
||||||
|
checkInputsSettings();
|
||||||
|
|
||||||
// movement
|
// movement
|
||||||
if (event->key() == Qt::Key_W || event->key() == Qt::Key_S)
|
if (event->key() == _inputs[0] || event->key() == _inputs[1])
|
||||||
{
|
{
|
||||||
moving = 0.0f;
|
moving = 0.0f;
|
||||||
}
|
}
|
||||||
@@ -4475,12 +4478,12 @@ void MapView::keyReleaseEvent (QKeyEvent* event)
|
|||||||
turn = 0.0f;
|
turn = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->key() == Qt::Key_D || event->key() == Qt::Key_A)
|
if (event->key() == _inputs[2] || event->key() == _inputs[3])
|
||||||
{
|
{
|
||||||
strafing = 0.0f;
|
strafing = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->key() == Qt::Key_Q || event->key() == Qt::Key_E)
|
if (event->key() == _inputs[4] || event->key() == _inputs[5])
|
||||||
{
|
{
|
||||||
updown = 0.0f;
|
updown = 0.0f;
|
||||||
}
|
}
|
||||||
@@ -4518,6 +4521,19 @@ void MapView::keyReleaseEvent (QKeyEvent* event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapView::checkInputsSettings()
|
||||||
|
{
|
||||||
|
QString _locale = _settings->value("keyboard_locale", "QWERTY").toString();
|
||||||
|
|
||||||
|
// default is QWERTY
|
||||||
|
_inputs = std::array<Qt::Key, 6>{Qt::Key_W, Qt::Key_S, Qt::Key_D, Qt::Key_A, Qt::Key_Q, Qt::Key_E};
|
||||||
|
|
||||||
|
if (_locale == "AZERTY")
|
||||||
|
{
|
||||||
|
_inputs = std::array<Qt::Key, 6>{Qt::Key_Z, Qt::Key_S, Qt::Key_D, Qt::Key_Q, Qt::Key_A, Qt::Key_E};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MapView::focusOutEvent (QFocusEvent*)
|
void MapView::focusOutEvent (QFocusEvent*)
|
||||||
{
|
{
|
||||||
_mod_alt_down = false;
|
_mod_alt_down = false;
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ private:
|
|||||||
|
|
||||||
bool _camera_moved_since_last_draw = true;
|
bool _camera_moved_since_last_draw = true;
|
||||||
|
|
||||||
|
std::array<Qt::Key, 6> _inputs = {Qt::Key_W, Qt::Key_S, Qt::Key_D, Qt::Key_A, Qt::Key_Q, Qt::Key_E};
|
||||||
|
void checkInputsSettings();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Noggit::BoolToggleProperty _draw_contour = {false};
|
Noggit::BoolToggleProperty _draw_contour = {false};
|
||||||
Noggit::BoolToggleProperty _draw_mfbo = {false};
|
Noggit::BoolToggleProperty _draw_mfbo = {false};
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ namespace Noggit
|
|||||||
ui->_nativeMenubar->setChecked(_settings->value("nativeMenubar", true).toBool());
|
ui->_nativeMenubar->setChecked(_settings->value("nativeMenubar", true).toBool());
|
||||||
ui->_additional_file_loading_log->setChecked(
|
ui->_additional_file_loading_log->setChecked(
|
||||||
_settings->value("additional_file_loading_log", false).toBool());
|
_settings->value("additional_file_loading_log", false).toBool());
|
||||||
|
ui->_keyboard_locale->setCurrentText(_settings->value("keyboard_locale", "QWERTY").toString());
|
||||||
ui->_theme->setCurrentText(_settings->value("theme", "Dark").toString());
|
ui->_theme->setCurrentText(_settings->value("theme", "Dark").toString());
|
||||||
|
|
||||||
ui->assetBrowserBgCol->setColor(_settings->value("assetBrowser/background_color",
|
ui->assetBrowserBgCol->setColor(_settings->value("assetBrowser/background_color",
|
||||||
@@ -284,6 +285,7 @@ namespace Noggit
|
|||||||
_settings->setValue("unload_interval", ui->_adt_unload_check_interval->value());
|
_settings->setValue("unload_interval", ui->_adt_unload_check_interval->value());
|
||||||
_settings->setValue("uid_startup_check", ui->_uid_cb->isChecked());
|
_settings->setValue("uid_startup_check", ui->_uid_cb->isChecked());
|
||||||
_settings->setValue("additional_file_loading_log", ui->_additional_file_loading_log->isChecked());
|
_settings->setValue("additional_file_loading_log", ui->_additional_file_loading_log->isChecked());
|
||||||
|
_settings->setValue("keyboard_locale", ui->_keyboard_locale->currentText());
|
||||||
_settings->setValue("systemWindowFrame", ui->_systemWindowFrame->isChecked());
|
_settings->setValue("systemWindowFrame", ui->_systemWindowFrame->isChecked());
|
||||||
_settings->setValue("nativeMenubar", ui->_nativeMenubar->isChecked());
|
_settings->setValue("nativeMenubar", ui->_nativeMenubar->isChecked());
|
||||||
|
|
||||||
@@ -313,4 +315,4 @@ namespace Noggit
|
|||||||
emit saved();
|
emit saved();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -995,6 +995,9 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_32">
|
<layout class="QVBoxLayout" name="verticalLayout_32">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_57">
|
<layout class="QHBoxLayout" name="horizontalLayout_57">
|
||||||
<item>
|
<item>
|
||||||
@@ -1198,6 +1201,72 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>134</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Keyboard locale</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="_keyboard_locale">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>QWERTY</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>AZERTY</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user