Mercurial > minori
comparison src/gui/pages/now_playing.cc @ 82:8b65c417c225
*: fix old stuff, make video players and extensions constants
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Mon, 23 Oct 2023 13:37:42 -0400 |
| parents | 9b2b41f83a5e |
| children | d02fdf1d6708 |
comparison
equal
deleted
inserted
replaced
| 81:9b2b41f83a5e | 82:8b65c417c225 |
|---|---|
| 1 #include "gui/pages/now_playing.h" | 1 #include "gui/pages/now_playing.h" |
| 2 #include "core/anime_db.h" | 2 #include "core/anime_db.h" |
| 3 #include "core/strings.h" | |
| 3 #include "gui/widgets/anime_info.h" | 4 #include "gui/widgets/anime_info.h" |
| 4 #include "gui/widgets/text.h" | 5 #include "gui/widgets/text.h" |
| 5 #include <QLabel> | 6 #include <QLabel> |
| 6 #include <QStackedWidget> | 7 #include <QStackedWidget> |
| 7 #include <QVBoxLayout> | 8 #include <QVBoxLayout> |
| 8 #include <QWidget> | 9 #include <QWidget> |
| 9 | 10 |
| 10 /* This is here to make it easier to switch between the | 11 /* WARNING: HACKY STUFF HERE |
| 11 "sub-pages", i.e., not playing and playing. | 12 |
| 12 | 13 The Now Playing page is designed to "switch" between these two sub-pages, |
| 13 TODO: find a way to do this more efficiently */ | 14 using a QStackedWidget. This *could* be the best way to do this, but this |
| 15 feels very very stupid and I really don't like it */ | |
| 14 namespace NowPlayingPages { | 16 namespace NowPlayingPages { |
| 15 | 17 |
| 16 class Default : public QWidget { | 18 class Default : public QWidget { |
| 17 Q_OBJECT | 19 Q_OBJECT |
| 18 | 20 |
| 64 void Playing::SetPlayingAnime(int id, const std::unordered_map<std::string, std::string>& info) { | 66 void Playing::SetPlayingAnime(int id, const std::unordered_map<std::string, std::string>& info) { |
| 65 if (id == _id || id <= 0) | 67 if (id == _id || id <= 0) |
| 66 return; | 68 return; |
| 67 if (Anime::db.items.find(id) != Anime::db.items.end()) { | 69 if (Anime::db.items.find(id) != Anime::db.items.end()) { |
| 68 const Anime::Anime& anime = Anime::db.items[_id = id]; | 70 const Anime::Anime& anime = Anime::db.items[_id = id]; |
| 69 _title->setText(anime.GetUserPreferredTitle()); | 71 _title->setText(Strings::ToQString(anime.GetUserPreferredTitle())); |
| 70 _info->SetAnime(anime); | 72 _info->SetAnime(anime); |
| 71 } | 73 } |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace NowPlayingPages | 76 } // namespace NowPlayingPages |
