Mercurial > minori
comparison src/gui/widgets/anime_info.cc @ 81:9b2b41f83a5e
boring: mass rename to cc
because this is a very unix-y project, it makes more sense to use the
'cc' extension
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Mon, 23 Oct 2023 12:07:27 -0400 |
| parents | src/gui/widgets/anime_info.cpp@825506f0e221 |
| children | 8b65c417c225 |
comparison
equal
deleted
inserted
replaced
| 80:825506f0e221 | 81:9b2b41f83a5e |
|---|---|
| 1 #include "gui/widgets/anime_info.h" | |
| 2 #include "core/anime.h" | |
| 3 #include "core/strings.h" | |
| 4 #include "gui/translate/anime.h" | |
| 5 #include "gui/widgets/text.h" | |
| 6 #include <QHBoxLayout> | |
| 7 #include <QTextStream> | |
| 8 | |
| 9 AnimeInfoWidget::AnimeInfoWidget(QWidget* parent) : QWidget(parent) { | |
| 10 QVBoxLayout* layout = new QVBoxLayout(this); | |
| 11 | |
| 12 _title.reset(new TextWidgets::OneLineSection(tr("Alternative titles"), "", this)); | |
| 13 layout->addWidget(_title.get()); | |
| 14 | |
| 15 _details.reset(new TextWidgets::LabelledSection(tr("Details"), new TextWidgets::LabelledSection( | |
| 16 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), "", this), "", this)); | |
| 17 layout->addWidget(_details.get()); | |
| 18 | |
| 19 _synopsis.reset(new TextWidgets::LabelledSection(tr("Synopsis"), "", this)); | |
| 20 _synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | |
| 21 layout->addWidget(_synopsis.get()); | |
| 22 } | |
| 23 | |
| 24 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : AnimeInfoWidget(parent) { | |
| 25 SetAnime(anime); | |
| 26 } | |
| 27 | |
| 28 AnimeInfoWidget::SetAnime(const Anime::Anime& anime) { | |
| 29 /* alt titles */ | |
| 30 _title->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); | |
| 31 | |
| 32 /* details */ | |
| 33 QString details_data; | |
| 34 QTextStream details_data_s(&details_data); | |
| 35 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n" | |
| 36 << anime.GetEpisodes() << "\n" | |
| 37 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" | |
| 38 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" | |
| 39 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" | |
| 40 << anime.GetAudienceScore() << "%"; | |
| 41 _details->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); | |
| 42 layout->addWidget(); | |
| 43 | |
| 44 _synopsis->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); | |
| 45 layout->addWidget(synopsis); | |
| 46 } | |
| 47 | |
| 48 #include "gui/widgets/moc_anime_info.cpp" |
