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();
32 void nowReadingChanged();
35 bool add(const QString &path);
36 void remove(const QString &path);
37 void remove(const QModelIndex &index);
38 void onBookOpened(const QString &path);
41 explicit Library(QObject *parent = 0);
45 static Library *mInstance;
47 QModelIndex mNowReading;