12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifndef BOOK_H
- #define BOOK_H
- #include <QObject>
- #include <QtDeclarative/QDeclarativeItem>
- #include <QStringList>
- #include <QPixmap>
- #include <QUrl>
- class BookPage;
- class Book : public QObject
- {
- Q_OBJECT
- //Q_DISABLE_COPY(Book)
- Q_PROPERTY(QString name READ getBookName CONSTANT)
- Q_PROPERTY(QUrl image READ getListImage CONSTANT)
- Q_PROPERTY(QDeclarativeListProperty<BookPage> pages READ pages CONSTANT)
- Q_PROPERTY(int count READ count CONSTANT)
- public:
- Book(QObject *parent = 0);
- ~Book();
- enum ArchiveType {
- Nothing,
- Zip,
- Rar
- };
- QDeclarativeListProperty<BookPage> pages();
- int count() const;
- void setFilenameList(QStringList& list);
- void setBookName(QString name);
- QString getBookName();
- void setListImage(QUrl img);
- QUrl getListImage();
- void setBookArchiveName(QString name);
- QString getBookArchiveName();
- Book::ArchiveType getArchiveType();
- void setFirstPageFilename(QString name);
- QString getFirstPageFilename();
- signals:
- void imageFilesReady();
- public slots:
- private:
- static BookPage* atFunction(QDeclarativeListProperty<BookPage> *property, int index);
- static int countFunction(QDeclarativeListProperty<BookPage> *property);
- private:
- QList<BookPage*> m_pages;
- QString m_bookname;
- QUrl m_img;
- QString m_archiveName;
- QString m_firstPageFilename;
- };
- QML_DECLARE_TYPE(Book)
- #endif // BOOK_H
|