mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 13:26:30 -05:00
Qt: Fixed behaviour of buttons by connecting functors to correct signals
Following screens got fixes: - Configure/Debug - Configure/Input
This commit is contained in:
parent
9be9600bdc
commit
221250d922
7 changed files with 21 additions and 21 deletions
|
@ -18,7 +18,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
SetConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
connect(ui->open_log_button, &QPushButton::pressed, []() {
|
connect(ui->open_log_button, &QPushButton::clicked, []() {
|
||||||
QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir));
|
QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir));
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,7 +79,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
UpdateUIEnabled();
|
UpdateUIEnabled();
|
||||||
|
|
||||||
connect(ui->restore_defaults_button, &QPushButton::pressed, this,
|
connect(ui->restore_defaults_button, &QPushButton::clicked, this,
|
||||||
&ConfigureInput::RestoreDefaults);
|
&ConfigureInput::RestoreDefaults);
|
||||||
|
|
||||||
for (auto* enabled : players_controller) {
|
for (auto* enabled : players_controller) {
|
||||||
|
@ -96,20 +96,20 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
||||||
&ConfigureInput::UpdateUIEnabled);
|
&ConfigureInput::UpdateUIEnabled);
|
||||||
|
|
||||||
for (std::size_t i = 0; i < players_configure.size(); ++i) {
|
for (std::size_t i = 0; i < players_configure.size(); ++i) {
|
||||||
connect(players_configure[i], &QPushButton::pressed, this,
|
connect(players_configure[i], &QPushButton::clicked, this,
|
||||||
[this, i] { CallConfigureDialog<ConfigureInputPlayer>(*this, i, false); });
|
[this, i] { CallConfigureDialog<ConfigureInputPlayer>(*this, i, false); });
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->handheld_configure, &QPushButton::pressed, this,
|
connect(ui->handheld_configure, &QPushButton::clicked, this,
|
||||||
[this] { CallConfigureDialog<ConfigureInputPlayer>(*this, 8, false); });
|
[this] { CallConfigureDialog<ConfigureInputPlayer>(*this, 8, false); });
|
||||||
|
|
||||||
connect(ui->debug_configure, &QPushButton::pressed, this,
|
connect(ui->debug_configure, &QPushButton::clicked, this,
|
||||||
[this] { CallConfigureDialog<ConfigureInputPlayer>(*this, 9, true); });
|
[this] { CallConfigureDialog<ConfigureInputPlayer>(*this, 9, true); });
|
||||||
|
|
||||||
connect(ui->mouse_advanced, &QPushButton::pressed, this,
|
connect(ui->mouse_advanced, &QPushButton::clicked, this,
|
||||||
[this] { CallConfigureDialog<ConfigureMouseAdvanced>(*this); });
|
[this] { CallConfigureDialog<ConfigureMouseAdvanced>(*this); });
|
||||||
|
|
||||||
connect(ui->touchscreen_advanced, &QPushButton::pressed, this,
|
connect(ui->touchscreen_advanced, &QPushButton::clicked, this,
|
||||||
[this] { CallConfigureDialog<ConfigureTouchscreenAdvanced>(*this); });
|
[this] { CallConfigureDialog<ConfigureTouchscreenAdvanced>(*this); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
}
|
}
|
||||||
|
|
||||||
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(button, &QPushButton::released, [=] {
|
connect(button, &QPushButton::clicked, [=] {
|
||||||
HandleClick(
|
HandleClick(
|
||||||
button_map[button_id],
|
button_map[button_id],
|
||||||
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
||||||
|
@ -273,7 +273,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
}
|
}
|
||||||
|
|
||||||
analog_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
analog_button->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(analog_button, &QPushButton::released, [=]() {
|
connect(analog_button, &QPushButton::clicked, [=]() {
|
||||||
HandleClick(analog_map_buttons[analog_id][sub_button_id],
|
HandleClick(analog_map_buttons[analog_id][sub_button_id],
|
||||||
[=](const Common::ParamPackage& params) {
|
[=](const Common::ParamPackage& params) {
|
||||||
SetAnalogButton(params, analogs_param[analog_id],
|
SetAnalogButton(params, analogs_param[analog_id],
|
||||||
|
@ -300,7 +300,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
menu_location));
|
menu_location));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
connect(analog_map_stick[analog_id], &QPushButton::released, [=] {
|
connect(analog_map_stick[analog_id], &QPushButton::clicked, [=] {
|
||||||
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."));
|
||||||
|
@ -311,8 +311,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
|
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
|
||||||
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this] { RestoreDefaults(); });
|
connect(ui->buttonRestoreDefaults, &QPushButton::clicked, [this] { RestoreDefaults(); });
|
||||||
|
|
||||||
timeout_timer->setSingleShot(true);
|
timeout_timer->setSingleShot(true);
|
||||||
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
|
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
|
||||||
|
|
|
@ -101,7 +101,7 @@ ConfigureInputSimple::ConfigureInputSimple(QWidget* parent)
|
||||||
|
|
||||||
connect(ui->profile_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(ui->profile_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&ConfigureInputSimple::OnSelectProfile);
|
&ConfigureInputSimple::OnSelectProfile);
|
||||||
connect(ui->profile_configure, &QPushButton::pressed, this, &ConfigureInputSimple::OnConfigure);
|
connect(ui->profile_configure, &QPushButton::clicked, this, &ConfigureInputSimple::OnConfigure);
|
||||||
|
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
button->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(button, &QPushButton::released, [=] {
|
connect(button, &QPushButton::clicked, [=] {
|
||||||
HandleClick(
|
HandleClick(
|
||||||
button_map[button_id],
|
button_map[button_id],
|
||||||
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
[=](const Common::ParamPackage& params) { buttons_param[button_id] = params; },
|
||||||
|
@ -104,8 +104,8 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
|
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
|
||||||
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this] { RestoreDefaults(); });
|
connect(ui->buttonRestoreDefaults, &QPushButton::clicked, [this] { RestoreDefaults(); });
|
||||||
|
|
||||||
timeout_timer->setSingleShot(true);
|
timeout_timer->setSingleShot(true);
|
||||||
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
|
connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
|
||||||
|
|
|
@ -108,10 +108,10 @@ ConfigureProfileManager ::ConfigureProfileManager(QWidget* parent)
|
||||||
|
|
||||||
connect(tree_view, &QTreeView::clicked, this, &ConfigureProfileManager::SelectUser);
|
connect(tree_view, &QTreeView::clicked, this, &ConfigureProfileManager::SelectUser);
|
||||||
|
|
||||||
connect(ui->pm_add, &QPushButton::pressed, this, &ConfigureProfileManager::AddUser);
|
connect(ui->pm_add, &QPushButton::clicked, this, &ConfigureProfileManager::AddUser);
|
||||||
connect(ui->pm_rename, &QPushButton::pressed, this, &ConfigureProfileManager::RenameUser);
|
connect(ui->pm_rename, &QPushButton::clicked, this, &ConfigureProfileManager::RenameUser);
|
||||||
connect(ui->pm_remove, &QPushButton::pressed, this, &ConfigureProfileManager::DeleteUser);
|
connect(ui->pm_remove, &QPushButton::clicked, this, &ConfigureProfileManager::DeleteUser);
|
||||||
connect(ui->pm_set_image, &QPushButton::pressed, this, &ConfigureProfileManager::SetUserImage);
|
connect(ui->pm_set_image, &QPushButton::clicked, this, &ConfigureProfileManager::SetUserImage);
|
||||||
|
|
||||||
scene = new QGraphicsScene;
|
scene = new QGraphicsScene;
|
||||||
ui->current_user_icon->setScene(scene);
|
ui->current_user_icon->setScene(scene);
|
||||||
|
|
|
@ -11,7 +11,7 @@ ConfigureTouchscreenAdvanced::ConfigureTouchscreenAdvanced(QWidget* parent)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchscreenAdvanced>()) {
|
: QDialog(parent), ui(std::make_unique<Ui::ConfigureTouchscreenAdvanced>()) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
connect(ui->restore_defaults_button, &QPushButton::pressed, this,
|
connect(ui->restore_defaults_button, &QPushButton::clicked, this,
|
||||||
&ConfigureTouchscreenAdvanced::RestoreDefaults);
|
&ConfigureTouchscreenAdvanced::RestoreDefaults);
|
||||||
|
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
|
|
Loading…
Reference in a new issue