From 8fed63392af2af005e7c547cffe3fe8d44964dac Mon Sep 17 00:00:00 2001 From: Made in Slovakia <264256133+Made-in-Slovakia@users.noreply.github.com> Date: Mon, 9 Nov 2026 01:09:09 +0100 Subject: [PATCH] Qt: Change Time Played format to show all time units. In the List View in Desktop Mode, "Time Played" column displays only the largest time unit, with the others omitted. This PR aligns the way value in "Time Played" is displayed with other parts of the application by reusing same function. --- pcsx2-qt/GameList/GameListModel.cpp | 16 +--------------- pcsx2-qt/GameList/GameListModel.h | 2 -- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/pcsx2-qt/GameList/GameListModel.cpp b/pcsx2-qt/GameList/GameListModel.cpp index 9c8d4c89b5..3f5ebb9e88 100644 --- a/pcsx2-qt/GameList/GameListModel.cpp +++ b/pcsx2-qt/GameList/GameListModel.cpp @@ -215,20 +215,6 @@ int GameListModel::columnCount(const QModelIndex& parent) const return parent.isValid() ? 0 : Column_Count; } -QString GameListModel::formatTimespan(const time_t timespan) -{ - // Avoid an extra string conversion over calling QString::fromStdString(GameList::FormatTimespan). - const u32 hours = static_cast(timespan / 3600); - if (hours > 0) - return qApp->translate("GameList", "%n hours", "", hours); - - const u32 minutes = static_cast((timespan % 3600) / 60); - if (minutes > 0) - return qApp->translate("GameList", "%n minutes", "", minutes); - else - return qApp->translate("GameList", "%n seconds", "", static_cast((timespan % 3600) % 60)); -} - QVariant GameListModel::data(const QModelIndex& index, const int role) const { if (!index.isValid()) @@ -267,7 +253,7 @@ QVariant GameListModel::data(const QModelIndex& index, const int role) const return QString::fromStdString(fmt::format("{:08X}", ge->crc)); case Column_TimePlayed: - return ge->total_played_time ? formatTimespan(ge->total_played_time) : QVariant(); + return QString::fromStdString(GameList::FormatTimespan(ge->total_played_time)); case Column_LastPlayed: return QString::fromStdString(GameList::FormatTimestamp(ge->last_played_time)); diff --git a/pcsx2-qt/GameList/GameListModel.h b/pcsx2-qt/GameList/GameListModel.h index 921914c810..de786a60f0 100644 --- a/pcsx2-qt/GameList/GameListModel.h +++ b/pcsx2-qt/GameList/GameListModel.h @@ -90,8 +90,6 @@ private: void loadOrGenerateCover(const GameList::Entry* ge); void invalidateCoverForPath(const std::string& path); - static QString formatTimespan(const time_t timespan); - float m_cover_scale = 0.0f; std::atomic m_cover_scale_counter{0}; bool m_show_titles_for_covers = false;