3
0
Fork 0
forked from suyu/suyu

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; compatibility = it->second.first;
} }
const auto file_type = loader.GetFileType();
const auto file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type));
QList<QStandardItem*> list{ QList<QStandardItem*> list{
new GameListItemPath( new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name),
FormatGameName(path), icon, QString::fromStdString(name), file_type_string, program_id),
QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id),
new GameListItemCompat(compatibility), new GameListItemCompat(compatibility),
new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))), new GameListItem(file_type_string),
new GameListItemSize(FileUtil::GetSize(path)), new GameListItemSize(FileUtil::GetSize(path)),
}; };