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

@@ -2006,6 +2006,10 @@ void MainWindow::updateStatusCenter()
int timePlayed = APPLICATION->instances()->getTotalPlayTime();
if (timePlayed > 0) {
m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed)));
if (APPLICATION->settings()->get("ShowGameTimeHours").toBool()) {
m_statusCenter->setText(tr("Total playtime: %1 hours").arg(timePlayed / 3600.0, 0, 'f', 1));
} else {
m_statusCenter->setText(tr("Total playtime: %1").arg(Time::prettifyDuration(timePlayed)));
}
}
}

View File

@@ -1,4 +1,4 @@
/* Copyright 2013-2021 MultiMC Contributors
/* Copyright 2013-2022 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,6 +71,7 @@ void MinecraftPage::applySettings()
s->set("ShowGameTime", ui->showGameTime->isChecked());
s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked());
s->set("RecordGameTime", ui->recordGameTime->isChecked());
s->set("ShowGameTimeHours", ui->showGameTimeHours->isChecked());
}
void MinecraftPage::loadSettings()

View File

@@ -161,6 +161,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showGameTimeHours">
<property name="text">
<string>Show time spent playing in hours only</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>