Mercurial > minori
comparison include/gui/pages/now_playing.h @ 375:abd956418fe9
gui/pages/now_playing: automatically update progress when the episode is "finished"
author | Paper <paper@tflc.us> |
---|---|
date | Fri, 25 Jul 2025 11:22:55 -0400 |
parents | 6b0768158dcd |
children |
comparison
equal
deleted
inserted
replaced
374:f7bb2978de48 | 375:abd956418fe9 |
---|---|
6 #include "gui/widgets/sidebar.h" | 6 #include "gui/widgets/sidebar.h" |
7 #include "gui/widgets/text.h" | 7 #include "gui/widgets/text.h" |
8 | 8 |
9 #include <QFrame> | 9 #include <QFrame> |
10 #include <QStackedWidget> | 10 #include <QStackedWidget> |
11 #include <QTimer> | |
11 | 12 |
12 #include <memory> | 13 #include <memory> |
13 #include <unordered_map> | 14 #include <unordered_map> |
14 | 15 |
15 | 16 |
20 namespace anitomy { | 21 namespace anitomy { |
21 class Elements; | 22 class Elements; |
22 } | 23 } |
23 | 24 |
24 /* -------------------------------------------------------------- */ | 25 /* -------------------------------------------------------------- */ |
25 /* separate pages */ | 26 /* this is kinda ugly. */ |
26 | 27 |
27 namespace NowPlayingPages { | 28 namespace NowPlayingPages { |
28 | 29 |
29 class Default : public QWidget { | 30 class Default : public QWidget { |
30 Q_OBJECT | 31 Q_OBJECT |
41 | 42 |
42 public: | 43 public: |
43 Playing(QWidget* parent = nullptr); | 44 Playing(QWidget* parent = nullptr); |
44 void SetPlayingAnime(const Anime::Anime& anime, const anitomy::Elements& info); | 45 void SetPlayingAnime(const Anime::Anime& anime, const anitomy::Elements& info); |
45 int GetPlayingAnime(); | 46 int GetPlayingAnime(); |
47 int GetPlayingEpisode(); | |
46 | 48 |
47 private: | 49 private: |
48 int _id = 0; | 50 int _id = 0; |
49 int _episode = 0; | 51 int _episode = 0; |
50 | 52 |
68 NowPlayingPage(QWidget* parent = nullptr); | 70 NowPlayingPage(QWidget* parent = nullptr); |
69 void SetDefault(); | 71 void SetDefault(); |
70 void SetPlaying(const Anime::Anime& anime, const anitomy::Elements& episodes); | 72 void SetPlaying(const Anime::Anime& anime, const anitomy::Elements& episodes); |
71 int GetPlayingId(); | 73 int GetPlayingId(); |
72 | 74 |
75 private slots: | |
76 void TimerDone(); | |
77 | |
73 private: | 78 private: |
74 enum class Subpages { | 79 enum class Subpages { |
75 Default = 0, | 80 Default = 0, |
76 Playing = 1, | 81 Playing = 1, |
77 }; | 82 }; |
78 | 83 |
79 QStackedWidget stack_; | 84 QStackedWidget stack_; |
85 QTimer timer_; | |
80 | 86 |
81 NowPlayingPages::Default default_; | 87 NowPlayingPages::Default default_; |
82 NowPlayingPages::Playing playing_; | 88 NowPlayingPages::Playing playing_; |
83 }; | 89 }; |
84 | 90 |