Qt/Input: use 1-n in the GUI instead of 1-(n-1)

I didn't look into evdev
This commit is contained in:
Megamouse 2018-12-22 12:49:56 +01:00
parent 91d834ce73
commit 6e323622a5
4 changed files with 6 additions and 6 deletions

View File

@ -262,7 +262,7 @@ std::shared_ptr<ds4_pad_handler::DS4Device> ds4_pad_handler::GetDevice(const std
std::string pad_serial = padId.substr(pos + 9);
std::shared_ptr<DS4Device> device = nullptr;
int i = 0;
int i = 1; // Controllers 1-n in GUI
for (auto& cur_control : controllers)
{
if (pad_serial == std::to_string(i++) || pad_serial == cur_control.first)
@ -770,7 +770,7 @@ std::vector<std::string> ds4_pad_handler::ListDevices()
if (!Init())
return ds4_pads_list;
for (size_t i = 0; i < controllers.size(); ++i)
for (size_t i = 1; i <= controllers.size(); ++i) // Controllers 1-n in GUI
{
ds4_pads_list.emplace_back(m_name_string + std::to_string(i));
}

View File

@ -579,7 +579,7 @@ bool mm_joystick_handler::GetMMJOYDevice(int index, MMJOYDevice* dev)
LOG_NOTICE(GENERAL, "Joystick nr.%d found. Driver: %s", index, drv);
dev->device_id = index;
dev->device_name = m_name_string + std::to_string(index);
dev->device_name = m_name_string + std::to_string(index + 1); // Controllers 1-n in GUI
dev->device_info = js_info;
dev->device_caps = js_caps;

View File

@ -795,7 +795,7 @@ void pad_settings_dialog::ChangeInputType()
case pad_handler::xinput:
{
const QString name_string = qstr(m_handler->name_string());
for (int i = 0; i < m_handler->max_devices(); i++)
for (int i = 1; i <= m_handler->max_devices(); i++) // Controllers 1-n in GUI
{
ui->chooseDevice->addItem(name_string + QString::number(i), i);
}

View File

@ -197,7 +197,7 @@ int xinput_pad_handler::GetDeviceNumber(const std::string& padId)
if (pos == std::string::npos)
return -1;
int device_number = std::stoul(padId.substr(pos + 12));
int device_number = std::stoul(padId.substr(pos + 12)) - 1; // Controllers 1-n in GUI
if (device_number >= XUSER_MAX_COUNT)
return -1;
@ -455,7 +455,7 @@ std::vector<std::string> xinput_pad_handler::ListDevices()
XINPUT_STATE state;
DWORD result = (*xinputGetState)(i, &state);
if (result == ERROR_SUCCESS)
xinput_pads_list.push_back(m_name_string + std::to_string(i));
xinput_pads_list.push_back(m_name_string + std::to_string(i + 1)); // Controllers 1-n in GUI
}
return xinput_pads_list;
}