comparison include/gui/pages/anime_list.h @ 307:8769c5d50b06

pages/anime_list: don't call GUI functions in a non-GUI thread
author Paper <paper@paper.us.eu.org>
date Sun, 19 May 2024 18:25:14 -0400
parents 9a88e1725fd2
children 1b5c04268d6a
comparison
equal deleted inserted replaced
306:f4538a4c91ba 307:8769c5d50b06
13 class QTreeView; 13 class QTreeView;
14 class QTabBar; 14 class QTabBar;
15 class AnimeListPage; 15 class AnimeListPage;
16 16
17 class AnimeListPageUpdateEntryThread final : public QThread { 17 class AnimeListPageUpdateEntryThread final : public QThread {
18 Q_OBJECT
19
18 public: 20 public:
19 AnimeListPageUpdateEntryThread(AnimeListPage* parent); 21 AnimeListPageUpdateEntryThread(AnimeListPage* parent);
20 22
21 void AddToQueue(int id); 23 void AddToQueue(int id);
24
25 signals:
26 void NeedRefresh();
22 27
23 protected: 28 protected:
24 void run() override; 29 void run() override;
25 30
26 private: 31 private:
71 private: 76 private:
72 Anime::ListStatus status; 77 Anime::ListStatus status;
73 std::vector<Anime::Anime> list; 78 std::vector<Anime::Anime> list;
74 }; 79 };
75 80
76 /* todo: rename these to "page" or something more
77 sensible than "widget" */
78 class AnimeListPage final : public QWidget { 81 class AnimeListPage final : public QWidget {
79 Q_OBJECT 82 Q_OBJECT
80 83
81 public: 84 public:
82 AnimeListPage(QWidget* parent = nullptr); 85 AnimeListPage(QWidget* parent = nullptr);
86
87 public slots:
83 void Refresh(); 88 void Refresh();
84 89
85 protected: 90 protected:
86 void paintEvent(QPaintEvent*) override; 91 void paintEvent(QPaintEvent*) override;
87 void InitStyle(QStyleOptionTabWidgetFrame* option) const; 92 void InitStyle(QStyleOptionTabWidgetFrame* option) const;