Mercurial > minori
annotate src/gui/widgets/anime_info.cc @ 118:39521c47c7a3
*: another huge megacommit, SORRY
The torrents page works a lot better now
Added the edit option to the anime list right click menu
Vectorized currently playing files
Available player and extensions are now loaded at runtime
from files in (dotpath)/players.json and (dotpath)/extensions.json
These paths are not permanent and will likely be moved to
(dotpath)/recognition
...
...
...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 07 Nov 2023 23:40:54 -0500 |
parents | 80f49f623d30 |
children | 9613d72b097e |
rev | line source |
---|---|
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 | |
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 | 16 layout->addWidget(_details.get()); |
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 | 19 _synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); |
20 layout->addWidget(_synopsis.get()); | |
21 } | |
22 | |
23 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : AnimeInfoWidget(parent) { | |
24 SetAnime(anime); | |
25 } | |
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 | 28 /* alt titles */ |
83 | 29 _title->GetLine()->SetText(Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", "))); |
64 | 30 |
31 /* details */ | |
32 QString details_data; | |
33 QTextStream details_data_s(&details_data); | |
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
34 /* we have to convert ALL of these strings to |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
35 QString because QTextStream sucks and assumes |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
36 Latin1 (on Windows?) */ |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
37 details_data_s << Strings::ToQString(Translate::ToString(anime.GetFormat())) << "\n" |
64 | 38 << anime.GetEpisodes() << "\n" |
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
39 << Strings::ToQString(Translate::ToString(anime.GetUserStatus())) << "\n" |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
40 << Strings::ToQString(Translate::ToString(anime.GetSeason())) << " " |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
41 << anime.GetAirDate().GetYear() << "\n" |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
83
diff
changeset
|
42 << Strings::ToQString(Strings::Implode(anime.GetGenres(), ", ")) << "\n" |
64 | 43 << anime.GetAudienceScore() << "%"; |
83 | 44 _details->GetParagraph()->SetText(details_data); |
64 | 45 |
83 | 46 _synopsis->GetParagraph()->SetText(Strings::ToQString(anime.GetSynopsis())); |
47 | |
48 updateGeometry(); | |
64 | 49 } |
50 | |
51 #include "gui/widgets/moc_anime_info.cpp" |