Qt/input: move preview_values into callback

This commit is contained in:
Megamouse 2024-08-08 02:02:57 +02:00
parent 3ef8046f5c
commit 28781d9bfb
4 changed files with 16 additions and 10 deletions

View File

@ -290,13 +290,13 @@ PadHandlerBase::connection PadHandlerBase::get_next_button_press(const std::stri
if (callback)
{
const pad_preview_values preview_values = get_preview_values(data);
pad_preview_values preview_values = get_preview_values(data);
const u32 battery_level = get_battery_level(pad_id);
if (pressed_button.value > 0)
callback(pressed_button.value, pressed_button.name, pad_id, battery_level, preview_values);
callback(pressed_button.value, pressed_button.name, pad_id, battery_level, std::move(preview_values));
else
callback(0, "", pad_id, battery_level, preview_values);
callback(0, "", pad_id, battery_level, std::move(preview_values));
}
return status;

View File

@ -483,9 +483,9 @@ PadHandlerBase::connection evdev_joystick_handler::get_next_button_press(const s
if (callback)
{
if (pressed_button.value > 0)
callback(pressed_button.value, pressed_button.name, padId, 0, preview_values);
callback(pressed_button.value, pressed_button.name, padId, 0, std::move(preview_values));
else
callback(0, "", padId, 0, preview_values);
callback(0, "", padId, 0, std::move(preview_values));
}
return connection::connected;

View File

@ -379,9 +379,9 @@ PadHandlerBase::connection mm_joystick_handler::get_next_button_press(const std:
}
if (pressed_button.value > 0)
callback(pressed_button.value, pressed_button.name, padId, 0, preview_values);
callback(pressed_button.value, pressed_button.name, padId, 0, std::move(preview_values));
else
callback(0, "", padId, 0, preview_values);
callback(0, "", padId, 0, std::move(preview_values));
}
return connection::connected;

View File

@ -575,9 +575,15 @@ void pad_settings_dialog::InitButtons()
const std::vector<std::string> buttons =
{
m_cfg_entries[button_ids::id_pad_l2].keys, m_cfg_entries[button_ids::id_pad_r2].keys, m_cfg_entries[button_ids::id_pad_lstick_left].keys,
m_cfg_entries[button_ids::id_pad_lstick_right].keys, m_cfg_entries[button_ids::id_pad_lstick_down].keys, m_cfg_entries[button_ids::id_pad_lstick_up].keys,
m_cfg_entries[button_ids::id_pad_rstick_left].keys, m_cfg_entries[button_ids::id_pad_rstick_right].keys, m_cfg_entries[button_ids::id_pad_rstick_down].keys,
m_cfg_entries[button_ids::id_pad_l2].keys,
m_cfg_entries[button_ids::id_pad_r2].keys,
m_cfg_entries[button_ids::id_pad_lstick_left].keys,
m_cfg_entries[button_ids::id_pad_lstick_right].keys,
m_cfg_entries[button_ids::id_pad_lstick_down].keys,
m_cfg_entries[button_ids::id_pad_lstick_up].keys,
m_cfg_entries[button_ids::id_pad_rstick_left].keys,
m_cfg_entries[button_ids::id_pad_rstick_right].keys,
m_cfg_entries[button_ids::id_pad_rstick_down].keys,
m_cfg_entries[button_ids::id_pad_rstick_up].keys
};