Qt: show time of day in 'last played' game info, log current time when RPCS3 boots (#11220)

This commit is contained in:
Eladash 2022-02-24 00:40:18 +02:00 committed by GitHub
parent f3823232e0
commit 86a04a867b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 15 deletions

View file

@ -2401,16 +2401,16 @@ void game_list_frame::PopulateGameList()
const quint64 elapsed_ms = m_persistent_settings->GetPlaytime(serial);
// Last played (support outdated values)
QDate last_played;
QDateTime last_played;
const QString last_played_str = GetLastPlayedBySerial(serial);
if (!last_played_str.isEmpty())
{
last_played = QDate::fromString(last_played_str, gui::persistent::last_played_date_format);
last_played = QDateTime::fromString(last_played_str, gui::persistent::last_played_date_format);
if (!last_played.isValid())
{
last_played = QDate::fromString(last_played_str, gui::persistent::last_played_date_format_old);
last_played = QDateTime::fromString(last_played_str, gui::persistent::last_played_date_format_old);
}
}
@ -2425,7 +2425,7 @@ void game_list_frame::PopulateGameList()
m_game_list->setItem(row, gui::column_resolution, new custom_table_widget_item(GetStringFromU32(game->info.resolution, localized.resolution.mode, true)));
m_game_list->setItem(row, gui::column_sound, new custom_table_widget_item(GetStringFromU32(game->info.sound_format, localized.sound.format, true)));
m_game_list->setItem(row, gui::column_parental, new custom_table_widget_item(GetStringFromU32(game->info.parental_lvl, localized.parental.level), Qt::UserRole, game->info.parental_lvl));
m_game_list->setItem(row, gui::column_last_play, new custom_table_widget_item(locale.toString(last_played, gui::persistent::last_played_date_format_new), Qt::UserRole, last_played));
m_game_list->setItem(row, gui::column_last_play, new custom_table_widget_item(locale.toString(last_played, last_played >= QDateTime::currentDateTime().addDays(-7) ? gui::persistent::last_played_date_with_time_of_day_format : gui::persistent::last_played_date_format_new), Qt::UserRole, last_played));
m_game_list->setItem(row, gui::column_playtime, new custom_table_widget_item(elapsed_ms == 0 ? tr("Never played") : localized.GetVerboseTimeByMs(elapsed_ms), Qt::UserRole, elapsed_ms));
m_game_list->setItem(row, gui::column_compat, compat_item);