mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-16 04:09:07 +00:00
SaveState Manager: Format specially close dates
This commit is contained in:
parent
c683b47ac3
commit
abad7f2790
@ -664,9 +664,22 @@ namespace gui
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
QString format_datetime(const QDateTime& date, const QString& fmt)
|
||||
QString format_datetime(const QDateTime& date, const QString& fmt, bool is_relative, const QString& fmt_relative)
|
||||
{
|
||||
return date.toString(fmt);
|
||||
const qint64 exctrated_date = date.date().toJulianDay();
|
||||
const qint64 current_date = QDate::currentDate().toJulianDay();
|
||||
|
||||
if (!is_relative || exctrated_date > current_date || current_date - exctrated_date >= 3)
|
||||
{
|
||||
return date.toString(fmt);
|
||||
}
|
||||
|
||||
if (current_date == exctrated_date)
|
||||
{
|
||||
return QString("Today %1").arg(date.toString(fmt_relative));
|
||||
}
|
||||
|
||||
return QString("%1 days ago %2").arg(current_date - exctrated_date).arg(date.toString(fmt_relative));
|
||||
}
|
||||
|
||||
QString format_timestamp(s64 time, const QString& fmt)
|
||||
|
||||
@ -161,7 +161,7 @@ namespace gui
|
||||
QDateTime datetime(s64 time);
|
||||
|
||||
// Convert a QDateTime to a readable string
|
||||
QString format_datetime(const QDateTime& date, const QString& fmt = "yyyy-MM-dd HH:mm:ss");
|
||||
QString format_datetime(const QDateTime& date, const QString& fmt = "yyyy-MM-dd HH:mm:ss", bool is_relative = false, const QString& fmt_relative = "HH:mm:ss");
|
||||
|
||||
// Convert a timestamp to a readable string
|
||||
QString format_timestamp(s64 time, const QString& fmt = "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@ -686,7 +686,7 @@ void savestate_manager_dialog::PopulateSavestateTable()
|
||||
const savestate_data& savestate = savestates[i];
|
||||
m_savestate_table->setItem(i, static_cast<int>(gui::savestate_list_columns::name), new custom_table_widget_item(savestate.name));
|
||||
m_savestate_table->setItem(i, static_cast<int>(gui::savestate_list_columns::compatible), new custom_table_widget_item(savestate.is_compatible ? tr("Compatible") : tr("Not compatible"), Qt::UserRole, savestate.is_compatible));
|
||||
m_savestate_table->setItem(i, static_cast<int>(gui::savestate_list_columns::date), new custom_table_widget_item(gui::utils::format_datetime(savestate.date), Qt::UserRole, savestate.date));
|
||||
m_savestate_table->setItem(i, static_cast<int>(gui::savestate_list_columns::date), new custom_table_widget_item(gui::utils::format_datetime(savestate.date, "yyyy-MM-dd HH:mm", true, "HH:mm"), Qt::UserRole, savestate.date));
|
||||
m_savestate_table->setItem(i, static_cast<int>(gui::savestate_list_columns::path), new custom_table_widget_item(savestate.path));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user