mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 06:32:56 +00:00
Qt: Use TitleDatabase for better names in the game list
This commit is contained in:
parent
c07058a4ad
commit
0c24162928
@ -3,6 +3,8 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "DolphinQt2/GameList/GameListModel.h"
|
#include "DolphinQt2/GameList/GameListModel.h"
|
||||||
|
|
||||||
|
#include "DiscIO/Enums.h"
|
||||||
#include "DolphinQt2/Resources.h"
|
#include "DolphinQt2/Resources.h"
|
||||||
#include "DolphinQt2/Settings.h"
|
#include "DolphinQt2/Settings.h"
|
||||||
|
|
||||||
@ -21,6 +23,8 @@ GameListModel::GameListModel(QObject* parent) : QAbstractTableModel(parent)
|
|||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: Reload m_title_database when the language changes
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant GameListModel::data(const QModelIndex& index, int role) const
|
QVariant GameListModel::data(const QModelIndex& index, int role) const
|
||||||
@ -63,7 +67,16 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
|
|||||||
break;
|
break;
|
||||||
case COL_TITLE:
|
case COL_TITLE:
|
||||||
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
|
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;
|
break;
|
||||||
case COL_ID:
|
case COL_ID:
|
||||||
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
|
if (role == Qt::DisplayRole || role == Qt::InitialSortOrderRole)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include "Core/TitleDatabase.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "DolphinQt2/GameList/GameFile.h"
|
||||||
#include "DolphinQt2/GameList/GameTracker.h"
|
#include "DolphinQt2/GameList/GameTracker.h"
|
||||||
|
|
||||||
@ -54,4 +55,5 @@ private:
|
|||||||
|
|
||||||
GameTracker m_tracker;
|
GameTracker m_tracker;
|
||||||
QList<QSharedPointer<GameFile>> m_games;
|
QList<QSharedPointer<GameFile>> m_games;
|
||||||
|
Core::TitleDatabase m_title_database;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user