summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp2
-rw-r--r--src/yuzu/configuration/configure_system.cpp28
2 files changed, 18 insertions, 12 deletions
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index b0ea06b48..43743d39e 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -323,7 +323,7 @@ void ProfileManager::WriteUserSaveFile() {
323 323
324 FileUtil::IOFile save(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + 324 FileUtil::IOFile save(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
325 "/system/save/8000000000000010/su/avators/profiles.dat", 325 "/system/save/8000000000000010/su/avators/profiles.dat",
326 "rb"); 326 "wb");
327 327
328 save.Resize(sizeof(ProfileDataRaw)); 328 save.Resize(sizeof(ProfileDataRaw));
329 save.Seek(0, SEEK_SET); 329 save.Seek(0, SEEK_SET);
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index af2acdd45..87301b5a2 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -13,6 +13,7 @@
13#include <QVBoxLayout> 13#include <QVBoxLayout>
14#include "common/common_paths.h" 14#include "common/common_paths.h"
15#include "common/logging/backend.h" 15#include "common/logging/backend.h"
16#include "common/string_util.h"
16#include "core/core.h" 17#include "core/core.h"
17#include "core/settings.h" 18#include "core/settings.h"
18#include "ui_configure_system.h" 19#include "ui_configure_system.h"
@@ -112,8 +113,6 @@ void ConfigureSystem::setConfiguration() {
112 item_model->removeRows(0, item_model->rowCount()); 113 item_model->removeRows(0, item_model->rowCount());
113 list_items.clear(); 114 list_items.clear();
114 115
115 ui->pm_add->setEnabled(profile_manager->GetUserCount() < 8);
116
117 PopulateUserList(); 116 PopulateUserList();
118 UpdateCurrentUser(); 117 UpdateCurrentUser();
119} 118}
@@ -156,6 +155,8 @@ void ConfigureSystem::PopulateUserList() {
156} 155}
157 156
158void ConfigureSystem::UpdateCurrentUser() { 157void ConfigureSystem::UpdateCurrentUser() {
158 ui->pm_add->setEnabled(profile_manager->GetUserCount() < 8);
159
159 const auto& current_user = profile_manager->GetAllUsers()[Settings::values.current_user]; 160 const auto& current_user = profile_manager->GetAllUsers()[Settings::values.current_user];
160 const auto username = GetAccountUsername(current_user); 161 const auto username = GetAccountUsername(current_user);
161 162
@@ -230,10 +231,7 @@ void ConfigureSystem::SelectUser(const QModelIndex& index) {
230 UpdateCurrentUser(); 231 UpdateCurrentUser();
231 232
232 ui->pm_remove->setEnabled(profile_manager->GetUserCount() >= 2); 233 ui->pm_remove->setEnabled(profile_manager->GetUserCount() >= 2);
233 ui->pm_remove->setEnabled(false);
234
235 ui->pm_rename->setEnabled(true); 234 ui->pm_rename->setEnabled(true);
236
237 ui->pm_set_image->setEnabled(true); 235 ui->pm_set_image->setEnabled(true);
238} 236}
239 237
@@ -282,9 +280,12 @@ void ConfigureSystem::RenameUser() {
282 280
283 profile_manager->SetProfileBase(uuid, profile); 281 profile_manager->SetProfileBase(uuid, profile);
284 282
285 list_items[user][0] = new QStandardItem{ 283 item_model->setItem(
286 GetIcon(uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 284 user, 0,
287 QString::fromStdString(username_std + '\n' + uuid.FormatSwitch())}; 285 new QStandardItem{
286 GetIcon(uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
287 QString::fromStdString(username_std + '\n' + uuid.FormatSwitch())});
288 UpdateCurrentUser();
288} 289}
289 290
290void ConfigureSystem::DeleteUser() { 291void ConfigureSystem::DeleteUser() {
@@ -302,11 +303,13 @@ void ConfigureSystem::DeleteUser() {
302 303
303 if (Settings::values.current_user == tree_view->currentIndex().row()) 304 if (Settings::values.current_user == tree_view->currentIndex().row())
304 Settings::values.current_user = 0; 305 Settings::values.current_user = 0;
306 UpdateCurrentUser();
305 307
306 if (!profile_manager->RemoveUser(uuid)) 308 if (!profile_manager->RemoveUser(uuid))
307 return; 309 return;
308 310
309 item_model->removeRows(tree_view->currentIndex().row(), 1); 311 item_model->removeRows(tree_view->currentIndex().row(), 1);
312 tree_view->clearSelection();
310 313
311 ui->pm_remove->setEnabled(false); 314 ui->pm_remove->setEnabled(false);
312 ui->pm_rename->setEnabled(false); 315 ui->pm_rename->setEnabled(false);
@@ -334,7 +337,10 @@ void ConfigureSystem::SetUserImage() {
334 FileUtil::CreateFullPath(GetImagePath(uuid)); 337 FileUtil::CreateFullPath(GetImagePath(uuid));
335 FileUtil::Copy(file.toStdString(), GetImagePath(uuid)); 338 FileUtil::Copy(file.toStdString(), GetImagePath(uuid));
336 339
337 list_items[index][0] = new QStandardItem{ 340 item_model->setItem(
338 GetIcon(uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 341 index, 0,
339 QString::fromStdString(username + '\n' + uuid.FormatSwitch())}; 342 new QStandardItem{
343 GetIcon(uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
344 QString::fromStdString(username + '\n' + uuid.FormatSwitch())});
345 UpdateCurrentUser();
340} 346}