Mercurial > minori
comparison src/gui/widgets/anime_button.cc @ 365:f81bed4e04ac
*: megacommit that probably breaks things
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 02 Oct 2024 23:06:43 -0400 |
parents | 6b0768158dcd |
children |
comparison
equal
deleted
inserted
replaced
364:99c961c91809 | 365:f81bed4e04ac |
---|---|
33 setFrameShape(QFrame::Box); | 33 setFrameShape(QFrame::Box); |
34 | 34 |
35 QHBoxLayout* ly = new QHBoxLayout(this); | 35 QHBoxLayout* ly = new QHBoxLayout(this); |
36 | 36 |
37 _poster.SetClickable(false); | 37 _poster.SetClickable(false); |
38 _poster.setFixedSize(120, 170); | 38 ly->addWidget(&_poster, 1, Qt::AlignTop); |
39 ly->addWidget(&_poster, 0, Qt::AlignTop); | |
40 | 39 |
41 const std::vector<std::pair<std::string, std::string>> imap = { | 40 const std::vector<std::pair<std::string, std::string>> imap = { |
42 {Strings::Translate("Aired:"), ""}, | 41 {Strings::Translate("Aired:"), ""}, |
43 {Strings::Translate("Episodes:"), ""}, | 42 {Strings::Translate("Episodes:"), ""}, |
44 {Strings::Translate("Genres:"), ""}, | 43 {Strings::Translate("Genres:"), ""}, |
49 | 48 |
50 _info.SetData(imap); | 49 _info.SetData(imap); |
51 | 50 |
52 { | 51 { |
53 QWidget* misc_section = new QWidget(this); | 52 QWidget* misc_section = new QWidget(this); |
54 misc_section->setFixedSize(354, 180); | |
55 | 53 |
56 QVBoxLayout* misc_layout = new QVBoxLayout(misc_section); | 54 QVBoxLayout* misc_layout = new QVBoxLayout(misc_section); |
57 misc_layout->setContentsMargins(0, 0, 0, 0); | 55 misc_layout->setContentsMargins(0, 0, 0, 0); |
58 | 56 |
59 _title.setAutoFillBackground(true); | 57 _title.setAutoFillBackground(true); |
77 dummy->setContentsMargins(4, 0, 4, 0); | 75 dummy->setContentsMargins(4, 0, 4, 0); |
78 QVBoxLayout* dummy_layout = new QVBoxLayout(dummy); | 76 QVBoxLayout* dummy_layout = new QVBoxLayout(dummy); |
79 dummy_layout->setSpacing(0); | 77 dummy_layout->setSpacing(0); |
80 dummy_layout->setContentsMargins(0, 0, 0, 0); | 78 dummy_layout->setContentsMargins(0, 0, 0, 0); |
81 | 79 |
82 _synopsis.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); | |
83 _synopsis.SetSelectable(false); | 80 _synopsis.SetSelectable(false); |
84 dummy_layout->addWidget(&_synopsis); | 81 dummy_layout->addWidget(&_synopsis); |
85 misc_layout->addWidget(dummy); | 82 misc_layout->addWidget(dummy); |
86 } | 83 } |
87 | 84 |
88 ly->addWidget(misc_section, 0, Qt::AlignTop); | 85 ly->addWidget(misc_section, 3, Qt::AlignTop); |
89 } | 86 } |
90 } | 87 } |
91 | 88 |
92 AnimeButton::AnimeButton(const Anime::Anime& anime, QWidget* parent) : AnimeButton(parent) { | 89 AnimeButton::AnimeButton(const Anime::Anime& anime, QWidget* parent) : AnimeButton(parent) { |
93 SetAnime(anime); | 90 SetAnime(anime); |
110 | 107 |
111 _info.SetData(imap); | 108 _info.SetData(imap); |
112 | 109 |
113 _synopsis.SetText(anime.GetSynopsis()); | 110 _synopsis.SetText(anime.GetSynopsis()); |
114 } | 111 } |
112 | |
113 bool AnimeButton::hasHeightForWidth() const { | |
114 return true; | |
115 } | |
116 | |
117 int AnimeButton::heightForWidth(int w) const { | |
118 return static_cast<int>(static_cast<double>(w) / 2.5); | |
119 } |