mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
Qt: simplify zero padding in trophy icon path
This commit is contained in:
parent
568af756cc
commit
4ab2e40d8a
1 changed files with 4 additions and 13 deletions
|
@ -378,22 +378,13 @@ bool trophy_manager_dialog::LoadTrophyFolderToDB(const std::string& trop_name)
|
||||||
|
|
||||||
for (u32 trophy_id = 0; trophy_id < trophy_count; ++trophy_id)
|
for (u32 trophy_id = 0; trophy_id < trophy_count; ++trophy_id)
|
||||||
{
|
{
|
||||||
// Figure out how many zeros are needed for padding. (either 0, 1, or 2)
|
// A trophy icon has 3 digits from 000 to 999, for example TROP001.PNG
|
||||||
QString padding = "";
|
const QString path = qstr(fmt::format("%sTROP%03d.PNG", game_trophy_data->path, trophy_id));
|
||||||
if (trophy_id < 10)
|
|
||||||
{
|
|
||||||
padding = "00";
|
|
||||||
}
|
|
||||||
else if (trophy_id < 100)
|
|
||||||
{
|
|
||||||
padding = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap trophy_icon;
|
QPixmap trophy_icon;
|
||||||
const QString path = qstr(game_trophy_data->path) + "TROP" + padding + QString::number(trophy_id) + ".PNG";
|
|
||||||
if (!trophy_icon.load(path))
|
if (!trophy_icon.load(path))
|
||||||
{
|
{
|
||||||
gui_log.error("Failed to load trophy icon for trophy %d %s", trophy_id, game_trophy_data->path);
|
gui_log.error("Failed to load trophy icon for trophy %d %s", trophy_id, sstr(path));
|
||||||
}
|
}
|
||||||
game_trophy_data->trophy_images.emplace_back(std::move(trophy_icon));
|
game_trophy_data->trophy_images.emplace_back(std::move(trophy_icon));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue