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;
25 QModelIndex find(QString path) const;
26 QModelIndex find(const Book *book) const;
27 void setNowReading(const QModelIndex &index);
28 QModelIndex nowReading() const;
29 Book *book(const QModelIndex &index);
30 QStringList bookPaths();
34 void nowReadingChanged();
35 void beginUpgrade(int total);
36 void upgrading(const QString &book);
40 bool add(const QString &path);
41 void remove(const QString &path);
42 void remove(const QModelIndex &index);
43 void onBookOpened(const QString &path);
46 explicit Library(QObject *parent = 0);
49 static Library *mInstance;
51 QModelIndex mNowReading;