aboutsummaryrefslogtreecommitdiff
path: root/paperreplay.h
blob: 8ad7331a046c1f42d0302b33b0d63b5e3af73de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef PAPERREPLAY_H
#define PAPERREPLAY_H

#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtCore/QHash>
#include <QtCore/QMultiMap>
#include <QtCore/QVector>

#define PAPER_REPLAY "Paper Replay"

class PaperReplay : public QObject
{
	Q_OBJECT

public:
	explicit PaperReplay(QObject *parent = 0);

	bool open(const QString &path, const QString &penSerial, quint64 notebookGuid);
	void close();

	struct Session {
		QDateTime start, end;
		QString name;
		QVector<quint64> pages;
		QString file;
	};

	QList<Session> sessions();
	QList<Session> sessions(quint64 pageAddress);

private:
	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, Session> _sessions;
	QMultiMap<quint64, quint64> _byPage;
};

#endif // PAPERREPLAY_H