diff src/gui/widgets/anime_info.cpp @ 80:825506f0e221

[UNFINISHED]: stuff
author Paper <mrpapersonic@gmail.com>
date Fri, 13 Oct 2023 13:15:19 -0400
parents d3e9310598b1
children
line wrap: on
line diff
--- a/src/gui/widgets/anime_info.cpp	Thu Oct 12 11:31:39 2023 -0400
+++ b/src/gui/widgets/anime_info.cpp	Fri Oct 13 13:15:19 2023 -0400
@@ -6,13 +6,28 @@
 #include <QHBoxLayout>
 #include <QTextStream>
 
-AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) {
+AnimeInfoWidget::AnimeInfoWidget(QWidget* parent) : QWidget(parent) {
 	QVBoxLayout* layout = new QVBoxLayout(this);
 
+	_title.reset(new TextWidgets::OneLineSection(tr("Alternative titles"), "", this));
+	layout->addWidget(_title.get());
+
+	_details.reset(new TextWidgets::LabelledSection(tr("Details"), new TextWidgets::LabelledSection(
+	    tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), "", this), "", this));
+	layout->addWidget(_details.get());
+
+	_synopsis.reset(new TextWidgets::LabelledSection(tr("Synopsis"), "", this));
+	_synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
+	layout->addWidget(_synopsis.get());
+}
+
+AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : AnimeInfoWidget(parent) {
+	SetAnime(anime);
+}
+
+AnimeInfoWidget::SetAnime(const Anime::Anime& anime) {
 	/* alt titles */
-	TextWidgets::OneLineSection* title = new TextWidgets::OneLineSection(
-	    tr("Alternative titles"), Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this);
-	layout->addWidget(title);
+	_title->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
 
 	/* details */
 	QString details_data;
@@ -23,14 +38,10 @@
 	               << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n"
 	               << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
 	               << anime.GetAudienceScore() << "%";
-	layout->addWidget(new TextWidgets::LabelledSection(
-	    tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this));
+	_details->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
+	layout->addWidget();
 
-	/* synopsis */
-	TextWidgets::SelectableSection* synopsis =
-	    new TextWidgets::SelectableSection(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this);
-
-	synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
+	_synopsis->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
 	layout->addWidget(synopsis);
 }