fix: handle last play of 0

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-01 18:22:36 +02:00
parent 1e8c0ac36a
commit ee1d4acb51
No known key found for this signature in database
GPG Key ID: C10411294912A422

View File

@ -15,7 +15,7 @@
#include "InstanceProxyModel.h"
#include "InstanceView.h"
#include "InstanceList.h"
#include "Application.h"
#include <icons/IconList.h>
@ -34,5 +34,16 @@ QVariant InstanceProxyModel::data(const QModelIndex & index, int role) const
if (!data.toString().isEmpty())
return APPLICATION->icons()->getIcon(data.toString()); //FIXME: Needs QStyledItemDelegate
}
switch (index.column()) {
case InstanceList::LastPlayed: {
if (role == Qt::DisplayRole) {
QDateTime foo = data.toDateTime();
if (foo.isNull() || !foo.isValid() || foo.toMSecsSinceEpoch() == 0)
return tr("Never");
}
break;
}
}
return data;
}
}