annotate include/gui/pages/search.h @ 261:3ec7804abf17

include: make header guards more sane The C++ standard[1] says: Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use. [1]: https://timsong-cpp.github.io/cppwp/n4659/lex.name#3.1
author Paper <paper@paper.us.eu.org>
date Wed, 03 Apr 2024 20:04:28 -0400
parents 862d0d8619f6
children f31305b9f60a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
3
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
4 #include "core/anime.h"
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
5
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
6 #include <QAbstractListModel>
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
7 #include <QFrame>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
8 #include <QItemSelection>
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
9 #include <QSortFilterProxyModel>
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
10
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
11 class QTreeView;
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
12
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
13 class SearchPageListSortFilter final : public QSortFilterProxyModel {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
14 Q_OBJECT
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
15
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
16 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
17 SearchPageListSortFilter(QObject* parent = nullptr);
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
18
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
19 protected:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
20 bool lessThan(const QModelIndex& l, const QModelIndex& r) const override;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
21 };
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
22
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
23 class SearchPageListModel final : public QAbstractListModel {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
24 Q_OBJECT
54
466ac9870df9 add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
26 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
27 enum columns {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
28 SR_TITLE,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
29 SR_TYPE,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
30 SR_EPISODES,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
31 SR_SCORE,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
32 SR_SEASON,
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
33
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
34 NB_COLUMNS
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
35 };
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
36
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
37 SearchPageListModel(QObject* parent);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
38 ~SearchPageListModel() override = default;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
39 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
40 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
41 QVariant data(const QModelIndex& index, int role) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
42 QVariant headerData(const int section, const Qt::Orientation orientation, const int role) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
43 Qt::ItemFlags flags(const QModelIndex& index) const override;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
44
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
45 void ParseSearch(const std::vector<int>& ids);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
46 Anime::Anime* GetAnimeFromIndex(const QModelIndex& index) const;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
47
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
48 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
49 std::vector<int> ids;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
50 };
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
51
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
52 class SearchPage final : public QFrame {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
53 Q_OBJECT
54
466ac9870df9 add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
55 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
56 SearchPage(QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
57 void Search(const std::string& search);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
58 void DisplayListMenu();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
59 void ItemDoubleClicked();
54
466ac9870df9 add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
61 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
62 SearchPageListModel* model = nullptr;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
63 SearchPageListSortFilter* sort_model = nullptr;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
64 QTreeView* treeview = nullptr;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
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_