aboutsummaryrefslogtreecommitdiff
path: root/paperreplaymodel.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2021-09-12 19:41:12 +0200
committerJavier <dev.git@javispedro.com>2021-09-12 19:41:12 +0200
commitac7b085449fb49f54225d22c7c229da6ad120e2b (patch)
tree7910cc8c9a3268dbacbbe434c7f3cea4eedafd3d /paperreplaymodel.cc
parent66dd35254724ec5d4471a8be71f92e06cf0fa8e8 (diff)
downloadscribiu-ac7b085449fb49f54225d22c7c229da6ad120e2b.tar.gz
scribiu-ac7b085449fb49f54225d22c7c229da6ad120e2b.zip
remove PEN_EPOCH mistake and get usertime from the pen
Diffstat (limited to 'paperreplaymodel.cc')
-rw-r--r--paperreplaymodel.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/paperreplaymodel.cc b/paperreplaymodel.cc
index 480968f..4c40f76 100644
--- a/paperreplaymodel.cc
+++ b/paperreplaymodel.cc
@@ -102,30 +102,25 @@ void PaperReplayModel::refresh()
endResetModel();
}
-QString PaperReplayModel::getSessionName(const PaperReplay::Session &session)
+QString PaperReplayModel::getSessionName(const PaperReplay::Session &session) const
{
QString title = session.name();
if (title.isEmpty()) {
- QDateTime date = Smartpen::fromPenTime(session.startTime());
+ QDateTime date = Smartpen::fromPenTime(_replay->userTime(), session.startTime());
title = date.toString(Qt::DefaultLocaleLongDate);
}
return title;
}
-QString PaperReplayModel::getSessionDate(const PaperReplay::Session &session)
+QString PaperReplayModel::getSessionLength(const PaperReplay::Session &session) const
{
- QDateTime date = Smartpen::fromPenTime(session.startTime());
- return date.toString(Qt::DefaultLocaleShortDate);
-}
-
-QString PaperReplayModel::getSessionLength(const PaperReplay::Session &session)
-{
- int secs = Smartpen::fromPenTime(session.startTime()).secsTo(Smartpen::fromPenTime(session.endTime()));
- int mins = secs / 60;
+ qint64 msecs = session.endTime() - session.startTime();
+ uint secs = msecs / 1000;
+ uint mins = secs / 60;
secs %= 60;
- int hours = mins / 60;
+ uint hours = mins / 60;
mins %= 60;
const QChar fill('0');