Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
326:10096c5489e3 | 327:b5d6c27c308f |
---|---|
11 #include <queue> | 11 #include <queue> |
12 | 12 |
13 class QListWidget; | 13 class QListWidget; |
14 class QToolButton; | 14 class QToolButton; |
15 | 15 |
16 Q_DECLARE_METATYPE(Anime::SeriesSeason); | 16 Q_DECLARE_METATYPE(Anime::Season); |
17 Q_DECLARE_METATYPE(Date::Year); | |
18 | 17 |
19 class SeasonsPageSearchThread : public QThread { | 18 class SeasonsPageSearchThread : public QThread { |
20 Q_OBJECT | 19 Q_OBJECT |
21 | 20 |
22 public: | 21 public: |
23 SeasonsPageSearchThread(QObject* parent = nullptr); | 22 SeasonsPageSearchThread(QObject* parent = nullptr); |
24 void AddToQueue(Anime::SeriesSeason season, Date::Year year); | 23 void AddToQueue(Anime::Season season); |
25 | 24 |
26 protected: | 25 protected: |
27 void run() override; | 26 void run() override; |
28 | 27 |
29 private: | 28 private: |
30 struct Season { | 29 std::queue<Anime::Season> queue_; |
31 Anime::SeriesSeason season; | |
32 Date::Year year; | |
33 }; | |
34 | |
35 std::queue<Season> queue_; | |
36 std::mutex queue_mutex_; | 30 std::mutex queue_mutex_; |
37 | 31 |
38 signals: | 32 signals: |
39 void ReceivedSeason(Anime::SeriesSeason season, Date::Year year); | 33 void ReceivedSeason(Anime::Season season); |
40 }; | 34 }; |
41 | 35 |
42 class SeasonsPage final : public QFrame { | 36 class SeasonsPage final : public QFrame { |
43 Q_OBJECT | 37 Q_OBJECT |
44 | 38 |
45 public: | 39 public: |
46 SeasonsPage(QWidget* parent = nullptr); | 40 SeasonsPage(QWidget* parent = nullptr); |
47 void SetSeason(Anime::SeriesSeason season, Date::Year year); | 41 void SetSeason(Anime::Season season); |
48 void Refresh(); | 42 void Refresh(); |
49 | 43 |
50 protected: | 44 protected: |
51 QListWidget* buttons = nullptr; | 45 QListWidget* buttons = nullptr; |
52 QToolButton* season_button = nullptr; | 46 QToolButton* season_button = nullptr; |
53 | 47 |
54 Anime::SeriesSeason season_; | 48 Anime::Season season_; |
55 Date::Year year_; | |
56 }; | 49 }; |
57 | 50 |
58 #endif // MINORI_GUI_PAGES_SEASONS_H_ | 51 #endif // MINORI_GUI_PAGES_SEASONS_H_ |