Added total playtime
This commit is contained in:
@ -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"
|
||||
|
@ -128,6 +128,8 @@ public:
|
||||
*/
|
||||
bool destroyStagingPath(const QString & keyPath);
|
||||
|
||||
int getTotalPlayTime();
|
||||
|
||||
signals:
|
||||
void dataIsInvalid();
|
||||
void instancesChanged();
|
||||
@ -145,6 +147,7 @@ private slots:
|
||||
|
||||
private:
|
||||
int getInstIndex(BaseInstance *inst) const;
|
||||
void updateTotalPlayTime();
|
||||
void suspendWatch();
|
||||
void resumeWatch();
|
||||
void add(const QList<InstancePtr> &list);
|
||||
@ -155,6 +158,7 @@ private:
|
||||
|
||||
private:
|
||||
int m_watchLevel = 0;
|
||||
int totalPlayTime = 0;
|
||||
bool m_dirty = false;
|
||||
QList<InstancePtr> m_instances;
|
||||
QSet<QString> m_groupNameCache;
|
||||
|
Reference in New Issue
Block a user