2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

yuzu/game_list_worker: Don't retrieve file type and file type strings twice in MakeGameListEntry()

While GetFileType() is indeed a getter function, that doesn't mean it's
a trivial function, given some case require reading from the data or
constructing other objects in the background. Instead, only do necessary
work once.
This commit is contained in:
Lioncash 2018-12-05 17:47:03 -05:00
parent de323851b4
commit de095ded5c

View file

@ -99,12 +99,14 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
compatibility = it->second.first;
}
const auto file_type = loader.GetFileType();
const auto file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type));
QList<QStandardItem*> list{
new GameListItemPath(
FormatGameName(path), icon, QString::fromStdString(name),
QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id),
new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name),
file_type_string, program_id),
new GameListItemCompat(compatibility),
new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))),
new GameListItem(file_type_string),
new GameListItemSize(FileUtil::GetSize(path)),
};