GH-1217 reset time played on zip pack import

This commit is contained in:
Petr Mrázek 2015-09-22 01:25:34 +02:00
parent 9ba1cd15e7
commit e60a652b78
3 changed files with 10 additions and 2 deletions

View File

@ -1132,6 +1132,8 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup,
} }
} }
newInstance->setGroupInitial(instGroup); newInstance->setGroupInitial(instGroup);
// reset time played on import... because packs.
newInstance->resetTimePlayed();
MMC->instances()->add(InstancePtr(newInstance)); MMC->instances()->add(InstancePtr(newInstance));
MMC->instances()->saveGroupList(); MMC->instances()->saveGroupList();

View File

@ -108,7 +108,7 @@ void BaseInstance::setRunning(bool running)
m_isRunning = running; m_isRunning = running;
} }
int64_t BaseInstance::totalTimePlayed() int64_t BaseInstance::totalTimePlayed() const
{ {
qint64 current = settings()->get("totalTimePlayed").toLongLong(); qint64 current = settings()->get("totalTimePlayed").toLongLong();
if(m_isRunning) if(m_isRunning)
@ -119,6 +119,11 @@ int64_t BaseInstance::totalTimePlayed()
return current; return current;
} }
void BaseInstance::resetTimePlayed()
{
settings()->reset("totalTimePlayed");
}
QString BaseInstance::instanceType() const QString BaseInstance::instanceType() const
{ {
return m_settings->get("InstanceType").toString(); return m_settings->get("InstanceType").toString();

View File

@ -71,7 +71,8 @@ public:
void setRunning(bool running); void setRunning(bool running);
bool isRunning() const; bool isRunning() const;
int64_t totalTimePlayed(); int64_t totalTimePlayed() const;
void resetTimePlayed();
/// get the type of this instance /// get the type of this instance
QString instanceType() const; QString instanceType() const;