Skip to content
Snippets Groups Projects
Commit 9024cbb5 authored by Lioncash's avatar Lioncash
Browse files

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.
parent 85ed0af8
No related branches found
No related tags found
No related merge requests found
...@@ -81,7 +81,7 @@ QPixmap GetIcon(Service::Account::UUID uuid) { ...@@ -81,7 +81,7 @@ QPixmap GetIcon(Service::Account::UUID uuid) {
icon.loadFromData(backup_jpeg.data(), backup_jpeg.size()); icon.loadFromData(backup_jpeg.data(), backup_jpeg.size());
} }
return icon; return icon.scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
} }
} // Anonymous namespace } // Anonymous namespace
...@@ -162,8 +162,7 @@ void ConfigureSystem::PopulateUserList() { ...@@ -162,8 +162,7 @@ void ConfigureSystem::PopulateUserList() {
reinterpret_cast<const char*>(profile.username.data()), profile.username.size()); reinterpret_cast<const char*>(profile.username.data()), profile.username.size());
list_items.push_back(QList<QStandardItem*>{new QStandardItem{ list_items.push_back(QList<QStandardItem*>{new QStandardItem{
GetIcon(user).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), GetIcon(user), FormatUserEntryText(QString::fromStdString(username), user)}});
FormatUserEntryText(QString::fromStdString(username), user)}});
} }
for (const auto& item : list_items) for (const auto& item : list_items)
...@@ -256,9 +255,7 @@ void ConfigureSystem::AddUser() { ...@@ -256,9 +255,7 @@ void ConfigureSystem::AddUser() {
profile_manager->CreateNewUser(uuid, username.toStdString()); profile_manager->CreateNewUser(uuid, username.toStdString());
item_model->appendRow(new QStandardItem{ item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)});
GetIcon(uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
FormatUserEntryText(username, uuid)});
} }
void ConfigureSystem::RenameUser() { void ConfigureSystem::RenameUser() {
...@@ -292,9 +289,8 @@ void ConfigureSystem::RenameUser() { ...@@ -292,9 +289,8 @@ void ConfigureSystem::RenameUser() {
item_model->setItem( item_model->setItem(
user, 0, user, 0,
new QStandardItem{ new QStandardItem{GetIcon(*uuid),
GetIcon(*uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), FormatUserEntryText(QString::fromStdString(username_std), *uuid)});
FormatUserEntryText(QString::fromStdString(username_std), *uuid)});
UpdateCurrentUser(); UpdateCurrentUser();
} }
...@@ -369,10 +365,7 @@ void ConfigureSystem::SetUserImage() { ...@@ -369,10 +365,7 @@ void ConfigureSystem::SetUserImage() {
} }
const auto username = GetAccountUsername(*profile_manager, *uuid); const auto username = GetAccountUsername(*profile_manager, *uuid);
item_model->setItem( item_model->setItem(index, 0,
index, 0, new QStandardItem{GetIcon(*uuid), FormatUserEntryText(username, *uuid)});
new QStandardItem{
GetIcon(*uuid).scaled(64, 64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
FormatUserEntryText(username, *uuid)});
UpdateCurrentUser(); UpdateCurrentUser();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment