diff options
| author | Zach Hilman <zachhilman@gmail.com> | 2018-10-24 09:25:13 -0400 | 
|---|---|---|
| committer | Zach Hilman <zachhilman@gmail.com> | 2018-10-24 09:25:20 -0400 | 
| commit | e7ac42677be6c13e5286fb42004aa94b0da45391 (patch) | |
| tree | 91982bf07856c1de33d99f7187665b5c481be04f | |
| parent | bfad41b0c12a308b0a5a10e3162d74140e3c121a (diff) | |
configure_system: Clear current username before overwriting
Prevents bug where old username would remain if the new username was shorter in length.
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 14 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.h | 6 | 
2 files changed, 15 insertions, 5 deletions
| diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index a88fabc36..83cc49dfc 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -15,6 +15,7 @@  #include "common/logging/backend.h"  #include "common/string_util.h"  #include "core/core.h" +#include "core/hle/service/acc/profile_manager.h"  #include "core/settings.h"  #include "ui_configure_system.h"  #include "yuzu/configuration/configure_system.h" @@ -266,6 +267,7 @@ void ConfigureSystem::RenameUser() {      if (!ok)          return; +    std::fill(profile.username.begin(), profile.username.end(), '\0');      const auto username_std = new_username.toStdString();      if (username_std.size() > profile.username.size()) {          std::copy_n(username_std.begin(), std::min(profile.username.size(), username_std.size()), @@ -280,7 +282,10 @@ void ConfigureSystem::RenameUser() {          user, 0,          new QStandardItem{              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();  } @@ -290,9 +295,10 @@ void ConfigureSystem::DeleteUser() {      ASSERT(uuid != boost::none);      const auto username = GetAccountUsername(*uuid); -    const auto confirm = QMessageBox::question( -        this, tr("Confirm Delete"), -        tr("You are about to delete user with name %1. Are you sure?").arg(username.c_str())); +    const auto confirm = +        QMessageBox::question(this, tr("Confirm Delete"), +                              tr("You are about to delete user with name %1. Are you sure?") +                                  .arg(QString::fromStdString(username)));      if (confirm == QMessageBox::No)          return; diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index 6adadfccf..b73e0719c 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h @@ -8,7 +8,11 @@  #include <QList>  #include <QWidget> -#include "core/hle/service/acc/profile_manager.h" + +namespace Service::Account { +class ProfileManager; +struct UUID; +} // namespace Service::Account  class QGraphicsScene;  class QStandardItem; | 
