Mercurial > minori
annotate include/gui/pages/seasons.h @ 327:b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
ToLocalString has also been altered to take in both season
and year because lots of locales actually treat formatting
seasons differently! most notably is Russian which adds a
suffix at the end to notate seasons(??)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 13 Jun 2024 01:49:18 -0400 |
parents | 78929794e7d8 |
children | 6b0768158dcd |
rev | line source |
---|---|
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
1 #ifndef MINORI_GUI_PAGES_SEASONS_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
2 #define MINORI_GUI_PAGES_SEASONS_H_ |
85 | 3 |
295 | 4 #include <QFrame> |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
5 #include <QThread> |
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
6 |
260
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
255
diff
changeset
|
7 #include "core/anime.h" |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
255
diff
changeset
|
8 #include "core/date.h" |
dd211ff68b36
pages/seasons: add initial functionality
Paper <paper@paper.us.eu.org>
parents:
255
diff
changeset
|
9 |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
10 #include <utility> |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
11 #include <queue> |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
12 |
254
d14f8e0e40c3
[UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents:
95
diff
changeset
|
13 class QListWidget; |
263
96416310ea14
pages/seasons: finish season menu implementation
Paper <paper@paper.us.eu.org>
parents:
261
diff
changeset
|
14 class QToolButton; |
254
d14f8e0e40c3
[UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents:
95
diff
changeset
|
15 |
327
b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents:
325
diff
changeset
|
16 Q_DECLARE_METATYPE(Anime::Season); |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
17 |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
18 class SeasonsPageSearchThread : public QThread { |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
19 Q_OBJECT |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
20 |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
21 public: |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
22 SeasonsPageSearchThread(QObject* parent = nullptr); |
327
b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents:
325
diff
changeset
|
23 void AddToQueue(Anime::Season season); |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
24 |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
25 protected: |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
26 void run() override; |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
27 |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
28 private: |
327
b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents:
325
diff
changeset
|
29 std::queue<Anime::Season> queue_; |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
30 std::mutex queue_mutex_; |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
31 |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
32 signals: |
327
b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents:
325
diff
changeset
|
33 void ReceivedSeason(Anime::Season season); |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
34 }; |
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
35 |
295 | 36 class SeasonsPage final : public QFrame { |
255 | 37 Q_OBJECT |
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
38 |
255 | 39 public: |
40 SeasonsPage(QWidget* parent = nullptr); | |
327
b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents:
325
diff
changeset
|
41 void SetSeason(Anime::Season season); |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
42 void Refresh(); |
254
d14f8e0e40c3
[UNFINISHED] *: update anime button
Paper <paper@paper.us.eu.org>
parents:
95
diff
changeset
|
43 |
255 | 44 protected: |
45 QListWidget* buttons = nullptr; | |
263
96416310ea14
pages/seasons: finish season menu implementation
Paper <paper@paper.us.eu.org>
parents:
261
diff
changeset
|
46 QToolButton* season_button = nullptr; |
325
78929794e7d8
pages/seasons: run seasons search in a separate thread
Paper <paper@paper.us.eu.org>
parents:
295
diff
changeset
|
47 |
327
b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents:
325
diff
changeset
|
48 Anime::Season season_; |
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
49 }; |
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
50 |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
260
diff
changeset
|
51 #endif // MINORI_GUI_PAGES_SEASONS_H_ |