NOISSUE Add setting to display playtime in hours only

This commit is contained in:
arthomnix
2022-11-02 16:11:56 +00:00
parent 301b44d1c4
commit b82d667859
5 changed files with 25 additions and 4 deletions

View File

@@ -785,11 +785,19 @@ QString MinecraftInstance::getStatusbarDescription()
if(m_settings->get("ShowGameTime").toBool())
{
if (lastTimePlayed() > 0) {
description.append(tr(", last played for %1").arg(Time::prettifyDuration(lastTimePlayed())));
if (APPLICATION->settings()->get("ShowGameTimeHours").toBool()) {
description.append(tr(", last played for %1 hours").arg(lastTimePlayed() / 3600.0, 0, 'f', 2));
} else {
description.append(tr(", last played for %1").arg(Time::prettifyDuration(lastTimePlayed())));
}
}
if (totalTimePlayed() > 0) {
description.append(tr(", total played for %1").arg(Time::prettifyDuration(totalTimePlayed())));
if (APPLICATION->settings()->get("ShowGameTimeHours").toBool()) {
description.append(tr(", total played for %1 hours").arg(totalTimePlayed() / 3600.0, 0, 'f', 1));
} else {
description.append(tr(", total played for %1").arg(Time::prettifyDuration(totalTimePlayed())));
}
}
}
if(hasCrashed())