mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-26 04:16:18 +00:00
Fixed formatting from clang-format
This commit is contained in:
parent
429c64a51b
commit
990e349424
4 changed files with 66 additions and 77 deletions
|
@ -223,25 +223,19 @@ void ParseInputConfig(const std::string game_id = "") {
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
lineCount++;
|
lineCount++;
|
||||||
|
|
||||||
auto line_kpmask = (line.substr(0, 2) == "kp ") ? line.begin() + 2 : line.begin();
|
|
||||||
|
|
||||||
// Strip the ; and whitespace
|
// Strip the ; and whitespace
|
||||||
line.erase(std::remove_if(line_kpmask, line.end(),
|
line.erase(std::remove_if(line.begin(), line.end(),
|
||||||
[](unsigned char c) { return std::isspace(c); }),
|
[](unsigned char c) { return std::isspace(c); }),
|
||||||
line.end());
|
line.end());
|
||||||
|
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Truncate lines starting at #
|
// Truncate lines starting at #
|
||||||
std::size_t comment_pos = line.find('#');
|
std::size_t comment_pos = line.find('#');
|
||||||
if (comment_pos != std::string::npos) {
|
if (comment_pos != std::string::npos) {
|
||||||
line = line.substr(0, comment_pos);
|
line = line.substr(0, comment_pos);
|
||||||
}
|
}
|
||||||
// Remove trailing semicolon
|
|
||||||
if (!line.empty() && std::distance(line_kpmask, line.end()) != 1 && line[line.length() - 1] == ';') {
|
|
||||||
line = line.substr(0, line.length() - 1);
|
|
||||||
}
|
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -256,14 +250,18 @@ void ParseInputConfig(const std::string game_id = "") {
|
||||||
|
|
||||||
std::string output_string = line.substr(0, equal_pos);
|
std::string output_string = line.substr(0, equal_pos);
|
||||||
std::string input_string = line.substr(equal_pos + 1);
|
std::string input_string = line.substr(equal_pos + 1);
|
||||||
std::size_t comma_pos = input_string.find(',');
|
// Remove trailing semicolon from input_string
|
||||||
|
if (!input_string.empty() && input_string[input_string.length() - 1] == ';') {
|
||||||
|
if (!(input_string == ";" || input_string == "kp;")) {
|
||||||
|
line = line.substr(0, line.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t comma_pos = input_string.find(',');
|
||||||
auto parseInt = [](const std::string& s) -> std::optional<int> {
|
auto parseInt = [](const std::string& s) -> std::optional<int> {
|
||||||
int value = 0;
|
try {
|
||||||
auto [ptr, ec] = std::from_chars(s.data(), s.data() + s.size(), value);
|
return std::stoi(s);
|
||||||
if (ec == std::errc()) {
|
} catch (...) {
|
||||||
return value;
|
|
||||||
} else {
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -377,7 +375,6 @@ void ParseInputConfig(const std::string game_id = "") {
|
||||||
BindingConnection connection(InputID(), nullptr);
|
BindingConnection connection(InputID(), nullptr);
|
||||||
auto button_it = string_to_cbutton_map.find(output_string);
|
auto button_it = string_to_cbutton_map.find(output_string);
|
||||||
auto axis_it = string_to_axis_map.find(output_string);
|
auto axis_it = string_to_axis_map.find(output_string);
|
||||||
|
|
||||||
if (binding.IsEmpty()) {
|
if (binding.IsEmpty()) {
|
||||||
LOG_WARNING(Input, "Invalid format at line: {}, data: \"{}\", skipping line.",
|
LOG_WARNING(Input, "Invalid format at line: {}, data: \"{}\", skipping line.",
|
||||||
lineCount, line);
|
lineCount, line);
|
||||||
|
@ -444,11 +441,11 @@ InputEvent InputBinding::GetInputEventFromSDLEvent(const SDL_Event& e) {
|
||||||
e.type == SDL_EVENT_MOUSE_WHEEL, 0);
|
e.type == SDL_EVENT_MOUSE_WHEEL, 0);
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
return InputEvent(InputType::Controller, static_cast<u32>(e.gbutton.button),
|
return InputEvent(InputType::Controller, static_cast<u32>(e.gbutton.button), e.gbutton.down,
|
||||||
e.gbutton.down, 0);
|
0); // clang made me do it
|
||||||
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
return InputEvent(InputType::Axis, static_cast<u32>(e.gaxis.axis),
|
return InputEvent(InputType::Axis, static_cast<u32>(e.gaxis.axis), true,
|
||||||
true, e.gaxis.value / 256);
|
e.gaxis.value / 256); // this too
|
||||||
default:
|
default:
|
||||||
return InputEvent();
|
return InputEvent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
#define KEY_TOGGLE 0x00200000
|
#define KEY_TOGGLE 0x00200000
|
||||||
|
|
||||||
|
|
||||||
#define SDL_INVALID_ID UINT32_MAX
|
#define SDL_INVALID_ID UINT32_MAX
|
||||||
|
|
||||||
namespace Input {
|
namespace Input {
|
||||||
|
@ -164,7 +163,7 @@ const std::map<std::string, u32> string_to_keyboard_key_map = {
|
||||||
{"7", SDLK_7},
|
{"7", SDLK_7},
|
||||||
{"8", SDLK_8},
|
{"8", SDLK_8},
|
||||||
{"9", SDLK_9},
|
{"9", SDLK_9},
|
||||||
|
|
||||||
// symbols
|
// symbols
|
||||||
{"`", SDLK_GRAVE},
|
{"`", SDLK_GRAVE},
|
||||||
{"~", SDLK_TILDE},
|
{"~", SDLK_TILDE},
|
||||||
|
@ -229,7 +228,7 @@ const std::map<std::string, u32> string_to_keyboard_key_map = {
|
||||||
{"down", SDLK_DOWN},
|
{"down", SDLK_DOWN},
|
||||||
{"left", SDLK_LEFT},
|
{"left", SDLK_LEFT},
|
||||||
{"right", SDLK_RIGHT},
|
{"right", SDLK_RIGHT},
|
||||||
|
|
||||||
// keypad
|
// keypad
|
||||||
{"kp0", SDLK_KP_0},
|
{"kp0", SDLK_KP_0},
|
||||||
{"kp1", SDLK_KP_1},
|
{"kp1", SDLK_KP_1},
|
||||||
|
@ -241,14 +240,14 @@ const std::map<std::string, u32> string_to_keyboard_key_map = {
|
||||||
{"kp7", SDLK_KP_7},
|
{"kp7", SDLK_KP_7},
|
||||||
{"kp8", SDLK_KP_8},
|
{"kp8", SDLK_KP_8},
|
||||||
{"kp9", SDLK_KP_9},
|
{"kp9", SDLK_KP_9},
|
||||||
{"kp .", SDLK_KP_PERIOD},
|
{"kp.", SDLK_KP_PERIOD},
|
||||||
{"kp ,", SDLK_KP_COMMA},
|
{"kp,", SDLK_KP_COMMA},
|
||||||
{"kp /", SDLK_KP_DIVIDE},
|
{"kp/", SDLK_KP_DIVIDE},
|
||||||
{"kp *", SDLK_KP_MULTIPLY},
|
{"kp*", SDLK_KP_MULTIPLY},
|
||||||
{"kp -", SDLK_KP_MINUS},
|
{"kp-", SDLK_KP_MINUS},
|
||||||
{"kp +", SDLK_KP_PLUS},
|
{"kp+", SDLK_KP_PLUS},
|
||||||
{"kp =", SDLK_KP_EQUALS},
|
{"kp=", SDLK_KP_EQUALS},
|
||||||
{"kp enter", SDLK_KP_ENTER},
|
{"kpenter", SDLK_KP_ENTER},
|
||||||
|
|
||||||
// mouse
|
// mouse
|
||||||
{"leftbutton", SDL_BUTTON_LEFT},
|
{"leftbutton", SDL_BUTTON_LEFT},
|
||||||
|
|
|
@ -168,14 +168,14 @@ void KBMSettings::SaveKBMConfig(bool close_on_save) {
|
||||||
add_mapping(ui->CircleButton->text(), "circle");
|
add_mapping(ui->CircleButton->text(), "circle");
|
||||||
add_mapping(ui->TriangleButton->text(), "triangle");
|
add_mapping(ui->TriangleButton->text(), "triangle");
|
||||||
add_mapping(ui->SquareButton->text(), "square");
|
add_mapping(ui->SquareButton->text(), "square");
|
||||||
|
|
||||||
lines.push_back("");
|
lines.push_back("");
|
||||||
|
|
||||||
add_mapping(ui->DpadUpButton->text(), "pad_up");
|
add_mapping(ui->DpadUpButton->text(), "pad_up");
|
||||||
add_mapping(ui->DpadDownButton->text(), "pad_down");
|
add_mapping(ui->DpadDownButton->text(), "pad_down");
|
||||||
add_mapping(ui->DpadLeftButton->text(), "pad_left");
|
add_mapping(ui->DpadLeftButton->text(), "pad_left");
|
||||||
add_mapping(ui->DpadRightButton->text(), "pad_right");
|
add_mapping(ui->DpadRightButton->text(), "pad_right");
|
||||||
|
|
||||||
lines.push_back("");
|
lines.push_back("");
|
||||||
|
|
||||||
add_mapping(ui->L1Button->text(), "l1");
|
add_mapping(ui->L1Button->text(), "l1");
|
||||||
|
@ -184,26 +184,26 @@ void KBMSettings::SaveKBMConfig(bool close_on_save) {
|
||||||
add_mapping(ui->R2Button->text(), "r2");
|
add_mapping(ui->R2Button->text(), "r2");
|
||||||
add_mapping(ui->L3Button->text(), "l3");
|
add_mapping(ui->L3Button->text(), "l3");
|
||||||
add_mapping(ui->R3Button->text(), "r3");
|
add_mapping(ui->R3Button->text(), "r3");
|
||||||
|
|
||||||
lines.push_back("");
|
lines.push_back("");
|
||||||
|
|
||||||
add_mapping(ui->OptionsButton->text(), "options");
|
add_mapping(ui->OptionsButton->text(), "options");
|
||||||
add_mapping(ui->TouchpadButton->text(), "touchpad");
|
add_mapping(ui->TouchpadButton->text(), "touchpad");
|
||||||
|
|
||||||
lines.push_back("");
|
lines.push_back("");
|
||||||
|
|
||||||
add_mapping(ui->LStickUpButton->text(), "axis_left_y_minus");
|
add_mapping(ui->LStickUpButton->text(), "axis_left_y_minus");
|
||||||
add_mapping(ui->LStickDownButton->text(), "axis_left_y_plus");
|
add_mapping(ui->LStickDownButton->text(), "axis_left_y_plus");
|
||||||
add_mapping(ui->LStickLeftButton->text(), "axis_left_x_minus");
|
add_mapping(ui->LStickLeftButton->text(), "axis_left_x_minus");
|
||||||
add_mapping(ui->LStickRightButton->text(), "axis_left_x_plus");
|
add_mapping(ui->LStickRightButton->text(), "axis_left_x_plus");
|
||||||
|
|
||||||
lines.push_back("");
|
lines.push_back("");
|
||||||
|
|
||||||
add_mapping(ui->RStickUpButton->text(), "axis_right_y_minus");
|
add_mapping(ui->RStickUpButton->text(), "axis_right_y_minus");
|
||||||
add_mapping(ui->RStickDownButton->text(), "axis_right_y_plus");
|
add_mapping(ui->RStickDownButton->text(), "axis_right_y_plus");
|
||||||
add_mapping(ui->RStickLeftButton->text(), "axis_right_x_minus");
|
add_mapping(ui->RStickLeftButton->text(), "axis_right_x_minus");
|
||||||
add_mapping(ui->RStickRightButton->text(), "axis_right_x_plus");
|
add_mapping(ui->RStickRightButton->text(), "axis_right_x_plus");
|
||||||
|
|
||||||
lines.push_back("");
|
lines.push_back("");
|
||||||
|
|
||||||
add_mapping(ui->MouseJoystickBox->currentText(), "mouse_to_joystick");
|
add_mapping(ui->MouseJoystickBox->currentText(), "mouse_to_joystick");
|
||||||
|
@ -225,12 +225,6 @@ void KBMSettings::SaveKBMConfig(bool close_on_save) {
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
lineCount++;
|
lineCount++;
|
||||||
|
|
||||||
// remove whitespace from the beginning of the line
|
|
||||||
auto line_kpmask = (line.substr(0, 2) == "kp ") ? line.begin() + 2 : line.begin();
|
|
||||||
line.erase(std::remove_if(line_kpmask, line.end(),
|
|
||||||
[](unsigned char c) { return std::isspace(c); }),
|
|
||||||
line.end());
|
|
||||||
|
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
lines.push_back(line);
|
lines.push_back(line);
|
||||||
continue;
|
continue;
|
||||||
|
@ -293,10 +287,10 @@ void KBMSettings::SaveKBMConfig(bool close_on_save) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void KBMSettings::SetDefault() {
|
void KBMSettings::SetDefault() {
|
||||||
ui->CrossButton->setText("kp 2");
|
ui->CrossButton->setText("kp2");
|
||||||
ui->CircleButton->setText("kp 6");
|
ui->CircleButton->setText("kp6");
|
||||||
ui->TriangleButton->setText("kp 8");
|
ui->TriangleButton->setText("kp8");
|
||||||
ui->SquareButton->setText("kp 4");
|
ui->SquareButton->setText("kp4");
|
||||||
|
|
||||||
ui->L1Button->setText("q");
|
ui->L1Button->setText("q");
|
||||||
ui->L2Button->setText("e");
|
ui->L2Button->setText("e");
|
||||||
|
@ -354,7 +348,6 @@ void KBMSettings::SetUIValuestoMappings(std::string config_id) {
|
||||||
|
|
||||||
if (std::find(ControllerInputs.begin(), ControllerInputs.end(), input_string) ==
|
if (std::find(ControllerInputs.begin(), ControllerInputs.end(), input_string) ==
|
||||||
ControllerInputs.end()) {
|
ControllerInputs.end()) {
|
||||||
|
|
||||||
if (output_string == "cross") {
|
if (output_string == "cross") {
|
||||||
ui->CrossButton->setText(QString::fromStdString(input_string));
|
ui->CrossButton->setText(QString::fromStdString(input_string));
|
||||||
} else if (output_string == "circle") {
|
} else if (output_string == "circle") {
|
||||||
|
@ -532,8 +525,8 @@ void KBMSettings::SetMapping(QString input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper lambda to get the modified button text based on the current keyboard modifiers
|
// Helper lambda to get the modified button text based on the current keyboard modifiers
|
||||||
auto GetModifiedButton = [](Qt::KeyboardModifiers modifier,
|
auto GetModifiedButton = [](Qt::KeyboardModifiers modifier, const std::string& m_button,
|
||||||
const std::string& m_button, const std::string& n_button) -> QString {
|
const std::string& n_button) -> QString {
|
||||||
if (QApplication::keyboardModifiers() & modifier) {
|
if (QApplication::keyboardModifiers() & modifier) {
|
||||||
return QString::fromStdString(m_button);
|
return QString::fromStdString(m_button);
|
||||||
} else {
|
} else {
|
||||||
|
@ -641,36 +634,36 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
pressedKeys.insert("z");
|
pressedKeys.insert("z");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_0:
|
case Qt::Key_0:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 0", "0"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp0", "0"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_1:
|
case Qt::Key_1:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 1", "1"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp1", "1"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_2:
|
case Qt::Key_2:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 2", "2"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp2", "2"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_3:
|
case Qt::Key_3:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 3", "3"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp3", "3"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_4:
|
case Qt::Key_4:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 4", "4"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp4", "4"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_5:
|
case Qt::Key_5:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 5", "5"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp5", "5"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_6:
|
case Qt::Key_6:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 6", "6"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp6", "6"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_7:
|
case Qt::Key_7:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 7", "7"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp7", "7"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_8:
|
case Qt::Key_8:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 8", "8"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp8", "8"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_9:
|
case Qt::Key_9:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp 9", "9"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp9", "9"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// symbols
|
// symbols
|
||||||
case Qt::Key_Exclam:
|
case Qt::Key_Exclam:
|
||||||
pressedKeys.insert("!");
|
pressedKeys.insert("!");
|
||||||
|
@ -694,7 +687,7 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
pressedKeys.insert("&");
|
pressedKeys.insert("&");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Asterisk:
|
case Qt::Key_Asterisk:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp *", "*"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp*", "*"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_ParenLeft:
|
case Qt::Key_ParenLeft:
|
||||||
pressedKeys.insert("(");
|
pressedKeys.insert("(");
|
||||||
|
@ -703,16 +696,16 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
pressedKeys.insert(")");
|
pressedKeys.insert(")");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Minus:
|
case Qt::Key_Minus:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp -", "-"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp-", "-"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Underscore:
|
case Qt::Key_Underscore:
|
||||||
pressedKeys.insert("_");
|
pressedKeys.insert("_");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Equal:
|
case Qt::Key_Equal:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp =", "="));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp=", "="));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Plus:
|
case Qt::Key_Plus:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp +", "+"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp+", "+"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_BracketLeft:
|
case Qt::Key_BracketLeft:
|
||||||
pressedKeys.insert("[");
|
pressedKeys.insert("[");
|
||||||
|
@ -745,24 +738,24 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
pressedKeys.insert("\"");
|
pressedKeys.insert("\"");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Comma:
|
case Qt::Key_Comma:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp ,", ","));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp,", ","));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Less:
|
case Qt::Key_Less:
|
||||||
pressedKeys.insert("<");
|
pressedKeys.insert("<");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Period:
|
case Qt::Key_Period:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp .", "."));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp.", "."));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Greater:
|
case Qt::Key_Greater:
|
||||||
pressedKeys.insert(">");
|
pressedKeys.insert(">");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Slash:
|
case Qt::Key_Slash:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp /", "/"));
|
pressedKeys.insert(GetModifiedButton(Qt::KeypadModifier, "kp/", "/"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Question:
|
case Qt::Key_Question:
|
||||||
pressedKeys.insert("question");
|
pressedKeys.insert("question");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// special keys
|
// special keys
|
||||||
case Qt::Key_Print:
|
case Qt::Key_Print:
|
||||||
pressedKeys.insert("printscreen");
|
pressedKeys.insert("printscreen");
|
||||||
|
@ -804,7 +797,7 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
pressedKeys.insert("enter");
|
pressedKeys.insert("enter");
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::ShiftModifier, "kp enter", "enter"));
|
pressedKeys.insert(GetModifiedButton(Qt::ShiftModifier, "kpenter", "enter"));
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Shift:
|
case Qt::Key_Shift:
|
||||||
if (keyEvent->nativeScanCode() == LSHIFT_KEY) {
|
if (keyEvent->nativeScanCode() == LSHIFT_KEY) {
|
||||||
|
@ -851,12 +844,12 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
case Qt::Key_Right:
|
case Qt::Key_Right:
|
||||||
pressedKeys.insert("right");
|
pressedKeys.insert("right");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// cancel mapping
|
// cancel mapping
|
||||||
case Qt::Key_Escape:
|
case Qt::Key_Escape:
|
||||||
pressedKeys.insert("unmapped");
|
pressedKeys.insert("unmapped");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -885,7 +878,7 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
case Qt::XButton2:
|
case Qt::XButton2:
|
||||||
pressedKeys.insert("sidebuttonforward");
|
pressedKeys.insert("sidebuttonforward");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// default case
|
// default case
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -920,16 +913,16 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
|
||||||
if (wheelEvent->angleDelta().x() > 5) {
|
if (wheelEvent->angleDelta().x() > 5) {
|
||||||
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
||||||
// QT changes scrolling to horizontal for all widgets with the alt modifier
|
// QT changes scrolling to horizontal for all widgets with the alt modifier
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::AltModifier,
|
pressedKeys.insert(
|
||||||
"mousewheelup", "mousewheelright"));
|
GetModifiedButton(Qt::AltModifier, "mousewheelup", "mousewheelright"));
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Cannot set mapping"),
|
QMessageBox::information(this, tr("Cannot set mapping"),
|
||||||
tr("Mousewheel cannot be mapped to stick outputs"));
|
tr("Mousewheel cannot be mapped to stick outputs"));
|
||||||
}
|
}
|
||||||
} else if (wheelEvent->angleDelta().x() < -5) {
|
} else if (wheelEvent->angleDelta().x() < -5) {
|
||||||
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
|
||||||
pressedKeys.insert(GetModifiedButton(Qt::AltModifier,
|
pressedKeys.insert(
|
||||||
"mousewheeldown", "mousewheelleft"));
|
GetModifiedButton(Qt::AltModifier, "mousewheeldown", "mousewheelleft"));
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Cannot set mapping"),
|
QMessageBox::information(this, tr("Cannot set mapping"),
|
||||||
tr("Mousewheel cannot be mapped to stick outputs"));
|
tr("Mousewheel cannot be mapped to stick outputs"));
|
||||||
|
|
|
@ -155,7 +155,7 @@ Whitespace doesn't matter, <output>=<input>; is just as valid as <output> = <inp
|
||||||
result += " 'l2'\n";
|
result += " 'l2'\n";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString special() {
|
QString special() {
|
||||||
return R"(
|
return R"(
|
||||||
There are some extra bindings you can put into the config file, that don't correspond to a controller input, but rather something else.
|
There are some extra bindings you can put into the config file, that don't correspond to a controller input, but rather something else.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue