annotate include/gui/pages/search.h @ 341:052ec053ee37

dep/animone: a11y/win32: fix missing ComInterface definition
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 23:21:19 -0400
parents f31305b9f60a
children
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>
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
10 #include <QThread>
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
11
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
12 class QTreeView;
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
13
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
14 class SearchPageSearchThread : public QThread {
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
15 Q_OBJECT
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
16
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
17 public:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
18 SearchPageSearchThread(QObject* parent = nullptr);
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
19 void SetSearch(const std::string& search);
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
20
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
21 protected:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
22 void run() override;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
23
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
24 private:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
25 std::string search_;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
26
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
27 signals:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
28 void GotResults(const std::vector<int>& search);
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
29 };
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
30
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
31 class SearchPageListSortFilter final : public QSortFilterProxyModel {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
32 Q_OBJECT
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 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
35 SearchPageListSortFilter(QObject* parent = nullptr);
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 protected:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
38 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
39 };
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
40
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
41 class SearchPageListModel final : public QAbstractListModel {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
42 Q_OBJECT
54
466ac9870df9 add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
44 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
45 enum columns {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
46 SR_TITLE,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
47 SR_TYPE,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
48 SR_EPISODES,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
49 SR_SCORE,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
50 SR_SEASON,
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
51
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
52 NB_COLUMNS
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
53 };
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
54
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
55 SearchPageListModel(QObject* parent);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
56 ~SearchPageListModel() override = default;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
57 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
58 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
59 QVariant data(const QModelIndex& index, int role) const override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
60 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
61 Qt::ItemFlags flags(const QModelIndex& index) const override;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
62
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
63 void ParseSearch(const std::vector<int>& ids);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
64 Anime::Anime* GetAnimeFromIndex(const QModelIndex& index) const;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
65
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
66 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
67 std::vector<int> ids;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
68 };
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
69
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
70 class SearchPage final : public QFrame {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
71 Q_OBJECT
54
466ac9870df9 add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
73 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
74 SearchPage(QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
75 void Search(const std::string& search);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
76 void DisplayListMenu();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
77 void ItemDoubleClicked();
54
466ac9870df9 add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
78
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
79 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
80 SearchPageListModel* model = nullptr;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
81 SearchPageListSortFilter* sort_model = nullptr;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
82 QTreeView* treeview = nullptr;
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
83
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
84 SearchPageSearchThread thread_;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 95
diff changeset
85 };
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
86 #endif // MINORI_GUI_PAGES_SEARCH_H_