forked from ShuriZma/suyu
1
0
Fork 0

Controller bugfixes in profile select (#8716)

* Controller bugfixes in profile select, closes #8265

2 fixes for using a controller in profile select dialog.

Pressing 'B' cancels the launch of the game
Using controller to select a profile now correctly sets the index to use for the launch

* Added brackets to if statements as requested.
This commit is contained in:
Steve 2022-08-05 08:02:04 -07:00 committed by GitHub
parent 1f7e62e86e
commit cd5bbf0f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -100,6 +100,7 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core,
} }
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier); QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
QCoreApplication::postEvent(tree_view, event); QCoreApplication::postEvent(tree_view, event);
SelectUser(tree_view->currentIndex());
}); });
const auto& profiles = profile_manager->GetAllUsers(); const auto& profiles = profile_manager->GetAllUsers();

View File

@ -1588,17 +1588,18 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
return true; return true;
} }
void GMainWindow::SelectAndSetCurrentUser() { bool GMainWindow::SelectAndSetCurrentUser() {
QtProfileSelectionDialog dialog(system->HIDCore(), this); QtProfileSelectionDialog dialog(system->HIDCore(), this);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal); dialog.setWindowModality(Qt::WindowModal);
if (dialog.exec() == QDialog::Rejected) { if (dialog.exec() == QDialog::Rejected) {
return; return false;
} }
Settings::values.current_user = dialog.GetIndex(); Settings::values.current_user = dialog.GetIndex();
return true;
} }
void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index, void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
@ -1632,11 +1633,14 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
Settings::LogSettings(); Settings::LogSettings();
if (UISettings::values.select_user_on_boot) { if (UISettings::values.select_user_on_boot) {
SelectAndSetCurrentUser(); if (SelectAndSetCurrentUser() == false) {
return;
}
} }
if (!LoadROM(filename, program_id, program_index)) if (!LoadROM(filename, program_id, program_index)) {
return; return;
}
system->SetShuttingDown(false); system->SetShuttingDown(false);

View File

@ -218,7 +218,7 @@ private:
void SetDiscordEnabled(bool state); void SetDiscordEnabled(bool state);
void LoadAmiibo(const QString& filename); void LoadAmiibo(const QString& filename);
void SelectAndSetCurrentUser(); bool SelectAndSetCurrentUser();
/** /**
* Stores the filename in the recently loaded files list. * Stores the filename in the recently loaded files list.