From 29379fac3553f6e4df0efe41bbccb1ca889dba89 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 1 Feb 2023 23:22:14 +0400 Subject: [PATCH] Use graphics for permissions expand arrow. --- .../icons/info/edit/expand_arrow_small.png | Bin 0 -> 294 bytes .../icons/info/edit/expand_arrow_small@2x.png | Bin 0 -> 413 bytes .../icons/info/edit/expand_arrow_small@3x.png | Bin 0 -> 567 bytes .../boxes/peers/edit_peer_permissions_box.cpp | 28 ++++++++++-------- Telegram/SourceFiles/info/info.style | 2 ++ 5 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 Telegram/Resources/icons/info/edit/expand_arrow_small.png create mode 100644 Telegram/Resources/icons/info/edit/expand_arrow_small@2x.png create mode 100644 Telegram/Resources/icons/info/edit/expand_arrow_small@3x.png diff --git a/Telegram/Resources/icons/info/edit/expand_arrow_small.png b/Telegram/Resources/icons/info/edit/expand_arrow_small.png new file mode 100644 index 0000000000000000000000000000000000000000..839b55ad031530e2626440978965eadbbfe29a48 GIT binary patch literal 294 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1SIoCSFHz9jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(-uv49!D1}S`GTDlfUP4IMa46zV= z8?c-Au!2a*iWi63bPh`SJZdwHXy&_?z;T12%F4q}r8V{Rjiub{cHN&mFE3K<8B>4! zgS&+_pU>Ev{qHkWTdLA>!%U(0T*tO&tk35hm+;mMIu$RGVo-_PGlZR6uU@ MboFyt=akR{0R2l_WdHyG literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/info/edit/expand_arrow_small@2x.png b/Telegram/Resources/icons/info/edit/expand_arrow_small@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..ba6eda83bc67bb39c78065aa453b5d526cc91fc5 GIT binary patch literal 413 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1SD@H(IrLp>_m4XEmv?rhY6lM2kpSw_D(Z9&G7CW@xU7B-O zS69C7{)6nMljGOE@1iO@RT+g85Qvv4-ZbROE@#ao QMNrUqy85}Sb4q9e0Mi_gbN~PV literal 0 HcmV?d00001 diff --git a/Telegram/Resources/icons/info/edit/expand_arrow_small@3x.png b/Telegram/Resources/icons/info/edit/expand_arrow_small@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..993b88a48ffc8c043d6a535891572405b7d85026 GIT binary patch literal 567 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1SD_us|Wxo#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz1|Sip>6gA`6MbbAj}w$RhXF(iZa z?X%)K6T9AQ6LbIvlZCWobg`}>b8drk_!tJqlZiurc9uiv`uI@vKB4I^hQYfF41 z$(gDl*ZPX7ZNpvV|F>ru@a$eE{P5H!6W`+61d#s$z54`Ow)q@5gsO z%4nDC(m@{REiR$Y$}F0A SendMediaToggle( label->setAttribute(Qt::WA_TransparentForMouseEvents); const auto arrow = Ui::CreateChild(button); { - const auto size = st::mainMenuToggleSize * 4; - arrow->resize(size, size); + const auto &icon = st::permissionsExpandIcon; + arrow->resize(icon.size()); arrow->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::start_with_next([=, &icon] { auto p = QPainter(arrow); - const auto path = Ui::ToggleUpDownArrowPath( - size / 2., - size / 2., - size / 4., - st::mainMenuToggleFourStrokes, - state->animation.value(wrap->toggled() ? 1. : 0.)); - - auto hq = PainterHighQualityEnabler(p); - p.fillPath(path, st::rightsButton.textFg); + const auto center = QPointF( + icon.width() / 2., + icon.height() / 2.); + const auto progress = state->animation.value( + wrap->toggled() ? 1. : 0.); + auto hq = std::optional(); + if (progress > 0.) { + hq.emplace(p); + p.translate(center); + p.rotate(progress * 180.); + p.translate(-center); + } + icon.paint(p, 0, 0, arrow->width()); }, arrow->lifetime()); } button->sizeValue( diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 3475b4299..dfafc3ef6 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -890,3 +890,5 @@ reportReasonButton: SettingsButton(infoProfileButton) { style: boxTextStyle; padding: margins(62px, 7px, 8px, 7px); } + +permissionsExpandIcon: icon{{ "info/edit/expand_arrow_small", windowBoldFg }};