Mercurial > minori
comparison src/gui/pages/now_playing.cpp @ 66:6481c5aed3e1
posters: add poster widget...
why does AniList call these cover images? they're posters...
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Mon, 02 Oct 2023 05:56:32 -0400 |
| parents | fe719c109dbc |
| children | 2417121d894e |
comparison
equal
deleted
inserted
replaced
| 65:26721c28bf22 | 66:6481c5aed3e1 |
|---|---|
| 19 class Playing : public QWidget { | 19 class Playing : public QWidget { |
| 20 Q_OBJECT | 20 Q_OBJECT |
| 21 | 21 |
| 22 public: | 22 public: |
| 23 Playing(QWidget* parent = nullptr); | 23 Playing(QWidget* parent = nullptr); |
| 24 | 24 void SetPlayingAnime(int id); |
| 25 void SetPlayingAnime(int id) { | |
| 26 if (info.get()) | |
| 27 layout()->removeWidget(info.get()); | |
| 28 info.reset(new AnimeInfoWidget(Anime::db.items[id])); | |
| 29 layout()->addWidget(info.get()); | |
| 30 } | |
| 31 | 25 |
| 32 private: | 26 private: |
| 33 std::unique_ptr<AnimeInfoWidget> info = nullptr; | 27 std::unique_ptr<AnimeInfoWidget> info = nullptr; |
| 34 }; | 28 }; |
| 35 | 29 |
| 39 | 33 |
| 40 layout->addStretch(); | 34 layout->addStretch(); |
| 41 } | 35 } |
| 42 | 36 |
| 43 Playing::Playing(QWidget* parent) : QWidget(parent) { | 37 Playing::Playing(QWidget* parent) : QWidget(parent) { |
| 44 QVBoxLayout* layout = new QVBoxLayout(this); | 38 QHBoxLayout* layout = new QHBoxLayout(this); |
| 39 | |
| 45 layout->setContentsMargins(0, 0, 0, 0); | 40 layout->setContentsMargins(0, 0, 0, 0); |
| 41 } | |
| 42 | |
| 43 void Playing::SetPlayingAnime(int id) { | |
| 44 if (info.get()) | |
| 45 layout()->removeWidget(info.get()); | |
| 46 info.reset(new AnimeInfoWidget(Anime::db.items[id])); | |
| 47 layout()->addWidget(info.get()); | |
| 46 } | 48 } |
| 47 | 49 |
| 48 } // namespace NowPlayingPages | 50 } // namespace NowPlayingPages |
| 49 | 51 |
| 50 NowPlayingPage::NowPlayingPage(QWidget* parent) : QFrame(parent) { | 52 NowPlayingPage::NowPlayingPage(QWidget* parent) : QFrame(parent) { |
