Sort library by author or title. Sort books by two levels.
[dorian] / model / sortedlibrary.h
index f677684..3720fb0 100644 (file)
@@ -2,7 +2,8 @@
 #define SORTEDLIBRARY_H
 
 #include <QSortFilterProxyModel>
-#include "library.h"
+
+class Book;
 
 /** Sorted library model. */
 class SortedLibrary: public QSortFilterProxyModel
@@ -13,13 +14,17 @@ public:
     enum SortBy {SortByTitle, SortByAuthor};
     explicit SortedLibrary(QObject *parent = 0);
     bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
-    void sortBy(SortBy key);
+    void setSortBy(SortBy key);
+    SortBy sortBy();
 
 signals:
 
 public slots:
 
 protected:
+    int compareBy(SortBy key, Book *left, Book *right) const;
+
+private:
     SortBy mSortBy;
 };