Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 79:c489dd4434af | 80:825506f0e221 |
|---|---|
| 4 #include "gui/translate/anime.h" | 4 #include "gui/translate/anime.h" |
| 5 #include "gui/widgets/text.h" | 5 #include "gui/widgets/text.h" |
| 6 #include <QHBoxLayout> | 6 #include <QHBoxLayout> |
| 7 #include <QTextStream> | 7 #include <QTextStream> |
| 8 | 8 |
| 9 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) { | 9 AnimeInfoWidget::AnimeInfoWidget(QWidget* parent) : QWidget(parent) { |
| 10 QVBoxLayout* layout = new QVBoxLayout(this); | 10 QVBoxLayout* layout = new QVBoxLayout(this); |
| 11 | 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) { | |
| 12 /* alt titles */ | 29 /* alt titles */ |
| 13 TextWidgets::OneLineSection* title = new TextWidgets::OneLineSection( | 30 _title->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); |
| 14 tr("Alternative titles"), Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this); | |
| 15 layout->addWidget(title); | |
| 16 | 31 |
| 17 /* details */ | 32 /* details */ |
| 18 QString details_data; | 33 QString details_data; |
| 19 QTextStream details_data_s(&details_data); | 34 QTextStream details_data_s(&details_data); |
| 20 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n" | 35 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n" |
| 21 << anime.GetEpisodes() << "\n" | 36 << anime.GetEpisodes() << "\n" |
| 22 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" | 37 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" |
| 23 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" | 38 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" |
| 24 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" | 39 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" |
| 25 << anime.GetAudienceScore() << "%"; | 40 << anime.GetAudienceScore() << "%"; |
| 26 layout->addWidget(new TextWidgets::LabelledSection( | 41 _details->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); |
| 27 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this)); | 42 layout->addWidget(); |
| 28 | 43 |
| 29 /* synopsis */ | 44 _synopsis->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); |
| 30 TextWidgets::SelectableSection* synopsis = | |
| 31 new TextWidgets::SelectableSection(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this); | |
| 32 | |
| 33 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | |
| 34 layout->addWidget(synopsis); | 45 layout->addWidget(synopsis); |
| 35 } | 46 } |
| 36 | 47 |
| 37 #include "gui/widgets/moc_anime_info.cpp" | 48 #include "gui/widgets/moc_anime_info.cpp" |
