64
|
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(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) {
|
|
10 QVBoxLayout* layout = new QVBoxLayout(this);
|
|
11
|
|
12 /* alt titles */
|
|
13 TextWidgets::SelectableTextParagraph* title = new TextWidgets::SelectableTextParagraph(
|
|
14 tr("Alternative titles"), QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this);
|
|
15 title->GetParagraph()->setWordWrapMode(QTextOption::NoWrap);
|
|
16 layout->addWidget(title);
|
|
17
|
|
18 /* details */
|
|
19 QString details_data;
|
|
20 QTextStream details_data_s(&details_data);
|
|
21 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n"
|
|
22 << anime.GetEpisodes() << "\n"
|
|
23 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n"
|
|
24 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n"
|
|
25 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
|
|
26 << anime.GetAudienceScore() << "%";
|
|
27 layout->addWidget(new TextWidgets::LabelledTextParagraph(
|
|
28 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this));
|
|
29
|
|
30 /* synopsis */
|
|
31 TextWidgets::SelectableTextParagraph* synopsis =
|
|
32 new TextWidgets::SelectableTextParagraph(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this);
|
|
33
|
|
34 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
|
35 layout->addWidget(synopsis);
|
|
36 }
|
|
37
|
|
38 #include "gui/widgets/moc_anime_info.cpp"
|