MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / AddFeaturesList

Function AddFeaturesList

Telegram/SourceFiles/ui/boxes/boost_box.cpp:125–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125void AddFeaturesList(
126 not_null<Ui::VerticalLayout*> container,
127 const Ui::BoostFeatures &features,
128 int startFromLevel,
129 bool group) {
130 const auto add = [&](
131 rpl::producer<TextWithEntities> text,
132 const style::icon &st) {
133 const auto label = container->add(
134 object_ptr<Ui::FlatLabel>(
135 container,
136 std::move(text),
137 st::boostFeatureLabel),
138 st::boostFeaturePadding);
139 object_ptr<Info::Profile::FloatingIcon>(
140 label,
141 st,
142 st::boostFeatureIconPosition);
143 };
144 const auto lowMax = std::max({
145 features.linkLogoLevel,
146 features.profileIconLevel,
147 features.autotranslateLevel,
148 features.transcribeLevel,
149 features.emojiPackLevel,
150 features.emojiStatusLevel,
151 features.wallpaperLevel,
152 features.customWallpaperLevel,
153 (features.nameColorsByLevel.empty()
154 ? 0
155 : features.nameColorsByLevel.back().first),
156 (features.linkStylesByLevel.empty()
157 ? 0
158 : features.linkStylesByLevel.back().first),
159 (features.profileColorsByLevel.empty()
160 ? 0
161 : features.profileColorsByLevel.back().first),
162 });
163 const auto highMax = std::max(lowMax, features.sponsoredLevel);
164 auto nameColors = 0;
165 auto linkStyles = 0;
166 auto profileColors = 0;
167 for (auto i = std::max(startFromLevel, 1); i <= highMax; ++i) {
168 if ((i > lowMax) && (i < highMax)) {
169 continue;
170 }
171 const auto unlocks = (i == startFromLevel);
172 {
173 const auto badge = container->add(
174 MakeFeaturesBadge(
175 container,
176 (unlocks
177 ? tr::lng_boost_level_unlocks
178 : tr::lng_boost_level)(
179 lt_count,
180 rpl::single(float64(i)))),
181 st::boostLevelBadgePadding,
182 style::al_top);

Callers 2

BoostBoxFunction · 0.85
AskBoostBoxFunction · 0.85

Calls 9

MakeFeaturesBadgeFunction · 0.85
QPainterClass · 0.50
addMethod · 0.45
emptyMethod · 0.45
setGeometryMethod · 0.45
yMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected