diff --git a/api/logic/BaseInstance.cpp b/api/logic/BaseInstance.cpp
index d08ceb2b..cff16631 100644
--- a/api/logic/BaseInstance.cpp
+++ b/api/logic/BaseInstance.cpp
@@ -134,6 +134,12 @@ void BaseInstance::setRunning(bool running)
m_isRunning = running;
+ if(!m_settings->get("RecordGameTime").toBool())
+ {
+ emit runningStatusChanged(running);
+ return;
+ }
+
if(running)
{
m_timeStarted = QDateTime::currentDateTime();
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp
index 37cdece7..2d112757 100644
--- a/api/logic/minecraft/MinecraftInstance.cpp
+++ b/api/logic/minecraft/MinecraftInstance.cpp
@@ -106,6 +106,11 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO
m_settings->registerOverride(globalSettings->getSetting("UseNativeOpenAL"), nativeLibraryWorkaroundsOverride);
m_settings->registerOverride(globalSettings->getSetting("UseNativeGLFW"), nativeLibraryWorkaroundsOverride);
+ // Game time
+ auto gameTimeOverride = m_settings->registerSetting("OverrideGameTime", false);
+ m_settings->registerOverride(globalSettings->getSetting("ShowGameTime"), gameTimeOverride);
+ m_settings->registerOverride(globalSettings->getSetting("RecordGameTime"), gameTimeOverride);
+
// DEPRECATED: Read what versions the user configuration thinks should be used
m_settings->registerSetting({"IntendedVersion", "MinecraftVersion"}, "");
m_settings->registerSetting("LWJGLVersion", "");
@@ -769,7 +774,7 @@ QString MinecraftInstance::getStatusbarDescription()
QString description;
description.append(tr("Minecraft %1 (%2)").arg(m_components->getComponentVersion("net.minecraft")).arg(typeName()));
- if(totalTimePlayed() > 0)
+ if(m_settings->get("ShowGameTime").toBool() && totalTimePlayed() > 0)
{
description.append(tr(", played for %1").arg(prettifyTimeDuration(totalTimePlayed())));
}
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 22946e08..3429a377 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -514,6 +514,10 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("UseNativeOpenAL", false);
m_settings->registerSetting("UseNativeGLFW", false);
+ // Game time
+ m_settings->registerSetting("ShowGameTime", true);
+ m_settings->registerSetting("RecordGameTime", true);
+
// Minecraft launch method
m_settings->registerSetting("MCLaunchMethod", "LauncherPart");
diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp
index 6a780fb4..6c9bd307 100644
--- a/application/pages/global/MinecraftPage.cpp
+++ b/application/pages/global/MinecraftPage.cpp
@@ -67,6 +67,10 @@ void MinecraftPage::applySettings()
// Native library workarounds
s->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked());
s->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked());
+
+ // Game time
+ s->set("ShowGameTime", ui->showGameTime->isChecked());
+ s->set("RecordGameTime", ui->recordGameTime->isChecked());
}
void MinecraftPage::loadSettings()
@@ -80,4 +84,7 @@ void MinecraftPage::loadSettings()
ui->useNativeOpenALCheck->setChecked(s->get("UseNativeOpenAL").toBool());
ui->useNativeGLFWCheck->setChecked(s->get("UseNativeGLFW").toBool());
+
+ ui->showGameTime->setChecked(s->get("ShowGameTime").toBool());
+ ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool());
}
diff --git a/application/pages/global/MinecraftPage.ui b/application/pages/global/MinecraftPage.ui
index c096c969..2abd4bd4 100644
--- a/application/pages/global/MinecraftPage.ui
+++ b/application/pages/global/MinecraftPage.ui
@@ -134,6 +134,29 @@
+ -
+
+
+ Game time
+
+
+
-
+
+
+ Show time spent playing instances
+
+
+
+ -
+
+
+ Record time spent playing instances
+
+
+
+
+
+
-
diff --git a/application/pages/instance/InstanceSettingsPage.cpp b/application/pages/instance/InstanceSettingsPage.cpp
index 9a39b034..05041c82 100644
--- a/application/pages/instance/InstanceSettingsPage.cpp
+++ b/application/pages/instance/InstanceSettingsPage.cpp
@@ -177,6 +177,20 @@ void InstanceSettingsPage::applySettings()
m_settings->reset("UseNativeOpenAL");
m_settings->reset("UseNativeGLFW");
}
+
+ // Game time
+ bool gameTime = ui->gameTimeGroupBox->isChecked();
+ m_settings->set("OverrideGameTime", gameTime);
+ if (gameTime)
+ {
+ m_settings->set("ShowGameTime", ui->showGameTime->isChecked());
+ m_settings->set("RecordGameTime", ui->recordGameTime->isChecked());
+ }
+ else
+ {
+ m_settings->reset("ShowGameTime");
+ m_settings->reset("RecordGameTime");
+ }
}
void InstanceSettingsPage::loadSettings()
@@ -238,6 +252,11 @@ void InstanceSettingsPage::loadSettings()
ui->nativeWorkaroundsGroupBox->setChecked(m_settings->get("OverrideNativeWorkarounds").toBool());
ui->useNativeGLFWCheck->setChecked(m_settings->get("UseNativeGLFW").toBool());
ui->useNativeOpenALCheck->setChecked(m_settings->get("UseNativeOpenAL").toBool());
+
+ // Miscellanous
+ ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool());
+ ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool());
+ ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool());
}
void InstanceSettingsPage::on_javaDetectBtn_clicked()
diff --git a/application/pages/instance/InstanceSettingsPage.ui b/application/pages/instance/InstanceSettingsPage.ui
index c91570c6..64f90fad 100644
--- a/application/pages/instance/InstanceSettingsPage.ui
+++ b/application/pages/instance/InstanceSettingsPage.ui
@@ -416,6 +416,58 @@
+
+
+ Miscellanous
+
+
+ -
+
+
+ true
+
+
+ Override global game time settings
+
+
+ true
+
+
+ false
+
+
+
-
+
+
+ Show time spent playing this instance
+
+
+
+ -
+
+
+ Record time spent playing this instance
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
@@ -453,6 +505,8 @@
nativeWorkaroundsGroupBox
useNativeGLFWCheck
useNativeOpenALCheck
+ showGameTime
+ recordGameTime