summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-12-05 17:47:03 -0500
committerGravatar Lioncash2018-12-05 17:49:37 -0500
commitde095ded5cedaed3b7668142de59a2410018471d (patch)
tree01422247601310d93b26860d22e054e8021a0749
parentloaders: Make GetFileType() a const qualified member function (diff)
downloadyuzu-de095ded5cedaed3b7668142de59a2410018471d.tar.gz
yuzu-de095ded5cedaed3b7668142de59a2410018471d.tar.xz
yuzu-de095ded5cedaed3b7668142de59a2410018471d.zip
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.
-rw-r--r--src/yuzu/game_list_worker.cpp10
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
99 compatibility = it->second.first; 99 compatibility = it->second.first;
100 } 100 }
101 101
102 const auto file_type = loader.GetFileType();
103 const auto file_type_string = QString::fromStdString(Loader::GetFileTypeString(file_type));
104
102 QList<QStandardItem*> list{ 105 QList<QStandardItem*> list{
103 new GameListItemPath( 106 new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name),
104 FormatGameName(path), icon, QString::fromStdString(name), 107 file_type_string, program_id),
105 QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType())), program_id),
106 new GameListItemCompat(compatibility), 108 new GameListItemCompat(compatibility),
107 new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader.GetFileType()))), 109 new GameListItem(file_type_string),
108 new GameListItemSize(FileUtil::GetSize(path)), 110 new GameListItemSize(FileUtil::GetSize(path)),
109 }; 111 };
110 112