summaryrefslogtreecommitdiffstats
path: root/src/yuzu
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-01-03 03:05:02 +0100
committerGitHub <noreply@github.com>2019-01-03 03:05:02 +0100
commit11f990975c4e7fc8d34480703bdba28d650e56cb (patch)
treec8ab0a02ff074a70bfbdd139e44cf1fa5cbd0f55 /src/yuzu
parentMerge pull request #1977 from lioncash/vi-log (diff)
parentqt: Use ProfileSelectionDialog when selecting user for save data (diff)
downloadyuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.tar
yuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.tar.gz
yuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.tar.bz2
yuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.tar.lz
yuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.tar.xz
yuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.tar.zst
yuzu-11f990975c4e7fc8d34480703bdba28d650e56cb.zip
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/main.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 01a0f94ab..bd7b08007 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -827,31 +827,25 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
ASSERT(program_id != 0);
- Service::Account::ProfileManager manager{};
- const auto user_ids = manager.GetAllUsers();
- QStringList list;
- for (const auto& user_id : user_ids) {
- if (user_id == Service::Account::UUID{})
- continue;
- Service::Account::ProfileBase base;
- if (!manager.GetProfileBase(user_id, base))
- continue;
-
- list.push_back(QString::fromStdString(Common::StringFromFixedZeroTerminatedBuffer(
- reinterpret_cast<const char*>(base.username.data()), base.username.size())));
- }
+ const auto select_profile = [this]() -> s32 {
+ QtProfileSelectionDialog dialog(this);
+ dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
+ Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
+ dialog.setWindowModality(Qt::WindowModal);
+ dialog.exec();
+
+ if (!dialog.GetStatus()) {
+ return -1;
+ }
- bool ok = false;
- const auto index_string =
- QInputDialog::getItem(this, tr("Select User"),
- tr("Please select the user's save data you would like to open."),
- list, Settings::values.current_user, false, &ok);
- if (!ok)
- return;
+ return dialog.GetIndex();
+ };
- const auto index = list.indexOf(index_string);
- ASSERT(index != -1 && index < 8);
+ const auto index = select_profile();
+ if (index == -1)
+ return;
+ Service::Account::ProfileManager manager;
const auto user_id = manager.GetUser(index);
ASSERT(user_id);
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,