mirror of
https://github.com/RPCS3/rpcs3
synced 2024-11-02 11:45:30 +00:00
input/qt: Keep configured raw mouse device in list even if it is not connected
This commit is contained in:
parent
13673d2c79
commit
58863c0c41
1 changed files with 18 additions and 1 deletions
|
@ -154,6 +154,8 @@ void raw_mouse_settings_dialog::add_tabs(QTabWidget* tabs)
|
||||||
QGridLayout* grid_layout = new QGridLayout(this);
|
QGridLayout* grid_layout = new QGridLayout(this);
|
||||||
|
|
||||||
auto& config = ::at32(g_cfg_raw_mouse.players, player);
|
auto& config = ::at32(g_cfg_raw_mouse.players, player);
|
||||||
|
const QString current_device = QString::fromStdString(config->device.to_string());
|
||||||
|
bool found_device = false;
|
||||||
|
|
||||||
QHBoxLayout* h_layout = new QHBoxLayout(this);
|
QHBoxLayout* h_layout = new QHBoxLayout(this);
|
||||||
QGroupBox* gb = new QGroupBox(tr("Device"), this);
|
QGroupBox* gb = new QGroupBox(tr("Device"), this);
|
||||||
|
@ -165,8 +167,23 @@ void raw_mouse_settings_dialog::add_tabs(QTabWidget* tabs)
|
||||||
const QString name = QString::fromStdString(mouse.device_name());
|
const QString name = QString::fromStdString(mouse.device_name());
|
||||||
const QString& pretty_name = name; // Same ugly device path for now
|
const QString& pretty_name = name; // Same ugly device path for now
|
||||||
combo->addItem(pretty_name, name);
|
combo->addItem(pretty_name, name);
|
||||||
|
|
||||||
|
if (current_device == name)
|
||||||
|
{
|
||||||
|
found_device = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
combo->setCurrentText(QString::fromStdString(config->device.to_string()));
|
|
||||||
|
// Keep configured device in list even if it is not connected
|
||||||
|
if (!found_device && !current_device.isEmpty())
|
||||||
|
{
|
||||||
|
const QString& pretty_name = current_device; // Same ugly device path for now
|
||||||
|
combo->addItem(pretty_name, current_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select index
|
||||||
|
combo->setCurrentIndex(std::max(0, combo->findData(current_device)));
|
||||||
|
|
||||||
connect(combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, player, combo](int index)
|
connect(combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, player, combo](int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || !combo)
|
if (index < 0 || !combo)
|
||||||
|
|
Loading…
Reference in a new issue