From 80d6172084cea72688c1663d676f0df9ba2839bb Mon Sep 17 00:00:00 2001 From: crueter Date: Mon, 23 Feb 2026 02:03:30 +0100 Subject: [PATCH] [desktop] Display currently applied update in tooltip alongside playtime (#3611) Also nicely formats both it and play time, alongside fallbacks if they have nothing Signed-off-by: crueter Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3611 Reviewed-by: DraVee Reviewed-by: Lizzie --- src/yuzu/game/game_list_p.h | 26 +++++++++++++++++++++++--- src/yuzu/game/game_list_worker.cpp | 2 +- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/yuzu/game/game_list_p.h b/src/yuzu/game/game_list_p.h index 95f5f7eb78..9bae5b9e01 100644 --- a/src/yuzu/game/game_list_p.h +++ b/src/yuzu/game/game_list_p.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "common/common_types.h" #include "common/logging/log.h" @@ -76,15 +77,34 @@ public: GameListItemPath() = default; GameListItemPath(const QString& game_path, const std::vector& picture_data, const QString& game_name, const QString& game_type, u64 program_id, - u64 play_time) { + u64 play_time, const QString &patch_versions) { 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 auto readable_play_time = + play_time > 0 + ? QObject::tr("Play Time: %1").arg(QString::fromStdString(PlayTime::PlayTimeManager::GetReadablePlayTime(play_time))) + : QObject::tr("Never Played"); + + const auto enabled_update = [patch_versions]() -> QString { + const QStringList lines = patch_versions.split(QLatin1Char('\n')); + const QRegularExpression regex{QStringLiteral(R"(^Update \(([0-9\.]+)\))")}; + for (const QString &line : std::as_const(lines)) { + const auto match = regex.match(line); + if (match.hasMatch() && match.hasCaptured(1)) + return QObject::tr("Version: %1").arg(match.captured(1)); + } + return QObject::tr("Version: 1.0.0"); + }(); + + const auto tooltip = QStringLiteral("%1\n%2").arg( + readable_play_time, + enabled_update); + + setData(tooltip, Qt::ToolTipRole); const u32 size = UISettings::values.game_icon_size.GetValue(); diff --git a/src/yuzu/game/game_list_worker.cpp b/src/yuzu/game/game_list_worker.cpp index d9c91334e1..c4504a0d5e 100644 --- a/src/yuzu/game/game_list_worker.cpp +++ b/src/yuzu/game/game_list_worker.cpp @@ -218,7 +218,7 @@ QList MakeGameListEntry(const std::string& path, u64 play_time = play_time_manager.GetPlayTime(program_id); return QList{ new GameListItemPath(FormatGameName(path), icon, QString::fromStdString(name), - file_type_string, program_id, play_time), + file_type_string, program_id, play_time, patch_versions), new GameListItem(file_type_string), new GameListItemSize(size), new GameListItemPlayTime(play_time),