diff options
author | Lioncash <mathew1800@gmail.com> | 2018-12-05 17:47:03 -0500 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-12-05 17:49:37 -0500 |
commit | de095ded5cedaed3b7668142de59a2410018471d (patch) | |
tree | 01422247601310d93b26860d22e054e8021a0749 /src | |
parent | de323851b41901d71708504ee71c2aac73990bf7 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/yuzu/game_list_worker.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 9fd074223..f16a6e41c 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -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)), }; |