C-style cast cleanup VII

This commit is contained in:
Nekotekina 2019-12-04 23:56:19 +03:00
parent d2fd3c6bc4
commit 835892aa51
42 changed files with 336 additions and 233 deletions

View file

@ -55,7 +55,7 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent, const GameInfo *game)
// load input config
g_cfg_input.from_default();
if (game)
{
m_title_id = game->serial;
@ -508,9 +508,9 @@ void pad_settings_dialog::ReloadButtons()
updateButton(button_ids::id_pad_rstick_right, ui->b_rstick_right, &m_handler_cfg.rs_right);
updateButton(button_ids::id_pad_rstick_up, ui->b_rstick_up, &m_handler_cfg.rs_up);
ui->chb_vibration_large->setChecked((bool)m_handler_cfg.enable_vibration_motor_large);
ui->chb_vibration_small->setChecked((bool)m_handler_cfg.enable_vibration_motor_small);
ui->chb_vibration_switch->setChecked((bool)m_handler_cfg.switch_vibration_motors);
ui->chb_vibration_large->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_large));
ui->chb_vibration_small->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_small));
ui->chb_vibration_switch->setChecked(static_cast<bool>(m_handler_cfg.switch_vibration_motors));
m_min_force = m_handler->vibration_min;
m_max_force = m_handler->vibration_max;
@ -529,20 +529,20 @@ void pad_settings_dialog::ReloadButtons()
// Enable Mouse Acceleration
std::vector<std::string> mouse_accel_range_x = m_handler_cfg.mouse_acceleration_x.to_list();
ui->mouse_accel_x->setRange(std::stod(mouse_accel_range_x.front()) / 100.0, std::stod(mouse_accel_range_x.back()) / 100.0);
ui->mouse_accel_x->setValue((double)m_handler_cfg.mouse_acceleration_x / 100.0);
ui->mouse_accel_x->setValue(m_handler_cfg.mouse_acceleration_x / 100.0);
std::vector<std::string> mouse_accel_range_y = m_handler_cfg.mouse_acceleration_y.to_list();
ui->mouse_accel_y->setRange(std::stod(mouse_accel_range_y.front()) / 100.0, std::stod(mouse_accel_range_y.back()) / 100.0);
ui->mouse_accel_y->setValue((double)m_handler_cfg.mouse_acceleration_y / 100.0);
ui->mouse_accel_y->setValue(m_handler_cfg.mouse_acceleration_y / 100.0);
// Enable Stick Lerp Factors
std::vector<std::string> left_stick_lerp_range = m_handler_cfg.l_stick_lerp_factor.to_list();
ui->left_stick_lerp->setRange(std::stod(left_stick_lerp_range.front()) / 100.0, std::stod(left_stick_lerp_range.back()) / 100.0);
ui->left_stick_lerp->setValue((double)m_handler_cfg.l_stick_lerp_factor / 100.0);
ui->left_stick_lerp->setValue(m_handler_cfg.l_stick_lerp_factor / 100.0);
std::vector<std::string> right_stick_lerp_range = m_handler_cfg.r_stick_lerp_factor.to_list();
ui->right_stick_lerp->setRange(std::stod(right_stick_lerp_range.front()) / 100.0, std::stod(right_stick_lerp_range.back()) / 100.0);
ui->right_stick_lerp->setValue((double)m_handler_cfg.r_stick_lerp_factor / 100.0);
ui->right_stick_lerp->setValue(m_handler_cfg.r_stick_lerp_factor / 100.0);
// Enable Vibration Checkboxes
m_enable_rumble = m_handler->has_rumble();
@ -660,7 +660,7 @@ void pad_settings_dialog::keyPressEvent(QKeyEvent *keyEvent)
}
else
{
m_cfg_entries[m_button_id].key = ((keyboard_pad_handler*)m_handler.get())->GetKeyName(keyEvent);
m_cfg_entries[m_button_id].key = (static_cast<keyboard_pad_handler*>(m_handler.get()))->GetKeyName(keyEvent);
m_cfg_entries[m_button_id].text = qstr(m_cfg_entries[m_button_id].key);
}
@ -685,7 +685,7 @@ void pad_settings_dialog::mouseReleaseEvent(QMouseEvent* event)
}
else
{
m_cfg_entries[m_button_id].key = ((keyboard_pad_handler*)m_handler.get())->GetMouseName(event);
m_cfg_entries[m_button_id].key = (static_cast<keyboard_pad_handler*>(m_handler.get()))->GetMouseName(event);
m_cfg_entries[m_button_id].text = qstr(m_cfg_entries[m_button_id].key);
}
@ -735,7 +735,7 @@ void pad_settings_dialog::mouseMoveEvent(QMouseEvent* /*event*/)
if (key != 0)
{
m_cfg_entries[m_button_id].key = ((keyboard_pad_handler*)m_handler.get())->GetMouseName(key);
m_cfg_entries[m_button_id].key = (static_cast<keyboard_pad_handler*>(m_handler.get()))->GetMouseName(key);
m_cfg_entries[m_button_id].text = qstr(m_cfg_entries[m_button_id].key);
ReactivateButtons();
}
@ -751,7 +751,7 @@ bool pad_settings_dialog::eventFilter(QObject* object, QEvent* event)
}
if (event->type() == QEvent::MouseMove)
{
mouseMoveEvent((QMouseEvent*)event);
mouseMoveEvent(static_cast<QMouseEvent*>(event));
}
return QDialog::eventFilter(object, event);
}
@ -762,9 +762,9 @@ void pad_settings_dialog::UpdateLabel(bool is_reset)
{
if (m_handler->has_rumble())
{
ui->chb_vibration_large->setChecked((bool)m_handler_cfg.enable_vibration_motor_large);
ui->chb_vibration_small->setChecked((bool)m_handler_cfg.enable_vibration_motor_small);
ui->chb_vibration_switch->setChecked((bool)m_handler_cfg.switch_vibration_motors);
ui->chb_vibration_large->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_large));
ui->chb_vibration_small->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_small));
ui->chb_vibration_switch->setChecked(static_cast<bool>(m_handler_cfg.switch_vibration_motors));
}
if (m_handler->has_deadzones())
@ -1091,28 +1091,28 @@ void pad_settings_dialog::ChangeProfile()
switch (m_handler->m_type)
{
case pad_handler::null:
((NullPadHandler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<NullPadHandler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
case pad_handler::keyboard:
((keyboard_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<keyboard_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
case pad_handler::ds3:
((ds3_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<ds3_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
case pad_handler::ds4:
((ds4_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<ds4_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
#ifdef _WIN32
case pad_handler::xinput:
((xinput_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<xinput_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
case pad_handler::mm:
((mm_joystick_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<mm_joystick_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
#endif
#ifdef HAVE_LIBEVDEV
case pad_handler::evdev:
((evdev_joystick_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
static_cast<evdev_joystick_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
break;
#endif
default: