qt: Use ProfileSelectionDialog when selecting user for save data
This allows us to present a much nicer UI to the user over a simple combo box and is made easy with the modular nature of the profile-selection applet frontend.
This commit is contained in:
parent
9a22a94a51
commit
9c2d83cb9c
|
@ -827,31 +827,25 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
||||||
const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
|
const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
|
||||||
ASSERT(program_id != 0);
|
ASSERT(program_id != 0);
|
||||||
|
|
||||||
Service::Account::ProfileManager manager{};
|
const auto select_profile = [this]() -> s32 {
|
||||||
const auto user_ids = manager.GetAllUsers();
|
QtProfileSelectionDialog dialog(this);
|
||||||
QStringList list;
|
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
|
||||||
for (const auto& user_id : user_ids) {
|
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
||||||
if (user_id == Service::Account::UUID{})
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
continue;
|
dialog.exec();
|
||||||
Service::Account::ProfileBase base;
|
|
||||||
if (!manager.GetProfileBase(user_id, base))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
list.push_back(QString::fromStdString(Common::StringFromFixedZeroTerminatedBuffer(
|
if (!dialog.GetStatus()) {
|
||||||
reinterpret_cast<const char*>(base.username.data()), base.username.size())));
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
return dialog.GetIndex();
|
||||||
const auto index_string =
|
};
|
||||||
QInputDialog::getItem(this, tr("Select User"),
|
|
||||||
tr("Please select the user's save data you would like to open."),
|
const auto index = select_profile();
|
||||||
list, Settings::values.current_user, false, &ok);
|
if (index == -1)
|
||||||
if (!ok)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto index = list.indexOf(index_string);
|
Service::Account::ProfileManager manager;
|
||||||
ASSERT(index != -1 && index < 8);
|
|
||||||
|
|
||||||
const auto user_id = manager.GetUser(index);
|
const auto user_id = manager.GetUser(index);
|
||||||
ASSERT(user_id);
|
ASSERT(user_id);
|
||||||
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
|
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
|
||||||
|
|
Loading…
Reference in New Issue