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 bool add(QString path);
27 void remove(const QModelIndex &index);
28 void setNowReading(const QModelIndex &index);
29 QModelIndex nowReading() const;
30 Book *book(const QModelIndex &index);
33 void nowReadingChanged();
36 void onBookOpened(const QString &path);
39 explicit Library(QObject *parent = 0);
43 static Library *mInstance;
45 QModelIndex mNowReading;