Mercurial > minori
view src/gui/widgets/anime_info.cpp @ 65:26721c28bf22
*: avoid usage of (to|from)StdString
in Qt5 (and probably Qt6 as well) these functions are only
available (or even usable) if Qt and Minori were built with the
*same standard headers*, which may not be the case in some
circumstances. hence, we'll use our own conversion functions,
which we probably should use anyway.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 01 Oct 2023 23:26:35 -0400 |
parents | fe719c109dbc |
children | d3e9310598b1 |
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::SelectableTextParagraph* title = new TextWidgets::SelectableTextParagraph( tr("Alternative titles"), QString::fromUtf8(Strings::Implode(anime.GetTitleSynonyms(), ", ").c_str()), this); title->GetParagraph()->setWordWrapMode(QTextOption::NoWrap); 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::LabelledTextParagraph( tr("Details"), tr("Type:\nEpisodes:\nStatus:\nSeason:\nGenres:\nScore:"), details_data, this)); /* synopsis */ TextWidgets::SelectableTextParagraph* synopsis = new TextWidgets::SelectableTextParagraph(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"