X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=library.h;h=a1ac1764ba43a52adbe7fd4de0a7294a94ff65b9;hb=826aea4a3e3f4b4361b7592ad824963a529ffefd;hp=103c3d42fa5bd6e8940f2163b79dabc155aee30b;hpb=2212ae3deae776458d273cd8e3047192cbe06544;p=dorian diff --git a/library.h b/library.h index 103c3d4..a1ac176 100644 --- a/library.h +++ b/library.h @@ -7,6 +7,7 @@ #include class QObject; +class QModelIndex; class Book; /** Library of books. */ @@ -17,22 +18,22 @@ class Library: public QAbstractListModel public: static Library *instance(); static void close(); - int rowCount(const QModelIndex & parent = QModelIndex()) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; void save(); - int find(QString path) const; - int find(const Book *book) const; - Book *at(int index) const; - int size() const; - Book *current() const; + QModelIndex find(QString path) const; + QModelIndex find(const Book *book) const; bool add(QString path); - void remove(int index); - void setCurrent(int index); + void remove(const QModelIndex &index); + void setNowReading(const QModelIndex &index); + QModelIndex nowReading() const; + Book *book(const QModelIndex &index); signals: - void bookAdded(); - void bookRemoved(int index); - void currentBookChanged(); + void nowReadingChanged(); + +public slots: + void onBookOpened(const QString &path); private: explicit Library(QObject *parent = 0); @@ -41,7 +42,7 @@ private: void clear(); static Library *mInstance; QList mBooks; - Book *mCurrent; + QModelIndex mNowReading; }; #endif // LIBRARY_H