diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index 2b546e1964..26d0846188 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp @@ -78,6 +78,11 @@ QPixmap GetIcon(const Common::UUID& uuid) { QString GetProfileUsernameFromUser(QWidget* parent, const QString& title, const QString& text) { return LimitableInputDialog::GetText(parent, title, text, 1, int(Service::Account::profile_username_size)); } + +QString GetProfileUuidFromUser(QWidget* parent, const QString& title, const QString& text) { + return LimitableInputDialog::GetText(parent, title, text, 0, int(Common::UUID)); +} + } // Anonymous namespace ConfigureProfileManager::ConfigureProfileManager(Core::System& system_, QWidget* parent) @@ -210,7 +215,7 @@ void ConfigureProfileManager::AddUser() { if (username.isEmpty()) return; - auto const uuid_str = GetProfileUsernameFromUser(this, tr("New User UUID"), tr("Enter a UUID (leave empty to autogenerate):")); + auto const uuid_str = GetProfileUuidFromUser(this, tr("New User UUID"), tr("Enter a UUID (optional):")); auto uuid = Common::UUID::MakeRandom(); if (uuid_str.length() > 0) { if (size_t(uuid_str.length()) != uuid.uuid.size()) @@ -226,8 +231,6 @@ void ConfigureProfileManager::AddUser() { void ConfigureProfileManager::RenameUser() { const auto user = tree_view->currentIndex().row(); - const auto uuid = profile_manager.GetUser(user); - ASSERT(uuid); Service::Account::ProfileBase profile{}; if (!profile_manager.GetProfileBase(*uuid, profile)) @@ -238,6 +241,15 @@ void ConfigureProfileManager::RenameUser() { return; } + auto const uuid_str = GetProfileUuidFromUser(this, tr("New User UUID"), tr("Enter a UUID (optional):")); + auto uuid = profile_manager.GetUser(user); + if (uuid_str.length() > 0) { + if (size_t(uuid_str.length()) != uuid.uuid.size()) + return; + for (size_t i = 0; i < size_t(uuid_str.length()); ++i) + uuid.uuid[i] = u8(uuid_str[i].toLatin1()); + } + const auto username_std = new_username.toStdString(); std::fill(profile.username.begin(), profile.username.end(), '\0'); std::copy(username_std.begin(), username_std.end(), profile.username.begin()); @@ -245,10 +257,7 @@ void ConfigureProfileManager::RenameUser() { profile_manager.SetProfileBase(*uuid, profile); profile_manager.WriteUserSaveFile(); - item_model->setItem( - user, 0, - new QStandardItem{GetIcon(*uuid), - FormatUserEntryText(QString::fromStdString(username_std), *uuid)}); + item_model->setItem(user, 0, new QStandardItem{GetIcon(*uuid), FormatUserEntryText(QString::fromStdString(username_std), *uuid)}); UpdateCurrentUser(); }