Qt: fix never played nonsense

This commit is contained in:
Megamouse 2020-10-26 23:50:47 +01:00
parent b32eecb5a7
commit 15e8cba398
4 changed files with 30 additions and 23 deletions

View File

@ -2013,7 +2013,7 @@ void game_list_frame::PopulateGameList()
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_playtime, new custom_table_widget_item(localized.GetVerboseTimeByMs(elapsed_ms), Qt::UserRole, elapsed_ms));
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);
if (selected_item == game->info.path + game->info.icon_path)

View File

@ -4,29 +4,24 @@ Localized::Localized()
{
}
QString Localized::GetVerboseTimeByMs(qint64 elapsed_ms, bool show_days) const
QString Localized::GetVerboseTimeByMs(quint64 elapsed_ms, bool show_days) const
{
if (elapsed_ms <= 0)
{
return tr("Never played");
}
const quint64 elapsed_seconds = (elapsed_ms / 1000) + ((elapsed_ms % 1000) > 0 ? 1 : 0);
quint64 hours = elapsed_seconds / 3600;
const qint64 elapsed_seconds = (elapsed_ms / 1000) + ((elapsed_ms % 1000) > 0 ? 1 : 0);
qint64 hours = elapsed_seconds / 3600;
qint64 days = 0;
quint64 days = 0;
if (show_days)
{
days = hours / 24;
hours = hours % 24;
}
const qint64 minutes = (elapsed_seconds % 3600) / 60;
const qint64 seconds = (elapsed_seconds % 3600) % 60;
const quint64 minutes = (elapsed_seconds % 3600) / 60;
const quint64 seconds = (elapsed_seconds % 3600) % 60;
QString str_days = tr("%Ln day(s)", "", days);
QString str_hours = tr("%Ln hour(s)", "", hours);
QString str_minutes = tr("%Ln minute(s)", "", minutes);
QString str_seconds = tr("%Ln second(s)", "", seconds);
const QString str_days = tr("%Ln day(s)", "", days);
const QString str_hours = tr("%Ln hour(s)", "", hours);
const QString str_minutes = tr("%Ln minute(s)", "", minutes);
const QString str_seconds = tr("%Ln second(s)", "", seconds);
if (days != 0)
{

View File

@ -17,7 +17,7 @@ public:
Localized();
QString GetVerboseTimeByMs(qint64 elapsed_ms, bool show_days = false) const;
QString GetVerboseTimeByMs(quint64 elapsed_ms, bool show_days = false) const;
const struct category // (see PARAM.SFO in psdevwiki.com) TODO: Disc Categories
{

View File

@ -175,12 +175,24 @@ bool update_manager::handle_json(bool automatic, bool check_only, const QByteArr
if (hash_found)
{
m_update_message = tr("A new version of RPCS3 is available!\n\nCurrent version: %0 (%1)\nLatest version: %2 (%3)\nYour version is %4 old.\n\nDo you want to update?")
.arg(current["version"].toString())
.arg(cur_str)
.arg(latest["version"].toString())
.arg(lts_str)
.arg(localized.GetVerboseTimeByMs(diff_msec, true));
if (diff_msec < 0)
{
// This usually means that the current version was marked as broken and won't be shipped anymore, so we need to downgrade to avoid certain bugs.
m_update_message = tr("A better version of RPCS3 is available!\n\nCurrent version: %0 (%1)\nBetter version: %2 (%3)\n\nDo you want to update?")
.arg(current["version"].toString())
.arg(cur_str)
.arg(latest["version"].toString())
.arg(lts_str);
}
else
{
m_update_message = tr("A new version of RPCS3 is available!\n\nCurrent version: %0 (%1)\nLatest version: %2 (%3)\nYour version is %4 old.\n\nDo you want to update?")
.arg(current["version"].toString())
.arg(cur_str)
.arg(latest["version"].toString())
.arg(lts_str)
.arg(localized.GetVerboseTimeByMs(diff_msec, true));
}
}
else
{