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
|
80
|
9 AnimeInfoWidget::AnimeInfoWidget(QWidget* parent) : QWidget(parent) {
|
64
|
10 QVBoxLayout* layout = new QVBoxLayout(this);
|
|
11
|
80
|
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) {
|
64
|
29 /* alt titles */
|
80
|
30 _title->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
|
64
|
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() << "%";
|
80
|
41 _details->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
|
|
42 layout->addWidget();
|
64
|
43
|
80
|
44 _synopsis->GetParagraph()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
|
64
|
45 layout->addWidget(synopsis);
|
|
46 }
|
|
47
|
|
48 #include "gui/widgets/moc_anime_info.cpp"
|