4 #include <QAbstractListModel>
13 /** Library of books. */
14 class Library: public QAbstractListModel
20 BookRole = Qt::UserRole + 1,
23 static Library *instance();
25 int rowCount(const QModelIndex &parent = QModelIndex()) const;
26 QVariant data(const QModelIndex &index, int role) const;
28 QModelIndex find(QString path) const;
29 QModelIndex find(const Book *book) const;
30 Book *current() const;
31 bool add(QString path);
32 void remove(const QModelIndex &index);
33 void setCurrent(const QModelIndex index);
36 void currentBookChanged();
39 explicit Library(QObject *parent = 0);
43 static Library *mInstance;