annotate src/gui/widgets/anime_info.cpp @ 67:442065432549

poster: make posters link to AniList
author Paper <mrpapersonic@gmail.com>
date Mon, 02 Oct 2023 07:06:44 -0400
parents fe719c109dbc
children d3e9310598b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "gui/widgets/anime_info.h"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "core/anime.h"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 #include "core/strings.h"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include "gui/translate/anime.h"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include "gui/widgets/text.h"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include <QHBoxLayout>
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include <QTextStream>
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) {
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 QVBoxLayout* layout = new QVBoxLayout(this);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 /* alt titles */
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 TextWidgets::SelectableTextParagraph* title = new TextWidgets::SelectableTextParagraph(
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 tr("Alternative titles"), QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 title->GetParagraph()->setWordWrapMode(QTextOption::NoWrap);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 layout->addWidget(title);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 /* details */
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 QString details_data;
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 QTextStream details_data_s(&details_data);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 << anime.GetEpisodes() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 << anime.GetAudienceScore() << "%";
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 layout->addWidget(new TextWidgets::LabelledTextParagraph(
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this));
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 /* synopsis */
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 TextWidgets::SelectableTextParagraph* synopsis =
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 new TextWidgets::SelectableTextParagraph(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 layout->addWidget(synopsis);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 }
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 #include "gui/widgets/moc_anime_info.cpp"