Browse Source

Add play time tooltip

Signed-off-by: crueter <crueter@eden-emu.dev>
pull/3479/head
crueter 2 days ago
parent
commit
862917fea2
  1. 10
      src/yuzu/game/game_list_p.h
  2. 7
      src/yuzu/game/game_list_worker.cpp

10
src/yuzu/game/game_list_p.h

@ -75,13 +75,17 @@ public:
GameListItemPath() = default;
GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data,
const QString& game_name, const QString& game_type, u64 program_id) {
const QString& game_name, const QString& game_type, u64 program_id,
u64 play_time) {
setData(type(), TypeRole);
setData(game_path, FullPathRole);
setData(game_name, TitleRole);
setData(qulonglong(program_id), ProgramIdRole);
setData(game_type, FileTypeRole);
setData(QString::fromStdString(PlayTime::PlayTimeManager::GetReadablePlayTime(play_time)),
Qt::ToolTipRole);
const u32 size = UISettings::values.game_icon_size.GetValue();
QPixmap picture;
@ -252,7 +256,9 @@ public:
void setData(const QVariant& value, int role) override {
qulonglong time_seconds = value.toULongLong();
GameListItem::setData(QString::fromStdString(PlayTime::PlayTimeManager::GetReadablePlayTime(time_seconds)), Qt::DisplayRole);
GameListItem::setData(
QString::fromStdString(PlayTime::PlayTimeManager::GetReadablePlayTime(time_seconds)),
Qt::DisplayRole);
GameListItem::setData(value, PlayTimeRole);
}

7
src/yuzu/game/game_list_worker.cpp

@ -214,11 +214,14 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path,
QString patch_versions = GetGameListCachedObject(fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] {
return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable());
});
u64 play_time = play_time_manager.GetPlayTime(program_id);
return QList<QStandardItem*>{
new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name), file_type_string, program_id),
new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name),
file_type_string, program_id, play_time),
new GameListItem(file_type_string),
new GameListItemSize(size),
new GameListItemPlayTime(play_time_manager.GetPlayTime(program_id)),
new GameListItemPlayTime(play_time),
new GameListItem(patch_versions),
new GameListItemCompat(compatibility),
};

Loading…
Cancel
Save