diff options
| author | 2018-10-26 19:46:38 -0400 | |
|---|---|---|
| committer | 2018-10-27 01:05:56 -0400 | |
| commit | 9024cbb5b8462df113526f5027b88723f4765fdf (patch) | |
| tree | e38ecd4d7bab1502992cdaf0d227467439bdf19b /src | |
| parent | configure_system: Move entry formatting for the user account list entries to ... (diff) | |
| download | yuzu-9024cbb5b8462df113526f5027b88723f4765fdf.tar.gz yuzu-9024cbb5b8462df113526f5027b88723f4765fdf.tar.xz yuzu-9024cbb5b8462df113526f5027b88723f4765fdf.zip | |
configure_system: Make GetIcon() return the scaled 64x64 icon
Avoids the need to put the scaling parameters all over the place for the
common case. The only other time scaling is done is to generate the
smaller 48x48 image, so this is fine.
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index f4e892a21..4b34c1e28 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -81,7 +81,7 @@ QPixmap GetIcon(Service::Account::UUID uuid) { | |||
| 81 | icon.loadFromData(backup_jpeg.data(), backup_jpeg.size()); | 81 | icon.loadFromData(backup_jpeg.data(), backup_jpeg.size()); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | return icon; | 84 | return icon.scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); |
| 85 | } | 85 | } |
| 86 | } // Anonymous namespace | 86 | } // Anonymous namespace |
| 87 | 87 | ||
| @@ -162,8 +162,7 @@ void ConfigureSystem::PopulateUserList() { | |||
| 162 | reinterpret_cast<const char*>(profile.username.data()), profile.username.size()); | 162 | reinterpret_cast<const char*>(profile.username.data()), profile.username.size()); |
| 163 | 163 | ||
| 164 | list_items.push_back(QList<QStandardItem*>{new QStandardItem{ | 164 | list_items.push_back(QList<QStandardItem*>{new QStandardItem{ |
| 165 | GetIcon(user).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 165 | GetIcon(user), FormatUserEntryText(QString::fromStdString(username), user)}}); |
| 166 | FormatUserEntryText(QString::fromStdString(username), user)}}); | ||
| 167 | } | 166 | } |
| 168 | 167 | ||
| 169 | for (const auto& item : list_items) | 168 | for (const auto& item : list_items) |
| @@ -256,9 +255,7 @@ void ConfigureSystem::AddUser() { | |||
| 256 | 255 | ||
| 257 | profile_manager->CreateNewUser(uuid, username.toStdString()); | 256 | profile_manager->CreateNewUser(uuid, username.toStdString()); |
| 258 | 257 | ||
| 259 | item_model->appendRow(new QStandardItem{ | 258 | item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)}); |
| 260 | GetIcon(uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | ||
| 261 | FormatUserEntryText(username, uuid)}); | ||
| 262 | } | 259 | } |
| 263 | 260 | ||
| 264 | void ConfigureSystem::RenameUser() { | 261 | void ConfigureSystem::RenameUser() { |
| @@ -292,9 +289,8 @@ void ConfigureSystem::RenameUser() { | |||
| 292 | 289 | ||
| 293 | item_model->setItem( | 290 | item_model->setItem( |
| 294 | user, 0, | 291 | user, 0, |
| 295 | new QStandardItem{ | 292 | new QStandardItem{GetIcon(*uuid), |
| 296 | GetIcon(*uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 293 | FormatUserEntryText(QString::fromStdString(username_std), *uuid)}); |
| 297 | FormatUserEntryText(QString::fromStdString(username_std), *uuid)}); | ||
| 298 | UpdateCurrentUser(); | 294 | UpdateCurrentUser(); |
| 299 | } | 295 | } |
| 300 | 296 | ||
| @@ -369,10 +365,7 @@ void ConfigureSystem::SetUserImage() { | |||
| 369 | } | 365 | } |
| 370 | 366 | ||
| 371 | const auto username = GetAccountUsername(*profile_manager, *uuid); | 367 | const auto username = GetAccountUsername(*profile_manager, *uuid); |
| 372 | item_model->setItem( | 368 | item_model->setItem(index, 0, |
| 373 | index, 0, | 369 | new QStandardItem{GetIcon(*uuid), FormatUserEntryText(username, *uuid)}); |
| 374 | new QStandardItem{ | ||
| 375 | GetIcon(*uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | ||
| 376 | FormatUserEntryText(username, *uuid)}); | ||
| 377 | UpdateCurrentUser(); | 370 | UpdateCurrentUser(); |
| 378 | } | 371 | } |