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