Mercurial > minori
comparison src/gui/widgets/anime_info.cpp @ 75:d3e9310598b1
*: refactor some stuff
text: "TextParagraph"s are now called sections, because that's the
actual word for it :P
text: new classes: Line and OneLineSection, solves many problems with
paragraphs that are only one line long (ex. going out of bounds)
http: reworked http stuff to allow threaded get requests, also moved it
to its own file to (hopefully) remove clutter
eventually I'll make a threaded post request method and use that in
the "basic" function
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Wed, 04 Oct 2023 01:42:30 -0400 |
| parents | fe719c109dbc |
| children | 825506f0e221 |
comparison
equal
deleted
inserted
replaced
| 74:5ccb99bfa605 | 75:d3e9310598b1 |
|---|---|
| 8 | 8 |
| 9 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) { | 9 AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) { |
| 10 QVBoxLayout* layout = new QVBoxLayout(this); | 10 QVBoxLayout* layout = new QVBoxLayout(this); |
| 11 | 11 |
| 12 /* alt titles */ | 12 /* alt titles */ |
| 13 TextWidgets::SelectableTextParagraph* title = new TextWidgets::SelectableTextParagraph( | 13 TextWidgets::OneLineSection* title = new TextWidgets::OneLineSection( |
| 14 tr("Alternative titles"), QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this); | 14 tr("Alternative titles"), Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this); |
| 15 title->GetParagraph()->setWordWrapMode(QTextOption::NoWrap); | |
| 16 layout->addWidget(title); | 15 layout->addWidget(title); |
| 17 | 16 |
| 18 /* details */ | 17 /* details */ |
| 19 QString details_data; | 18 QString details_data; |
| 20 QTextStream details_data_s(&details_data); | 19 QTextStream details_data_s(&details_data); |
| 22 << anime.GetEpisodes() << "\n" | 21 << anime.GetEpisodes() << "\n" |
| 23 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" | 22 << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" |
| 24 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" | 23 << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" |
| 25 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" | 24 << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" |
| 26 << anime.GetAudienceScore() << "%"; | 25 << anime.GetAudienceScore() << "%"; |
| 27 layout->addWidget(new TextWidgets::LabelledTextParagraph( | 26 layout->addWidget(new TextWidgets::LabelledSection( |
| 28 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this)); | 27 tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this)); |
| 29 | 28 |
| 30 /* synopsis */ | 29 /* synopsis */ |
| 31 TextWidgets::SelectableTextParagraph* synopsis = | 30 TextWidgets::SelectableSection* synopsis = |
| 32 new TextWidgets::SelectableTextParagraph(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this); | 31 new TextWidgets::SelectableSection(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this); |
| 33 | 32 |
| 34 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | 33 synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); |
| 35 layout->addWidget(synopsis); | 34 layout->addWidget(synopsis); |
| 36 } | 35 } |
| 37 | 36 |
