annotate src/gui/widgets/anime_info.cpp @ 76:3364fadc8a36

*: format source code
author Paper <mrpapersonic@gmail.com>
date Wed, 04 Oct 2023 01:46:33 -0400
parents d3e9310598b1
children 825506f0e221
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 */
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
13 TextWidgets::OneLineSection* title = new TextWidgets::OneLineSection(
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
14 tr("Alternative titles"), Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 layout->addWidget(title);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 /* details */
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 QString details_data;
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 QTextStream details_data_s(&details_data);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 << anime.GetEpisodes() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 << anime.GetAudienceScore() << "%";
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
26 layout->addWidget(new TextWidgets::LabelledSection(
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this));
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 /* synopsis */
75
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
30 TextWidgets::SelectableSection* synopsis =
d3e9310598b1 *: refactor some stuff
Paper <mrpapersonic@gmail.com>
parents: 64
diff changeset
31 new TextWidgets::SelectableSection(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 layout->addWidget(synopsis);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 }
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 #include "gui/widgets/moc_anime_info.cpp"