From cc52f0fdd66b05d3ea655e1c84ebe3e9f0f57c74 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sat, 19 Oct 2019 04:02:50 +0300 Subject: [PATCH] Redesign of admin ranks --- Telegram/SourceFiles/boxes/peer_list_box.cpp | 11 +++-------- Telegram/SourceFiles/info/info.style | 2 +- .../info/profile/info_profile_members_controllers.cpp | 5 +++++ .../SourceFiles/profile/profile_block_peer_list.cpp | 6 +++++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 08202d713..b67be57b4 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -1159,13 +1159,13 @@ crl::time PeerListContent::paintRow(Painter &p, crl::time ms, RowIndex index) { auto &name = row->name(); auto namex = _st.item.namePosition.x(); auto namew = width() - namex - skipRight; + auto statusw = namew; if (!actionSize.isEmpty()) { - namew -= actionMargins.left() + statusw -= actionMargins.left() + actionSize.width() + actionMargins.right() - skipRight; } - auto statusw = namew; if (auto iconWidth = row->nameIconWidth()) { namew -= iconWidth; row->paintNameIcon( @@ -1176,14 +1176,9 @@ crl::time PeerListContent::paintRow(Painter &p, crl::time ms, RowIndex index) { selected); } if (auto adminRankWidth = row->adminRankWidth()) { - namew -= adminRankWidth; + namew -= adminRankWidth + skipRight; auto rankx = width() - adminRankWidth - skipRight; - if (!actionSize.isEmpty() && selected) { - namew -= skipRight; - rankx -= skipRight; - } p.setFont(st::normalFont); - p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg); row->paintAdminRank( p, rankx, diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 0b7ef4ea3..c5f289503 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -554,7 +554,7 @@ infoMembersRemoveIconOver: icon {{ menuIconFgOver }}; infoMembersAdminIconMarigns: margins(10px, 18px, 10px, 10px); -infoMembersRemoveIconMargins: margins(10px, 12px, 12px, 10px); +infoMembersRemoveIconMargins: margins(10px, 36px, 18px, 10px); infoMediaHeaderStyle: TextStyle(semiboldTextStyle) { } diff --git a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp index 26f25f6a1..686765b9f 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members_controllers.cpp @@ -77,6 +77,11 @@ void MemberListRow::paintAdminRank( int y, int outerWidth, bool selected) { + p.setPen(_type.rights == Rights::Creator + ? st::defaultPeerListItem.statusFgActive + : selected + ? st::defaultPeerListItem.statusFgOver + : st::defaultPeerListItem.statusFg); p.drawTextLeft(x, y, outerWidth, _type.adminRank, adminRankWidth()); } diff --git a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp index 6848f6360..606c76413 100644 --- a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp +++ b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp @@ -102,7 +102,11 @@ void PeerListWidget::paintItem(Painter &p, int x, int y, Item *item, bool select nameWidth -= _removeWidth + skip; } else if (item->adminState != Item::AdminState::None) { p.setFont(st::normalFont); - p.setPen(selected ? _st.statusFgOver : _st.statusFg); + p.setPen(item->adminState == Item::AdminState::Creator + ? _st.statusFgActive + : selected + ? _st.statusFgOver + : _st.statusFg); p.drawTextLeft(nameLeft + nameWidth - item->adminRankWidth, nameTop, width(), item->adminRank, item->adminRankWidth); nameWidth -= item->adminRankWidth + skip; }