Mercurial > minori
annotate include/gui/pages/search.h @ 263:96416310ea14
pages/seasons: finish season menu implementation
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 03 Apr 2024 20:46:40 -0400 |
parents | 3ec7804abf17 |
children | f31305b9f60a |
rev | line source |
---|---|
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
1 #ifndef MINORI_GUI_PAGES_SEARCH_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
2 #define MINORI_GUI_PAGES_SEARCH_H_ |
250 | 3 |
4 #include "core/anime.h" | |
5 | |
258 | 6 #include <QAbstractListModel> |
250 | 7 #include <QFrame> |
258 | 8 #include <QItemSelection> |
250 | 9 #include <QSortFilterProxyModel> |
10 | |
11 class QTreeView; | |
12 | |
13 class SearchPageListSortFilter final : public QSortFilterProxyModel { | |
258 | 14 Q_OBJECT |
250 | 15 |
258 | 16 public: |
17 SearchPageListSortFilter(QObject* parent = nullptr); | |
250 | 18 |
258 | 19 protected: |
20 bool lessThan(const QModelIndex& l, const QModelIndex& r) const override; | |
250 | 21 }; |
22 | |
23 class SearchPageListModel final : public QAbstractListModel { | |
258 | 24 Q_OBJECT |
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
25 |
258 | 26 public: |
27 enum columns { | |
28 SR_TITLE, | |
29 SR_TYPE, | |
30 SR_EPISODES, | |
31 SR_SCORE, | |
32 SR_SEASON, | |
250 | 33 |
258 | 34 NB_COLUMNS |
35 }; | |
250 | 36 |
258 | 37 SearchPageListModel(QObject* parent); |
38 ~SearchPageListModel() override = default; | |
39 int rowCount(const QModelIndex& parent = QModelIndex()) const override; | |
40 int columnCount(const QModelIndex& parent = QModelIndex()) const override; | |
41 QVariant data(const QModelIndex& index, int role) const override; | |
42 QVariant headerData(const int section, const Qt::Orientation orientation, const int role) const override; | |
43 Qt::ItemFlags flags(const QModelIndex& index) const override; | |
250 | 44 |
258 | 45 void ParseSearch(const std::vector<int>& ids); |
46 Anime::Anime* GetAnimeFromIndex(const QModelIndex& index) const; | |
250 | 47 |
258 | 48 private: |
49 std::vector<int> ids; | |
250 | 50 }; |
51 | |
52 class SearchPage final : public QFrame { | |
258 | 53 Q_OBJECT |
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
54 |
258 | 55 public: |
56 SearchPage(QWidget* parent = nullptr); | |
57 void Search(const std::string& search); | |
58 void DisplayListMenu(); | |
59 void ItemDoubleClicked(); | |
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
60 |
258 | 61 private: |
62 SearchPageListModel* model = nullptr; | |
63 SearchPageListSortFilter* sort_model = nullptr; | |
64 QTreeView* treeview = nullptr; | |
250 | 65 }; |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
66 #endif // MINORI_GUI_PAGES_SEARCH_H_ |