mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-03-14 04:18:29 +00:00
NOISSUE Move hour formatting for play time to a function
This commit is contained in:
parent
90b16fb903
commit
7354c578fd
@ -36,3 +36,7 @@ QString Time::prettifyDuration(int64_t duration) {
|
||||
}
|
||||
return QObject::tr("%1d %2h %3m").arg(days).arg(hours).arg(minutes);
|
||||
}
|
||||
|
||||
QString Time::prettifyDurationHours(int64_t duration) {
|
||||
return QString("%1").arg(duration / 3600.0, 0, 'f', 0);
|
||||
}
|
||||
|
@ -21,5 +21,6 @@
|
||||
namespace Time {
|
||||
|
||||
QString prettifyDuration(int64_t duration);
|
||||
QString prettifyDurationHours(int64_t duration);
|
||||
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ QString MinecraftInstance::getStatusbarDescription()
|
||||
{
|
||||
if (lastTimePlayed() > 0) {
|
||||
if (APPLICATION->settings()->get("ShowGameTimeHours").toBool()) {
|
||||
description.append(tr(", last played for %1 hours").arg(lastTimePlayed() / 3600.0, 0, 'f', 2));
|
||||
description.append(tr(", last played for %1 hours").arg(Time::prettifyDurationHours(lastTimePlayed())));
|
||||
} else {
|
||||
description.append(tr(", last played for %1").arg(Time::prettifyDuration(lastTimePlayed())));
|
||||
}
|
||||
@ -794,7 +794,7 @@ QString MinecraftInstance::getStatusbarDescription()
|
||||
|
||||
if (totalTimePlayed() > 0) {
|
||||
if (APPLICATION->settings()->get("ShowGameTimeHours").toBool()) {
|
||||
description.append(tr(", total played for %1 hours").arg(totalTimePlayed() / 3600.0, 0, 'f', 1));
|
||||
description.append(tr(", total played for %1 hours").arg(Time::prettifyDurationHours(totalTimePlayed())));
|
||||
} else {
|
||||
description.append(tr(", total played for %1").arg(Time::prettifyDuration(totalTimePlayed())));
|
||||
}
|
||||
|
@ -2007,7 +2007,7 @@ void MainWindow::updateStatusCenter()
|
||||
int timePlayed = APPLICATION->instances()->getTotalPlayTime();
|
||||
if (timePlayed > 0) {
|
||||
if (APPLICATION->settings()->get("ShowGameTimeHours").toBool()) {
|
||||
m_statusCenter->setText(tr("Total playtime: %1 hours").arg(timePlayed / 3600.0, 0, 'f', 1));
|
||||
m_statusCenter->setText(tr("Total playtime: %1 hours").arg(Time::prettifyDurationHours(timePlayed)));
|
||||
} else {
|
||||
m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed)));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user