mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-03-30 04:20:33 +00:00
Merge pull request #4964 from arthomnix/feature/playtime-format-customisation
NOISSUE Add setting to display playtime in hours only
This commit is contained in:
commit
597da783d7
@ -718,6 +718,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
m_settings->registerSetting("ShowGameTime", true);
|
m_settings->registerSetting("ShowGameTime", true);
|
||||||
m_settings->registerSetting("ShowGlobalGameTime", true);
|
m_settings->registerSetting("ShowGlobalGameTime", true);
|
||||||
m_settings->registerSetting("RecordGameTime", true);
|
m_settings->registerSetting("RecordGameTime", true);
|
||||||
|
m_settings->registerSetting("ShowGameTimeHours", false);
|
||||||
|
|
||||||
// Minecraft launch method
|
// Minecraft launch method
|
||||||
m_settings->registerSetting("MCLaunchMethod", "LauncherPart");
|
m_settings->registerSetting("MCLaunchMethod", "LauncherPart");
|
||||||
|
@ -785,11 +785,19 @@ QString MinecraftInstance::getStatusbarDescription()
|
|||||||
if(m_settings->get("ShowGameTime").toBool())
|
if(m_settings->get("ShowGameTime").toBool())
|
||||||
{
|
{
|
||||||
if (lastTimePlayed() > 0) {
|
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) {
|
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())
|
if(hasCrashed())
|
||||||
|
@ -2006,6 +2006,10 @@ void MainWindow::updateStatusCenter()
|
|||||||
|
|
||||||
int timePlayed = APPLICATION->instances()->getTotalPlayTime();
|
int timePlayed = APPLICATION->instances()->getTotalPlayTime();
|
||||||
if (timePlayed > 0) {
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2013-2021 MultiMC Contributors
|
/* Copyright 2013-2022 MultiMC Contributors
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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("ShowGameTime", ui->showGameTime->isChecked());
|
||||||
s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked());
|
s->set("ShowGlobalGameTime", ui->showGlobalGameTime->isChecked());
|
||||||
s->set("RecordGameTime", ui->recordGameTime->isChecked());
|
s->set("RecordGameTime", ui->recordGameTime->isChecked());
|
||||||
|
s->set("ShowGameTimeHours", ui->showGameTimeHours->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftPage::loadSettings()
|
void MinecraftPage::loadSettings()
|
||||||
|
@ -161,6 +161,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showGameTimeHours">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show time spent playing in hours only</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user