/* * scribiu -- read notebooks and voice memos from Livescribe pens * Copyright (C) 2015 Javier S. Pedro * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef AFDNOTEBOOK_H #define AFDNOTEBOOK_H #include #include #include #include #include "afdpageaddress.h" #include "stfreader.h" class AfdNotebook : public QObject { Q_OBJECT public: AfdNotebook(QObject *parent = 0); ~AfdNotebook(); bool open(const QString &path); void close(); QString title() const; quint64 guid() const; int numPages() const; AfdPageAddress getPageAddress(int pageNum) const; int getPageNumber(const AfdPageAddress &addr) const; QString getPageBackgroundName(int page) const; QPixmap getPageBackground(int page); QSize getPageSize(int page) const; QRect getPageTrim(int page) const; QStringList penSerials() const; QList pagesWithStrokes(const QString &penSerial) const; QStringList strokeFiles(const QString &penSerial, int page) const; private: struct Gfx { QString basename; }; struct Page { Gfx *gfx; QSize size; }; struct StrokeData { QString file; quint64 begin; quint64 end; static bool CompareByBeginTime(const StrokeData &a, const StrokeData &b) { return a.begin < b.begin; } }; struct PenData { // pageNum -> List of Strokes QMap> strokes; }; private: static QMap parsePropertyList(QIODevice *dev); QMap parsePropertyList(const QString &relativePath) const; bool parseMainInfo(); bool parseMainDocument(); bool parseGfx(const QString &file); bool findPenData(); private: QDir _dir; QString _title; quint64 _guid; AfdPageAddress _firstPage, _lastPage; uint _pagesPerBook; QMap _gfx; QList _pages; QMap _penData; }; #endif