Mercurial > minori
comparison include/gui/widgets/anime_info.h @ 320:1b5c04268d6a
services/kitsu: ACTUALLY finish GetAnimeList
there are some things the API just... doesn't provide. therefore
we have to request the genres separately any time a new anime info
box is opened...
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 19:49:19 -0400 |
parents | b1f625b0227c |
children |
comparison
equal
deleted
inserted
replaced
319:d928ec7b6a0d | 320:1b5c04268d6a |
---|---|
1 #ifndef MINORI_GUI_WIDGETS_ANIME_INFO_H_ | 1 #ifndef MINORI_GUI_WIDGETS_ANIME_INFO_H_ |
2 #define MINORI_GUI_WIDGETS_ANIME_INFO_H_ | 2 #define MINORI_GUI_WIDGETS_ANIME_INFO_H_ |
3 | 3 |
4 #include <QWidget> | 4 #include <QWidget> |
5 #include <QThread> | |
5 #include "gui/widgets/text.h" | 6 #include "gui/widgets/text.h" |
7 | |
8 #include <mutex> | |
9 #include <queue> | |
6 | 10 |
7 namespace Anime { | 11 namespace Anime { |
8 class Anime; | 12 class Anime; |
9 } | 13 } |
14 | |
15 class AnimeInfoWidgetGetMetadataThread final : public QThread { | |
16 Q_OBJECT | |
17 | |
18 public: | |
19 AnimeInfoWidgetGetMetadataThread(QObject* parent = nullptr); | |
20 | |
21 void AddToQueue(int id); | |
22 | |
23 signals: | |
24 void NeedRefresh(int id); | |
25 | |
26 protected: | |
27 void run() override; | |
28 | |
29 private: | |
30 std::mutex queue_mutex_; | |
31 std::queue<int> queue_; | |
32 }; | |
10 | 33 |
11 class AnimeInfoWidget final : public QWidget { | 34 class AnimeInfoWidget final : public QWidget { |
12 Q_OBJECT | 35 Q_OBJECT |
13 | 36 |
14 public: | 37 public: |
15 AnimeInfoWidget(QWidget* parent = nullptr); | 38 AnimeInfoWidget(QWidget* parent = nullptr); |
16 AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent = nullptr); | 39 AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent = nullptr); |
17 void SetAnime(const Anime::Anime& anime); | 40 void SetAnime(const Anime::Anime& anime); |
18 | 41 |
42 protected: | |
43 void RefreshGenres(const Anime::Anime& anime); | |
44 | |
19 private: | 45 private: |
20 TextWidgets::OneLineSection _title; | 46 TextWidgets::OneLineSection _title; |
21 TextWidgets::LabelledSection _details; | 47 TextWidgets::LabelledSection _details; |
22 TextWidgets::SelectableSection _synopsis; | 48 TextWidgets::SelectableSection _synopsis; |
49 | |
50 int id_ = 0; | |
23 }; | 51 }; |
24 | 52 |
25 #endif // MINORI_GUI_WIDGETS_ANIME_INFO_H_ | 53 #endif // MINORI_GUI_WIDGETS_ANIME_INFO_H_ |