diff options
Diffstat (limited to 'pageitem.cc')
-rw-r--r-- | pageitem.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pageitem.cc b/pageitem.cc index f938eeb..3bd5b7f 100644 --- a/pageitem.cc +++ b/pageitem.cc @@ -3,8 +3,8 @@ #include "pageitem.h" #include "stfgraphicsitem.h" -PageItem::PageItem(AfdNotebook *nb, int pageNum, QGraphicsItem *parent) : - QGraphicsItem(parent), _nb(nb), _pageNum(pageNum), _strokesLoaded(false) +PageItem::PageItem(AfdNotebook *nb, PaperReplay *replay, int pageNum, QGraphicsItem *parent) : + QGraphicsItem(parent), _nb(nb), _replay(replay), _pageNum(pageNum), _strokesLoaded(false) { _pageSize = _nb->getPageSize(pageNum); _pageTrim = _nb->getPageTrim(pageNum); @@ -51,6 +51,13 @@ void PageItem::createStrokes() { QStringList pens = _nb->penSerials(); if (pens.isEmpty()) return; + + // Load paper replay data if available + AfdPageAddress pageAddr = _nb->getPageAddress(_pageNum); + PaperReplay::SessionList replays = _replay ? _replay->sessions(pageAddr.toUInt64()) : PaperReplay::SessionList(); + + // Now create a new StfGraphicsItem for every stroke file + // Which will in turn create a stroke item for every stroke QStringList strokeFiles = _nb->strokeFiles(pens.first(), _pageNum); foreach (const QString &strokeFile, strokeFiles) { QFile f(strokeFile); @@ -58,7 +65,8 @@ void PageItem::createStrokes() qWarning() << "Could not open stroke file:" << strokeFile; continue; } - new StfGraphicsItem(&f, this); + new StfGraphicsItem(&f, replays, this); } + qDebug() << "strokes loaded for page" << _pageNum; } |