Added total playtime

This commit is contained in:
Leland Liu 2019-07-09 22:23:24 -04:00 committed by Petr Mrázek
parent 8ea500de68
commit 1762d2fc7d
5 changed files with 43 additions and 2 deletions

View file

@ -387,9 +387,19 @@ InstanceList::InstListError InstanceList::loadList()
add(newList);
}
m_dirty = false;
updateTotalPlayTime();
return NoError;
}
void InstanceList::updateTotalPlayTime()
{
totalPlayTime = 0;
for(auto const& itr : m_instances)
{
totalPlayTime += itr.get()->totalTimePlayed();
}
}
void InstanceList::saveNow()
{
for(auto & item: m_instances)
@ -475,6 +485,7 @@ void InstanceList::propertiesChanged(BaseInstance *inst)
if (i != -1)
{
emit dataChanged(index(i), index(i));
updateTotalPlayTime();
}
}
@ -848,4 +859,9 @@ bool InstanceList::destroyStagingPath(const QString& keyPath)
return FS::deletePath(keyPath);
}
#include "InstanceList.moc"
int InstanceList::getTotalPlayTime() {
updateTotalPlayTime();
return totalPlayTime;
}
#include "InstanceList.moc"