From a59ad9246b346e9e37797a306f1a1a3500900ad3 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sat, 11 Jul 2020 16:08:34 +0200 Subject: main/profile_select: Don't prompt for profile selection when only one is available --- src/yuzu/main.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 4d501a8f9..ab4b0e4e5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -278,17 +278,21 @@ GMainWindow::~GMainWindow() { } void GMainWindow::ProfileSelectorSelectProfile() { - QtProfileSelectionDialog dialog(this); - dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | - Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); - dialog.setWindowModality(Qt::WindowModal); - if (dialog.exec() == QDialog::Rejected) { - emit ProfileSelectorFinishedSelection(std::nullopt); - return; + const Service::Account::ProfileManager manager; + int index = 0; + if (manager.GetUserCount() != 1) { + QtProfileSelectionDialog dialog(this); + dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | + Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); + dialog.setWindowModality(Qt::WindowModal); + if (dialog.exec() == QDialog::Rejected) { + emit ProfileSelectorFinishedSelection(std::nullopt); + return; + } + index = dialog.GetIndex(); } - Service::Account::ProfileManager manager; - const auto uuid = manager.GetUser(static_cast(dialog.GetIndex())); + const auto uuid = manager.GetUser(static_cast(index)); if (!uuid.has_value()) { emit ProfileSelectorFinishedSelection(std::nullopt); return; -- cgit v1.2.3