From e60a652b78af8f985862da726898291f807ae058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 22 Sep 2015 01:25:34 +0200 Subject: [PATCH] GH-1217 reset time played on zip pack import --- application/MainWindow.cpp | 2 ++ logic/BaseInstance.cpp | 7 ++++++- logic/BaseInstance.h | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index c7626e548..e9f651cba 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -1132,6 +1132,8 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup, } } newInstance->setGroupInitial(instGroup); + // reset time played on import... because packs. + newInstance->resetTimePlayed(); MMC->instances()->add(InstancePtr(newInstance)); MMC->instances()->saveGroupList(); diff --git a/logic/BaseInstance.cpp b/logic/BaseInstance.cpp index b0235b47d..02284d376 100644 --- a/logic/BaseInstance.cpp +++ b/logic/BaseInstance.cpp @@ -108,7 +108,7 @@ void BaseInstance::setRunning(bool running) m_isRunning = running; } -int64_t BaseInstance::totalTimePlayed() +int64_t BaseInstance::totalTimePlayed() const { qint64 current = settings()->get("totalTimePlayed").toLongLong(); if(m_isRunning) @@ -119,6 +119,11 @@ int64_t BaseInstance::totalTimePlayed() return current; } +void BaseInstance::resetTimePlayed() +{ + settings()->reset("totalTimePlayed"); +} + QString BaseInstance::instanceType() const { return m_settings->get("InstanceType").toString(); diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h index 32a4d1cd0..8c0c098b3 100644 --- a/logic/BaseInstance.h +++ b/logic/BaseInstance.h @@ -71,7 +71,8 @@ public: void setRunning(bool running); bool isRunning() const; - int64_t totalTimePlayed(); + int64_t totalTimePlayed() const; + void resetTimePlayed(); /// get the type of this instance QString instanceType() const;