This commit is contained in:
Skarn
2022-02-13 16:42:24 +03:00
4 changed files with 126 additions and 137 deletions

View File

@@ -4303,13 +4303,14 @@ void MapView::keyPressEvent (QKeyEvent *event)
if (event->key() == Qt::Key_Space)
_mod_space_down = true;
checkInputsSettings();
// movement
if (event->key() == Qt::Key_W)
if (event->key() == _inputs[0])
{
moving = 1.0f;
}
if (event->key() == Qt::Key_S)
if (event->key() == _inputs[1])
{
moving = -1.0f;
}
@@ -4332,20 +4333,20 @@ void MapView::keyPressEvent (QKeyEvent *event)
turn = -0.75f;
}
if (event->key() == Qt::Key_D)
if (event->key() == _inputs[2])
{
strafing = 1.0f;
}
if (event->key() == Qt::Key_A)
if (event->key() == _inputs[3])
{
strafing = -1.0f;
}
if (event->key() == Qt::Key_Q)
if (event->key() == _inputs[4])
{
updown = 1.0f;
}
if (event->key() == Qt::Key_E)
if (event->key() == _inputs[5])
{
updown = -1.0f;
}
@@ -4459,8 +4460,10 @@ void MapView::keyReleaseEvent (QKeyEvent* event)
if (event->key() == Qt::Key_Space)
_mod_space_down = false;
checkInputsSettings();
// movement
if (event->key() == Qt::Key_W || event->key() == Qt::Key_S)
if (event->key() == _inputs[0] || event->key() == _inputs[1])
{
moving = 0.0f;
}
@@ -4475,12 +4478,12 @@ void MapView::keyReleaseEvent (QKeyEvent* event)
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;
}
if (event->key() == Qt::Key_Q || event->key() == Qt::Key_E)
if (event->key() == _inputs[4] || event->key() == _inputs[5])
{
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*)
{
_mod_alt_down = false;

View File

@@ -132,6 +132,9 @@ private:
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:
Noggit::BoolToggleProperty _draw_contour = {false};
Noggit::BoolToggleProperty _draw_mfbo = {false};

View File

@@ -225,6 +225,7 @@ namespace Noggit
ui->_nativeMenubar->setChecked(_settings->value("nativeMenubar", true).toBool());
ui->_additional_file_loading_log->setChecked(
_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->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("uid_startup_check", ui->_uid_cb->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("nativeMenubar", ui->_nativeMenubar->isChecked());

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>480</height>
<width>617</width>
<height>576</height>
</rect>
</property>
<property name="sizePolicy">
@@ -994,23 +994,44 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
<item>
<layout class="QVBoxLayout" name="verticalLayout_33">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="leftMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_57">
<item>
<spacer name="horizontalSpacer_47">
<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>
<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>
<layout class="QFormLayout" name="formLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_39">
<property name="minimumSize">
<size>
@@ -1023,7 +1044,7 @@
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QCheckBox" name="_uid_cb">
<property name="text">
<string/>
@@ -1033,37 +1054,7 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_48">
<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>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_59">
<item>
<spacer name="horizontalSpacer_51">
<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>
<item row="1" column="0">
<widget class="QLabel" name="label_41">
<property name="minimumSize">
<size>
@@ -1076,44 +1067,14 @@
</property>
</widget>
</item>
<item>
<item row="1" column="1">
<widget class="QCheckBox" name="_undock_tool_properties">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_52">
<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>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_60">
<item>
<spacer name="horizontalSpacer_53">
<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>
<item row="2" column="0">
<widget class="QLabel" name="label_42">
<property name="minimumSize">
<size>
@@ -1126,44 +1087,14 @@
</property>
</widget>
</item>
<item>
<item row="2" column="1">
<widget class="QCheckBox" name="_undock_small_texture_palette">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_54">
<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>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_61">
<item>
<spacer name="horizontalSpacer_55">
<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>
<item row="3" column="0">
<widget class="QLabel" name="label_43">
<property name="minimumSize">
<size>
@@ -1176,28 +1107,67 @@
</property>
</widget>
</item>
<item>
<item row="3" column="1">
<widget class="QCheckBox" name="_additional_file_loading_log">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_56">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>134</width>
<height>0</height>
</size>
</property>
</spacer>
<property name="text">
<string>Keyboard locale</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="_keyboard_locale">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>QWERTY</string>
</property>
</item>
<item>
<property name="text">
<string>AZERTY</string>
</property>
</item>
</widget>
</item>
</layout>
</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>
@@ -2022,9 +1992,7 @@
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../resources/resources.qrc"/>
</resources>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="_wireframe_type_group"/>