Mercurial > minori
diff src/gui/widgets/anime_info.cpp @ 64:fe719c109dbc
*: update
1. add media tracking ability, and it displays info on the `now playing` page
2. the `now playing` page now actually shows something
3. renamed every page class to be more accurate to what it is
4. ...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 01 Oct 2023 23:15:43 -0400 |
parents | |
children | d3e9310598b1 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/widgets/anime_info.cpp Sun Oct 01 23:15:43 2023 -0400 @@ -0,0 +1,38 @@ +#include "gui/widgets/anime_info.h" +#include "core/anime.h" +#include "core/strings.h" +#include "gui/translate/anime.h" +#include "gui/widgets/text.h" +#include <QHBoxLayout> +#include <QTextStream> + +AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) { + QVBoxLayout* layout = new QVBoxLayout(this); + + /* alt titles */ + TextWidgets::SelectableTextParagraph* title = new TextWidgets::SelectableTextParagraph( + tr("Alternative titles"), QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this); + title->GetParagraph()->setWordWrapMode(QTextOption::NoWrap); + layout->addWidget(title); + + /* details */ + QString details_data; + QTextStream details_data_s(&details_data); + details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n" + << anime.GetEpisodes() << "\n" + << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" + << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" + << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" + << anime.GetAudienceScore() << "%"; + layout->addWidget(new TextWidgets::LabelledTextParagraph( + tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this)); + + /* synopsis */ + TextWidgets::SelectableTextParagraph* synopsis = + new TextWidgets::SelectableTextParagraph(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this); + + synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); + layout->addWidget(synopsis); +} + +#include "gui/widgets/moc_anime_info.cpp"