aboutsummaryrefslogtreecommitdiff
path: root/paperreplay.h
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 /paperreplay.h
parent66dd35254724ec5d4471a8be71f92e06cf0fa8e8 (diff)
downloadscribiu-ac7b085449fb49f54225d22c7c229da6ad120e2b.tar.gz
scribiu-ac7b085449fb49f54225d22c7c229da6ad120e2b.zip
remove PEN_EPOCH mistake and get usertime from the pen
Diffstat (limited to 'paperreplay.h')
-rw-r--r--paperreplay.h53
1 files changed, 32 insertions, 21 deletions
diff --git a/paperreplay.h b/paperreplay.h
index 9e61af7..62a75a6 100644
--- a/paperreplay.h
+++ b/paperreplay.h
@@ -24,18 +24,26 @@
#include <QtCore/QMap>
#include <QtCore/QVector>
-/** Name of the paper replay notebook */
+/** Name of the paper replay "fake" notebook.
+ * Contains all paper replay sessions not tied to another notebook. */
#define PAPER_REPLAY "Paper Replay"
+#define PAPER_REPLAY_GUID 0
class PaperReplay : public QObject
{
Q_OBJECT
+public:
+ typedef quint64 SessionId;
+ typedef quint64 PenTime;
+ typedef quint64 PageAddress;
+
+private:
struct SessionData : public QSharedData {
- quint64 id;
+ SessionId id;
QString name;
- qint64 start, end;
- QVector<quint64> pages;
+ PenTime start, end;
+ QVector<PageAddress> pages;
QString file;
};
@@ -49,12 +57,12 @@ public:
bool isValid() const;
- quint64 id() const;
+ SessionId id() const;
QString name() const;
- qint64 startTime() const;
- qint64 endTime() const;
+ PenTime startTime() const;
+ PenTime endTime() const;
QVector<quint64> pages() const;
@@ -63,7 +71,7 @@ public:
static bool startTimeLess(const Session &a, const Session &b);
private:
- Session(quint64 id);
+ Session(SessionId id);
QSharedDataPointer<SessionData> d;
friend class PaperReplay;
@@ -74,35 +82,38 @@ public:
public:
SessionList();
- QList<Session> sessionsDuringTime(qint64 time) const;
+ QList<Session> sessionsDuringTime(PenTime time) const;
private:
- explicit SessionList(const QMap<qint64, Session>& byTime);
+ explicit SessionList(const QMap<PenTime, Session>& byTime);
- QMap<qint64, Session> _m;
+ QMap<PenTime, Session> _m;
friend class PaperReplay;
};
- bool open(const QString &path, quint64 notebookGuid = 0);
+ bool open(const QString &path, quint64 notebookGuid, PenTime userTime);
void close();
QList<Session> sessions() const;
- SessionList sessions(quint64 pageAddress) const;
+ SessionList sessions(PageAddress pageAddress) const;
+
+ PenTime userTime() const;
private:
- static bool parseSessionInfo(SessionData *session, const QString &path);
- static bool parseSessionInfo(SessionData *session, QIODevice *dev);
- static bool parseSessionInfoV3(SessionData *session, QIODevice *dev);
+ bool parseSessionInfo(SessionData *session, const QString &path) const;
+ bool parseSessionInfo(SessionData *session, QIODevice *dev) const;
+ bool parseSessionInfoV3(SessionData *session, QIODevice *dev) const;
- static bool parseSessionPages(SessionData *session, const QString &path);
- static bool parseSessionPages(SessionData *session, QIODevice *dev);
- static bool parseSessionPagesV1(SessionData *session, QIODevice *dev);
+ bool parseSessionPages(SessionData *session, const QString &path) const;
+ bool parseSessionPages(SessionData *session, QIODevice *dev) const;
+ bool parseSessionPagesV1(SessionData *session, QIODevice *dev) const;
private:
QDir _dir;
- QHash<quint64, Session> _sessions;
- QMap<quint64, QMap<qint64, Session> > _byPageTime;
+ QHash<PageAddress, Session> _sessions;
+ QMap<PageAddress, QMap<PenTime, Session> > _byPageTime;
+ PenTime _userTime;
};
#endif // PAPERREPLAY_H