mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 14:02:58 +00:00
configure_system: Clear current username before overwriting
Prevents bug where old username would remain if the new username was shorter in length.
This commit is contained in:
parent
bfad41b0c1
commit
e7ac42677b
|
@ -15,6 +15,7 @@
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
#include "core/hle/service/acc/profile_manager.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "ui_configure_system.h"
|
#include "ui_configure_system.h"
|
||||||
#include "yuzu/configuration/configure_system.h"
|
#include "yuzu/configuration/configure_system.h"
|
||||||
|
@ -266,6 +267,7 @@ void ConfigureSystem::RenameUser() {
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
std::fill(profile.username.begin(), profile.username.end(), '\0');
|
||||||
const auto username_std = new_username.toStdString();
|
const auto username_std = new_username.toStdString();
|
||||||
if (username_std.size() > profile.username.size()) {
|
if (username_std.size() > profile.username.size()) {
|
||||||
std::copy_n(username_std.begin(), std::min(profile.username.size(), username_std.size()),
|
std::copy_n(username_std.begin(), std::min(profile.username.size(), username_std.size()),
|
||||||
|
@ -280,7 +282,10 @@ void ConfigureSystem::RenameUser() {
|
||||||
user, 0,
|
user, 0,
|
||||||
new QStandardItem{
|
new QStandardItem{
|
||||||
GetIcon(*uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
GetIcon(*uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
QString::fromStdString(username_std + '\n' + uuid->FormatSwitch())});
|
tr("%1\n%2", "%1 is the profile username, %2 is the formatted UUID (e.g. "
|
||||||
|
"00112233-4455-6677-8899-AABBCCDDEEFF))")
|
||||||
|
.arg(QString::fromStdString(username_std),
|
||||||
|
QString::fromStdString(uuid->FormatSwitch()))});
|
||||||
UpdateCurrentUser();
|
UpdateCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,9 +295,10 @@ void ConfigureSystem::DeleteUser() {
|
||||||
ASSERT(uuid != boost::none);
|
ASSERT(uuid != boost::none);
|
||||||
const auto username = GetAccountUsername(*uuid);
|
const auto username = GetAccountUsername(*uuid);
|
||||||
|
|
||||||
const auto confirm = QMessageBox::question(
|
const auto confirm =
|
||||||
this, tr("Confirm Delete"),
|
QMessageBox::question(this, tr("Confirm Delete"),
|
||||||
tr("You are about to delete user with name %1. Are you sure?").arg(username.c_str()));
|
tr("You are about to delete user with name %1. Are you sure?")
|
||||||
|
.arg(QString::fromStdString(username)));
|
||||||
|
|
||||||
if (confirm == QMessageBox::No)
|
if (confirm == QMessageBox::No)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,7 +8,11 @@
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "core/hle/service/acc/profile_manager.h"
|
|
||||||
|
namespace Service::Account {
|
||||||
|
class ProfileManager;
|
||||||
|
struct UUID;
|
||||||
|
} // namespace Service::Account
|
||||||
|
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
class QStandardItem;
|
class QStandardItem;
|
||||||
|
|
Loading…
Reference in a new issue