Mercurial > minori
view 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 |
line wrap: on
line source
#include "gui/widgets/anime_info.h" #include "core/anime.h" #include "core/strings.h" #include "gui/translate/anime.h" #include "gui/widgets/text.h" #include <QHBoxLayout> #include <QTextStream> AnimeInfoWidget::AnimeInfoWidget(const Anime::Anime& anime, QWidget* parent) : QWidget(parent) { QVBoxLayout* layout = new QVBoxLayout(this); /* alt titles */ TextWidgets::OneLineSection* title = new TextWidgets::OneLineSection( tr("Alternative titles"), Strings::ToQString(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this); layout->addWidget(title); /* details */ QString details_data; QTextStream details_data_s(&details_data); details_data_s << Translate::ToString(anime.GetFormat()).c_str() << "\n" << anime.GetEpisodes() << "\n" << Translate::ToString(anime.GetUserStatus()).c_str() << "\n" << Translate::ToString(anime.GetSeason()).c_str() << " " << anime.GetAirDate().GetYear() << "\n" << Strings::Implode(anime.GetGenres(), ", ").c_str() << "\n" << anime.GetAudienceScore() << "%"; layout->addWidget(new TextWidgets::LabelledSection( tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this)); /* synopsis */ TextWidgets::SelectableSection* synopsis = new TextWidgets::SelectableSection(tr("Synopsis"), QString::fromUtf8(anime.GetSynopsis().c_str()), this); synopsis->GetParagraph()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); layout->addWidget(synopsis); } #include "gui/widgets/moc_anime_info.cpp"