Mercurial > minori
comparison src/gui/widgets/anime_button.cc @ 254:d14f8e0e40c3
[UNFINISHED] *: update anime button
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Wed, 07 Feb 2024 07:57:37 -0500 |
| parents | b3549da699a6 |
| children | fe702c8f161f |
comparison
equal
deleted
inserted
replaced
| 253:b3549da699a6 | 254:d14f8e0e40c3 |
|---|---|
| 31 setFrameShape(QFrame::Box); | 31 setFrameShape(QFrame::Box); |
| 32 QHBoxLayout* ly = new QHBoxLayout(this); | 32 QHBoxLayout* ly = new QHBoxLayout(this); |
| 33 | 33 |
| 34 _poster = new Poster(this); | 34 _poster = new Poster(this); |
| 35 _poster->setFixedSize(120, 170); | 35 _poster->setFixedSize(120, 170); |
| 36 ly->addWidget(_poster); | 36 _poster->SetClickable(false); |
| 37 ly->addWidget(_poster, 0, Qt::AlignTop); | |
| 37 | 38 |
| 38 { | 39 { |
| 39 QWidget* misc_section = new QWidget(this); | 40 QWidget* misc_section = new QWidget(this); |
| 40 misc_section->setFixedSize(354, 180); | 41 misc_section->setFixedSize(354, 180); |
| 41 | 42 |
| 42 QVBoxLayout* misc_layout = new QVBoxLayout(misc_section); | 43 QVBoxLayout* misc_layout = new QVBoxLayout(misc_section); |
| 43 misc_layout->setContentsMargins(0, 0, 0, 0); | 44 misc_layout->setContentsMargins(0, 0, 0, 0); |
| 44 | 45 |
| 45 _title = new TextWidgets::Line("", misc_section); | 46 _title = new QLabel("", misc_section); |
| 47 _title->setAutoFillBackground(true); | |
| 48 _title->setContentsMargins(4, 4, 4, 4); | |
| 49 _title->setStyleSheet("background-color: rgba(0, 245, 25, 25);"); | |
| 50 { | |
| 51 QFont fnt(_title->font()); | |
| 52 fnt.setWeight(QFont::Bold); | |
| 53 _title->setFont(fnt); | |
| 54 } | |
| 46 misc_layout->addWidget(_title); | 55 misc_layout->addWidget(_title); |
| 47 | 56 |
| 48 /* need to make a separate "labelled paragraph" for this */ | 57 /* need to make a separate "labelled paragraph" for this */ |
| 49 _info = new TextWidgets::LabelledParagraph(tr("Aired:\nEpisodes:\nProducers:\nScore:\nPopularity:"), "\n\n\n\n", misc_section); | 58 _info = new TextWidgets::LabelledParagraph(tr("Aired:\nEpisodes:\nGenres:\nProducers:\nScore:\nPopularity:"), "\n\n\n\n", misc_section); |
| 59 { | |
| 60 QFont fnt(_info->GetLabels()->font()); | |
| 61 fnt.setWeight(QFont::Bold); | |
| 62 _info->GetLabels()->setFont(fnt); | |
| 63 } | |
| 64 _info->setContentsMargins(4, 0, 4, 0); | |
| 50 _info->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); | 65 _info->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); |
| 51 misc_layout->addWidget(_info); | 66 misc_layout->addWidget(_info); |
| 52 | 67 |
| 53 _synopsis = new ElidedLabel("", misc_section); | 68 QWidget* dummy = new QWidget(misc_section); |
| 54 misc_layout->addWidget(_synopsis); | 69 dummy->setContentsMargins(4, 0, 4, 0); |
| 70 QVBoxLayout* dummy_layout = new QVBoxLayout(dummy); | |
| 71 dummy_layout->setSpacing(0); | |
| 72 // dummy_layout->setContentsMargins(0, 0, 0, 0); | |
| 73 dummy_layout->setContentsMargins(0, 0, 0, 0); | |
| 55 | 74 |
| 56 ly->addWidget(misc_section); | 75 _synopsis = new ElidedLabel("", dummy); |
| 76 _synopsis->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | |
| 77 dummy_layout->addWidget(_synopsis); | |
| 78 misc_layout->addWidget(dummy); | |
| 79 | |
| 80 ly->addWidget(misc_section, 0, Qt::AlignTop); | |
| 57 } | 81 } |
| 58 } | 82 } |
| 59 | 83 |
| 60 AnimeButton::AnimeButton(const Anime::Anime& anime, QWidget* parent) : AnimeButton(parent) { | 84 AnimeButton::AnimeButton(const Anime::Anime& anime, QWidget* parent) : AnimeButton(parent) { |
| 61 SetAnime(anime); | 85 SetAnime(anime); |
| 62 } | 86 } |
| 63 | 87 |
| 64 void AnimeButton::SetAnime(const Anime::Anime& anime) { | 88 void AnimeButton::SetAnime(const Anime::Anime& anime) { |
| 65 _poster->SetAnime(anime); | 89 _poster->SetAnime(anime); |
| 66 _title->SetText(Strings::ToQString(anime.GetUserPreferredTitle())); | 90 _title->setText(Strings::ToQString(anime.GetUserPreferredTitle())); |
| 67 | 91 |
| 68 { | 92 { |
| 69 const QLocale& locale = session.config.locale.GetLocale(); | 93 const QLocale& locale = session.config.locale.GetLocale(); |
| 70 _info->GetParagraph()->SetText( | 94 _info->GetParagraph()->SetText( |
| 71 locale.toString(anime.GetAirDate().GetAsQDate(), "dd MMM yyyy") + "\n" + | 95 locale.toString(anime.GetAirDate().GetAsQDate(), "dd MMM yyyy") + "\n" + |
| 72 QString::number(anime.GetEpisodes()) + "\n" + | 96 QString::number(anime.GetEpisodes()) + "\n" + |
| 97 Strings::ToQString(Strings::Implode(anime.GetGenres(), ", ")) + "\n" + | |
| 73 "...\n" + | 98 "...\n" + |
| 74 QString::number(anime.GetAudienceScore()) + "%\n" + | 99 QString::number(anime.GetAudienceScore()) + "%\n" + |
| 75 "..." | 100 "..." |
| 76 ); | 101 ); |
| 77 } | 102 } |
