diff options
author | Javier <dev.git@javispedro.com> | 2015-06-14 01:35:25 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2015-06-14 01:35:25 +0200 |
commit | 59feffc5a253fec33b310f7a0105c8ef42b9019b (patch) | |
tree | 855c7c86b4413d813d2a6c40d167eb78ee3250d3 /paperreplay.h | |
parent | 72a71a2003028fc97d74cebecebb1541d66ded86 (diff) | |
download | scribiu-59feffc5a253fec33b310f7a0105c8ef42b9019b.tar.gz scribiu-59feffc5a253fec33b310f7a0105c8ef42b9019b.zip |
paperreplay working
Diffstat (limited to 'paperreplay.h')
-rw-r--r-- | paperreplay.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/paperreplay.h b/paperreplay.h index e771584..c9eb6f2 100644 --- a/paperreplay.h +++ b/paperreplay.h @@ -1,10 +1,9 @@ #ifndef PAPERREPLAY_H #define PAPERREPLAY_H -#include <QtCore/QDateTime> #include <QtCore/QDir> #include <QtCore/QHash> -#include <QtCore/QMultiMap> +#include <QtCore/QMap> #include <QtCore/QVector> #define PAPER_REPLAY "Paper Replay" @@ -14,8 +13,9 @@ class PaperReplay : public QObject Q_OBJECT struct SessionData : public QSharedData { + quint64 id; QString name; - QDateTime start, end; + qint64 start, end; QVector<quint64> pages; QString file; }; @@ -28,26 +28,45 @@ public: Session(); ~Session(); + bool isValid() const; + + quint64 id() const; + QString name() const; - QDateTime startTime() const; - QDateTime endTime() const; + qint64 startTime() const; + qint64 endTime() const; QVector<quint64> pages() const; QString fileName() const; private: + Session(quint64 id); QSharedDataPointer<SessionData> d; friend class PaperReplay; + friend class SessionList; + }; + + class SessionList { + public: + SessionList(); + + QList<Session> sessionsDuringTime(qint64 time) const; + + private: + explicit SessionList(const QMap<qint64, Session>& byTime); + + QMap<qint64, Session> _m; + + friend class PaperReplay; }; bool open(const QString &path, const QString &penSerial, quint64 notebookGuid); void close(); - QList<Session> sessions() const; - QList<Session> sessions(quint64 pageAddress) const; + SessionList sessions(quint64 pageAddress) const; private: static bool parseSessionInfo(SessionData *session, const QString &path); @@ -60,8 +79,7 @@ private: private: QDir _dir; - QHash<quint64, Session> _sessions; - QMultiMap<quint64, quint64> _byPage; + QMap<quint64, QMap<qint64, Session> > _byPageTime; }; #endif // PAPERREPLAY_H |