From ee1d4acb51013bd54f30ef8b626d4408f033d58c Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sat, 1 Oct 2022 18:22:36 +0200 Subject: [PATCH] fix: handle last play of 0 Signed-off-by: Sefa Eyeoglu --- launcher/ui/instanceview/InstanceProxyModel.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/launcher/ui/instanceview/InstanceProxyModel.cpp b/launcher/ui/instanceview/InstanceProxyModel.cpp index 05f749cf2..6b5146a5e 100644 --- a/launcher/ui/instanceview/InstanceProxyModel.cpp +++ b/launcher/ui/instanceview/InstanceProxyModel.cpp @@ -15,7 +15,7 @@ #include "InstanceProxyModel.h" -#include "InstanceView.h" +#include "InstanceList.h" #include "Application.h" #include @@ -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; -} \ No newline at end of file +}