diff 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
line wrap: on
line diff
--- a/include/gui/widgets/anime_info.h	Wed Jun 12 17:52:26 2024 -0400
+++ b/include/gui/widgets/anime_info.h	Wed Jun 12 19:49:19 2024 -0400
@@ -2,12 +2,35 @@
 #define MINORI_GUI_WIDGETS_ANIME_INFO_H_
 
 #include <QWidget>
+#include <QThread>
 #include "gui/widgets/text.h"
 
+#include <mutex>
+#include <queue>
+
 namespace Anime {
 class Anime;
 }
 
+class AnimeInfoWidgetGetMetadataThread final : public QThread {
+	Q_OBJECT
+
+public:
+	AnimeInfoWidgetGetMetadataThread(QObject* parent = nullptr);
+
+	void AddToQueue(int id);
+
+signals:
+	void NeedRefresh(int id);
+
+protected:
+	void run() override;
+
+private:
+	std::mutex queue_mutex_;
+	std::queue<int> queue_;
+};
+
 class AnimeInfoWidget final : public QWidget {
 	Q_OBJECT
 
@@ -16,10 +39,15 @@
 	AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent = nullptr);
 	void SetAnime(const Anime::Anime& anime);
 
+protected:
+	void RefreshGenres(const Anime::Anime& anime);
+
 private:
 	TextWidgets::OneLineSection _title;
 	TextWidgets::LabelledSection _details;
 	TextWidgets::SelectableSection _synopsis;
+
+	int id_ = 0;
 };
 
 #endif // MINORI_GUI_WIDGETS_ANIME_INFO_H_