aboutsummaryrefslogtreecommitdiff
path: root/replaydata.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-11 01:16:26 +0200
committerJavier <dev.git@javispedro.com>2015-06-11 01:16:26 +0200
commit6cb50e66f3c196a2a4bcc95a419260d6b8c2461f (patch)
tree610963526dbd205500db145965309b1de2b18a97 /replaydata.h
parenta69e97943539a8abc4d2762638c169dc19c88516 (diff)
downloadscribiu-6cb50e66f3c196a2a4bcc95a419260d6b8c2461f.tar.gz
scribiu-6cb50e66f3c196a2a4bcc95a419260d6b8c2461f.zip
experiment with audio/paperreplay data
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