4 #include <QAbstractListModel>
13 /** Library of books. */
14 class Library: public QAbstractListModel
19 static Library *instance();
21 int rowCount(const QModelIndex &parent = QModelIndex()) const;
22 QVariant data(const QModelIndex &index, int role) const;
24 QModelIndex find(QString path) const;
25 QModelIndex find(const Book *book) const;
26 void setNowReading(const QModelIndex &index);
27 QModelIndex nowReading() const;
28 Book *book(const QModelIndex &index);
29 QStringList bookPaths();
30 QStringList folders() const;
31 bool addFolder(const QString &folder);
32 bool removeFolder(const QString &folder);
36 void nowReadingChanged();
39 bool add(const QString &path);
40 void remove(const QString &path);
41 void remove(const QModelIndex &index);
42 void onBookOpened(const QString &path);
45 explicit Library(QObject *parent = 0);
49 static Library *mInstance;
51 QModelIndex mNowReading;