mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-11 04:35:05 +01:00
add a comment, rename old index
This commit is contained in:
parent
e7b1a1d5c8
commit
3d00beb9d5
@ -97,6 +97,8 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()),
|
||||||
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) {
|
timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()) {
|
||||||
|
|
||||||
|
// If the user closes the dialog, the changes are reverted in `GMainWindow::OnConfigure()`
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
|
|
||||||
@ -136,13 +138,14 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
continue;
|
continue;
|
||||||
button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu);
|
button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(button_map[button_id], &QPushButton::released, [=]() {
|
connect(button_map[button_id], &QPushButton::released, [=]() {
|
||||||
handleClick(button_map[button_id],
|
handleClick(
|
||||||
[=](const Common::ParamPackage& params) {
|
button_map[button_id],
|
||||||
buttons_param[button_id] = params;
|
[=](const Common::ParamPackage& params) {
|
||||||
applyConfiguration();
|
buttons_param[button_id] = params;
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
applyConfiguration();
|
||||||
},
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
InputCommon::Polling::DeviceType::Button);
|
},
|
||||||
|
InputCommon::Polling::DeviceType::Button);
|
||||||
});
|
});
|
||||||
connect(button_map[button_id], &QPushButton::customContextMenuRequested,
|
connect(button_map[button_id], &QPushButton::customContextMenuRequested,
|
||||||
[=](const QPoint& menu_location) {
|
[=](const QPoint& menu_location) {
|
||||||
@ -171,14 +174,15 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy(
|
analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy(
|
||||||
Qt::CustomContextMenu);
|
Qt::CustomContextMenu);
|
||||||
connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::released, [=]() {
|
connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::released, [=]() {
|
||||||
handleClick(analog_map_buttons[analog_id][sub_button_id],
|
handleClick(
|
||||||
[=](const Common::ParamPackage& params) {
|
analog_map_buttons[analog_id][sub_button_id],
|
||||||
SetAnalogButton(params, analogs_param[analog_id],
|
[=](const Common::ParamPackage& params) {
|
||||||
analog_sub_buttons[sub_button_id]);
|
SetAnalogButton(params, analogs_param[analog_id],
|
||||||
applyConfiguration();
|
analog_sub_buttons[sub_button_id]);
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
applyConfiguration();
|
||||||
},
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
InputCommon::Polling::DeviceType::Button);
|
},
|
||||||
|
InputCommon::Polling::DeviceType::Button);
|
||||||
});
|
});
|
||||||
connect(analog_map_buttons[analog_id][sub_button_id],
|
connect(analog_map_buttons[analog_id][sub_button_id],
|
||||||
&QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) {
|
&QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) {
|
||||||
@ -207,13 +211,14 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
QMessageBox::information(this, tr("Information"),
|
QMessageBox::information(this, tr("Information"),
|
||||||
tr("After pressing OK, first move your joystick horizontally, "
|
tr("After pressing OK, first move your joystick horizontally, "
|
||||||
"and then vertically."));
|
"and then vertically."));
|
||||||
handleClick(analog_map_stick[analog_id],
|
handleClick(
|
||||||
[=](const Common::ParamPackage& params) {
|
analog_map_stick[analog_id],
|
||||||
analogs_param[analog_id] = params;
|
[=](const Common::ParamPackage& params) {
|
||||||
applyConfiguration();
|
analogs_param[analog_id] = params;
|
||||||
Settings::SaveProfile(ui->profile->currentIndex());
|
applyConfiguration();
|
||||||
},
|
Settings::SaveProfile(ui->profile->currentIndex());
|
||||||
InputCommon::Polling::DeviceType::Analog);
|
},
|
||||||
|
InputCommon::Polling::DeviceType::Analog);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1326,7 +1326,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
|
connect(&configureDialog, &ConfigureDialog::languageChanged, this,
|
||||||
&GMainWindow::OnLanguageChanged);
|
&GMainWindow::OnLanguageChanged);
|
||||||
auto old_theme = UISettings::values.theme;
|
auto old_theme = UISettings::values.theme;
|
||||||
const int old_input_profile = Settings::values.current_input_profile_index;
|
const int old_input_profile_index = Settings::values.current_input_profile_index;
|
||||||
const auto old_input_profiles = Settings::values.input_profiles;
|
const auto old_input_profiles = Settings::values.input_profiles;
|
||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
||||||
auto result = configureDialog.exec();
|
auto result = configureDialog.exec();
|
||||||
@ -1342,7 +1342,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
config->Save();
|
config->Save();
|
||||||
} else {
|
} else {
|
||||||
Settings::values.input_profiles = old_input_profiles;
|
Settings::values.input_profiles = old_input_profiles;
|
||||||
Settings::LoadProfile(old_input_profile);
|
Settings::LoadProfile(old_input_profile_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user