Use graphics for permissions expand arrow.

This commit is contained in:
John Preston 2023-02-01 23:22:14 +04:00
parent ebfddc1a68
commit 29379fac35
5 changed files with 18 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

View file

@ -248,20 +248,24 @@ not_null<Ui::SettingsButton*> SendMediaToggle(
label->setAttribute(Qt::WA_TransparentForMouseEvents); label->setAttribute(Qt::WA_TransparentForMouseEvents);
const auto arrow = Ui::CreateChild<Ui::RpWidget>(button); const auto arrow = Ui::CreateChild<Ui::RpWidget>(button);
{ {
const auto size = st::mainMenuToggleSize * 4; const auto &icon = st::permissionsExpandIcon;
arrow->resize(size, size); arrow->resize(icon.size());
arrow->paintRequest( arrow->paintRequest(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=, &icon] {
auto p = QPainter(arrow); auto p = QPainter(arrow);
const auto path = Ui::ToggleUpDownArrowPath( const auto center = QPointF(
size / 2., icon.width() / 2.,
size / 2., icon.height() / 2.);
size / 4., const auto progress = state->animation.value(
st::mainMenuToggleFourStrokes, wrap->toggled() ? 1. : 0.);
state->animation.value(wrap->toggled() ? 1. : 0.)); auto hq = std::optional<PainterHighQualityEnabler>();
if (progress > 0.) {
auto hq = PainterHighQualityEnabler(p); hq.emplace(p);
p.fillPath(path, st::rightsButton.textFg); p.translate(center);
p.rotate(progress * 180.);
p.translate(-center);
}
icon.paint(p, 0, 0, arrow->width());
}, arrow->lifetime()); }, arrow->lifetime());
} }
button->sizeValue( button->sizeValue(

View file

@ -890,3 +890,5 @@ reportReasonButton: SettingsButton(infoProfileButton) {
style: boxTextStyle; style: boxTextStyle;
padding: margins(62px, 7px, 8px, 7px); padding: margins(62px, 7px, 8px, 7px);
} }
permissionsExpandIcon: icon{{ "info/edit/expand_arrow_small", windowBoldFg }};