4 #include <QAbstractListModel>
12 /** Library of books. */
13 class Library: public QAbstractListModel
19 BookRole = Qt::UserRole + 1,
22 static Library *instance();
24 int rowCount(const QModelIndex & parent = QModelIndex()) const;
25 QVariant data(const QModelIndex &index, int role) const;
27 int find(QString path) const;
28 int find(const Book *book) const;
29 Book *at(int index) const;
31 Book *current() const;
32 bool add(QString path);
33 void remove(int index);
34 void setCurrent(int index);
37 void currentBookChanged();
40 explicit Library(QObject *parent = 0);
44 static Library *mInstance;