annotate src/gui/widgets/anime_info.cc @ 105:6d8da6e64d61

theme: add dark stylesheet, make it actually usable win32: make the titlebar black where available
author Paper <mrpapersonic@gmail.com>
date Sun, 05 Nov 2023 03:54:26 -0500
parents d02fdf1d6708
children 80f49f623d30
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
80
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
9 AnimeInfoWidget::AnimeInfoWidget(QWidget* parent) : QWidget(parent) {
64
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
80
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
12 _title.reset(new TextWidgets::OneLineSection(tr("Alternative titles"), "", this));
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
13 layout->addWidget(_title.get());
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
14
82
8b65c417c225 *: fix old stuff, make video players and extensions constants
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
15 _details.reset(new TextWidgets::LabelledSection(tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), "", this));
80
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
16 layout->addWidget(_details.get());
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
17
82
8b65c417c225 *: fix old stuff, make video players and extensions constants
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
18 _synopsis.reset(new TextWidgets::SelectableSection(tr("Synopsis"), "", this));
80
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
19 _synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
20 layout->addWidget(_synopsis.get());
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
21 }
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
22
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
23 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : AnimeInfoWidget(parent) {
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
24 SetAnime(anime);
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
25 }
825506f0e221 [UNFINISHED]: stuff
Paper <mrpapersonic@gmail.com>
parents: 75
diff changeset
26
82
8b65c417c225 *: fix old stuff, make video players and extensions constants
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
27 void AnimeInfoWidget::SetAnime(const Anime::Anime& anime) {
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 /* alt titles */
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 82
diff changeset
29 _title->GetLine()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ")));
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 /* details */
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 QString details_data;
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 QTextStream details_data_s(&details_data);
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 << anime.GetEpisodes() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n"
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 << anime.GetAudienceScore() << "%";
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 82
diff changeset
40 _details->GetParagraph()->SetText(details_data);
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41
83
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 82
diff changeset
42 _synopsis->GetParagraph()->SetText(Strings::ToQString(anime.GetSynopsis()));
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 82
diff changeset
43
d02fdf1d6708 *: huuuge update
Paper <mrpapersonic@gmail.com>
parents: 82
diff changeset
44 updateGeometry();
64
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 }
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46
fe719c109dbc *: update
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47 #include "gui/widgets/moc_anime_info.cpp"