From 0c241629281ed319b7c639d711ae0b61381ea0db Mon Sep 17 00:00:00 2001 From: Starsam80 Date: Tue, 6 Jun 2017 16:44:42 -0600 Subject: [PATCH] Qt: Use TitleDatabase for better names in the game list --- Source/Core/DolphinQt2/GameList/GameListModel.cpp | 15 ++++++++++++++- Source/Core/DolphinQt2/GameList/GameListModel.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt2/GameList/GameListModel.cpp b/Source/Core/DolphinQt2/GameList/GameListModel.cpp index 07f23c1b94..78f13928fb 100644 --- a/Source/Core/DolphinQt2/GameList/GameListModel.cpp +++ b/Source/Core/DolphinQt2/GameList/GameListModel.cpp @@ -3,6 +3,8 @@ // Refer to the license.txt file included. #include "DolphinQt2/GameList/GameListModel.h" + +#include "DiscIO/Enums.h" #include "DolphinQt2/Resources.h" #include "DolphinQt2/Settings.h" @@ -21,6 +23,8 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent) emit layoutAboutToBeChanged(); emit layoutChanged(); }); + + // TODO: Reload m_title_database when the language changes } QVariant GameListModel::data(const QModelIndex& index, int role) const @@ -63,7 +67,16 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const break; case COL_TITLE: if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) - return game->GetLongName(); + { + QString display_name = QString::fromStdString(m_title_database.GetTitleName( + game->GetGameID().toStdString(), game->GetPlatformID() == DiscIO::Platform::WII_WAD ? + Core::TitleDatabase::TitleType::Channel : + Core::TitleDatabase::TitleType::Other)); + if (display_name.isEmpty()) + return game->GetLongName(); + + return display_name; + } break; case COL_ID: if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole) diff --git a/Source/Core/DolphinQt2/GameList/GameListModel.h b/Source/Core/DolphinQt2/GameList/GameListModel.h index ab6a149cde..bd49c348d3 100644 --- a/Source/Core/DolphinQt2/GameList/GameListModel.h +++ b/Source/Core/DolphinQt2/GameList/GameListModel.h @@ -7,6 +7,7 @@ #include #include +#include "Core/TitleDatabase.h" #include "DolphinQt2/GameList/GameFile.h" #include "DolphinQt2/GameList/GameTracker.h" @@ -54,4 +55,5 @@ private: GameTracker m_tracker; QList> m_games; + Core::TitleDatabase m_title_database; };