diff options
| -rw-r--r-- | src/yuzu/applets/profile_select.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/applets/profile_select.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 26 |
3 files changed, 20 insertions, 16 deletions
diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/profile_select.cpp index dca8835ed..68b76269d 100644 --- a/src/yuzu/applets/profile_select.cpp +++ b/src/yuzu/applets/profile_select.cpp | |||
| @@ -114,6 +114,15 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent) | |||
| 114 | 114 | ||
| 115 | QtProfileSelectionDialog::~QtProfileSelectionDialog() = default; | 115 | QtProfileSelectionDialog::~QtProfileSelectionDialog() = default; |
| 116 | 116 | ||
| 117 | int QtProfileSelectionDialog::exec() { | ||
| 118 | // Skip profile selection when there's only one. | ||
| 119 | if (profile_manager->GetUserCount() == 1) { | ||
| 120 | user_index = 0; | ||
| 121 | return QDialog::Accepted; | ||
| 122 | } | ||
| 123 | QDialog::exec(); | ||
| 124 | } | ||
| 125 | |||
| 117 | void QtProfileSelectionDialog::accept() { | 126 | void QtProfileSelectionDialog::accept() { |
| 118 | QDialog::accept(); | 127 | QDialog::accept(); |
| 119 | } | 128 | } |
diff --git a/src/yuzu/applets/profile_select.h b/src/yuzu/applets/profile_select.h index cee886a77..29c33cca0 100644 --- a/src/yuzu/applets/profile_select.h +++ b/src/yuzu/applets/profile_select.h | |||
| @@ -27,6 +27,7 @@ public: | |||
| 27 | explicit QtProfileSelectionDialog(QWidget* parent); | 27 | explicit QtProfileSelectionDialog(QWidget* parent); |
| 28 | ~QtProfileSelectionDialog() override; | 28 | ~QtProfileSelectionDialog() override; |
| 29 | 29 | ||
| 30 | int exec() override; | ||
| 30 | void accept() override; | 31 | void accept() override; |
| 31 | void reject() override; | 32 | void reject() override; |
| 32 | 33 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e3de0f0e1..18e68e590 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -303,24 +303,18 @@ void GMainWindow::ControllerSelectorReconfigureControllers( | |||
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | void GMainWindow::ProfileSelectorSelectProfile() { | 305 | void GMainWindow::ProfileSelectorSelectProfile() { |
| 306 | const Service::Account::ProfileManager manager; | 306 | QtProfileSelectionDialog dialog(this); |
| 307 | int index = 0; | 307 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | |
| 308 | if (manager.GetUserCount() != 1) { | 308 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | |
| 309 | QtProfileSelectionDialog dialog(this); | 309 | Qt::WindowCloseButtonHint); |
| 310 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | | 310 | dialog.setWindowModality(Qt::WindowModal); |
| 311 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | | 311 | if (dialog.exec() == QDialog::Rejected) { |
| 312 | Qt::WindowCloseButtonHint); | 312 | emit ProfileSelectorFinishedSelection(std::nullopt); |
| 313 | dialog.setWindowModality(Qt::WindowModal); | 313 | return; |
| 314 | |||
| 315 | if (dialog.exec() == QDialog::Rejected) { | ||
| 316 | emit ProfileSelectorFinishedSelection(std::nullopt); | ||
| 317 | return; | ||
| 318 | } | ||
| 319 | |||
| 320 | index = dialog.GetIndex(); | ||
| 321 | } | 314 | } |
| 322 | 315 | ||
| 323 | const auto uuid = manager.GetUser(static_cast<std::size_t>(index)); | 316 | const Service::Account::ProfileManager manager; |
| 317 | const auto uuid = manager.GetUser(static_cast<std::size_t>(dialog.GetIndex())); | ||
| 324 | if (!uuid.has_value()) { | 318 | if (!uuid.has_value()) { |
| 325 | emit ProfileSelectorFinishedSelection(std::nullopt); | 319 | emit ProfileSelectorFinishedSelection(std::nullopt); |
| 326 | return; | 320 | return; |