aboutsummaryrefslogtreecommitdiff
path: root/replaydata.h
diff options
context:
space:
mode:
Diffstat (limited to 'replaydata.h')
-rw-r--r--replaydata.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/replaydata.h b/replaydata.h
new file mode 100644
index 0000000..39b1e0e
--- /dev/null
+++ b/replaydata.h
@@ -0,0 +1,53 @@
+#ifndef REPLAYDATA_H
+#define REPLAYDATA_H
+
+#include <QtCore/QDateTime>
+#include <QtCore/QDir>
+#include <QtCore/QHash>
+#include <QtCore/QMultiMap>
+#include <QtCore/QVector>
+
+class ReplayData : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit ReplayData(QObject *parent = 0);
+
+ bool open(const QString &path);
+ void close();
+
+ struct Session {
+ QDateTime start, end;
+ QString name;
+ QVector<quint64> pages;
+ QString file;
+ };
+
+ QList<Session> sessions(quint64 penId, quint64 notebookId);
+ QList<Session> sessions(quint64 penId, quint64 notebookId, quint64 pageAddress);
+
+private:
+ struct NotebookData {
+ QHash<uint, Session> sessions;
+ QMultiMap<quint64, uint> byPage;
+ };
+
+private:
+ bool findSessions();
+
+ static bool parseSessionInfo(Session &session, const QString &path);
+ static bool parseSessionInfo(Session &session, QIODevice *dev);
+ static bool parseSessionInfoV3(Session &session, QIODevice *dev);
+
+ static bool parseSessionPages(Session &session, const QString &path);
+ static bool parseSessionPages(Session &session, QIODevice *dev);
+ static bool parseSessionPagesV1(Session &session, QIODevice *dev);
+
+private:
+ QDir _dir;
+ QHash<quint64, QHash<quint64, NotebookData> > _notebooks; // TODO Cache on demand
+ // /userdata/XXX-XXX-XXX-XX/Paper Replay/99/0bf11a726d11f3f3/sessions/PRS-21977890a4
+};
+
+#endif // REPLAYDATA_H