diff src/gui/pages/now_playing.cc @ 154:d43d68408d3c

dep/animia: fix XnuFdTools also we use anitomy directly now. HG Enter commit message. Lines beginning with 'HG:' are removed.
author Paper <mrpapersonic@gmail.com>
date Wed, 15 Nov 2023 14:14:17 -0500
parents 6d8da6e64d61
children bc8d2ccff09c
line wrap: on
line diff
--- a/src/gui/pages/now_playing.cc	Wed Nov 15 13:28:18 2023 -0500
+++ b/src/gui/pages/now_playing.cc	Wed Nov 15 14:14:17 2023 -0500
@@ -10,11 +10,8 @@
 #include <QVBoxLayout>
 #include <QWidget>
 
-/* WARNING: HACKY STUFF HERE
-   
-   The Now Playing page is designed to "switch" between these two sub-pages,
-   using a QStackedWidget. This *could* be the best way to do this, but this
-   feels very very stupid and I really don't like it */
+#include "anitomy/anitomy.h"
+
 namespace NowPlayingPages {
 
 class Default : public QWidget {
@@ -29,7 +26,7 @@
 
 	public:
 		Playing(QWidget* parent = nullptr);
-		void SetPlayingAnime(const Anime::Anime& anime, const std::unordered_map<std::string, std::string>& info);
+		void SetPlayingAnime(const Anime::Anime& anime, const anitomy::Elements& info);
 		int GetPlayingAnime();
 
 	private:
@@ -89,11 +86,11 @@
 	return _id;
 }
 
-void Playing::SetPlayingAnime(const Anime::Anime& anime, const std::unordered_map<std::string, std::string>& info) {
-	if (_id == anime.GetId() && std::to_string(_episode) == info.at("episode"))
+void Playing::SetPlayingAnime(const Anime::Anime& anime, const anitomy::Elements& info) {
+	if (_id == anime.GetId() && _episode == Strings::ToInt(Strings::ToUtf8String(info.get(anitomy::kElementEpisodeNumber))))
 		return;
 	_id = anime.GetId();
-	_episode = Strings::ToInt(info.at("episode"));
+	_episode = Strings::ToInt(Strings::ToUtf8String(info.get(anitomy::kElementEpisodeNumber)));
 	_title->SetText(Strings::ToQString(anime.GetUserPreferredTitle()));
 	_info->SetAnime(anime);
 	_poster->SetAnime(anime);
@@ -126,7 +123,7 @@
 	return reinterpret_cast<NowPlayingPages::Playing*>(stack->widget(1))->GetPlayingAnime();
 }
 
-void NowPlayingPage::SetPlaying(const Anime::Anime& anime, const std::unordered_map<std::string, std::string>& info) {
+void NowPlayingPage::SetPlaying(const Anime::Anime& anime, const anitomy::Elements& info) {
 	reinterpret_cast<NowPlayingPages::Playing*>(stack->widget(1))->SetPlayingAnime(anime, info);
 	stack->setCurrentIndex(1);
 	updateGeometry();