2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Redesign of admin ranks

This commit is contained in:
RadRussianRus
2019-10-19 04:02:50 +03:00
parent 423356d42c
commit cc52f0fdd6
4 changed files with 14 additions and 10 deletions

View File

@@ -1159,13 +1159,13 @@ crl::time PeerListContent::paintRow(Painter &p, crl::time ms, RowIndex index) {
auto &name = row->name(); auto &name = row->name();
auto namex = _st.item.namePosition.x(); auto namex = _st.item.namePosition.x();
auto namew = width() - namex - skipRight; auto namew = width() - namex - skipRight;
auto statusw = namew;
if (!actionSize.isEmpty()) { if (!actionSize.isEmpty()) {
namew -= actionMargins.left() statusw -= actionMargins.left()
+ actionSize.width() + actionSize.width()
+ actionMargins.right() + actionMargins.right()
- skipRight; - skipRight;
} }
auto statusw = namew;
if (auto iconWidth = row->nameIconWidth()) { if (auto iconWidth = row->nameIconWidth()) {
namew -= iconWidth; namew -= iconWidth;
row->paintNameIcon( row->paintNameIcon(
@@ -1176,14 +1176,9 @@ crl::time PeerListContent::paintRow(Painter &p, crl::time ms, RowIndex index) {
selected); selected);
} }
if (auto adminRankWidth = row->adminRankWidth()) { if (auto adminRankWidth = row->adminRankWidth()) {
namew -= adminRankWidth; namew -= adminRankWidth + skipRight;
auto rankx = width() - adminRankWidth - skipRight; auto rankx = width() - adminRankWidth - skipRight;
if (!actionSize.isEmpty() && selected) {
namew -= skipRight;
rankx -= skipRight;
}
p.setFont(st::normalFont); p.setFont(st::normalFont);
p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg);
row->paintAdminRank( row->paintAdminRank(
p, p,
rankx, rankx,

View File

@@ -554,7 +554,7 @@ infoMembersRemoveIconOver: icon {{
menuIconFgOver menuIconFgOver
}}; }};
infoMembersAdminIconMarigns: margins(10px, 18px, 10px, 10px); infoMembersAdminIconMarigns: margins(10px, 18px, 10px, 10px);
infoMembersRemoveIconMargins: margins(10px, 12px, 12px, 10px); infoMembersRemoveIconMargins: margins(10px, 36px, 18px, 10px);
infoMediaHeaderStyle: TextStyle(semiboldTextStyle) { infoMediaHeaderStyle: TextStyle(semiboldTextStyle) {
} }

View File

@@ -77,6 +77,11 @@ void MemberListRow::paintAdminRank(
int y, int y,
int outerWidth, int outerWidth,
bool selected) { 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()); p.drawTextLeft(x, y, outerWidth, _type.adminRank, adminRankWidth());
} }

View File

@@ -102,7 +102,11 @@ void PeerListWidget::paintItem(Painter &p, int x, int y, Item *item, bool select
nameWidth -= _removeWidth + skip; nameWidth -= _removeWidth + skip;
} else if (item->adminState != Item::AdminState::None) { } else if (item->adminState != Item::AdminState::None) {
p.setFont(st::normalFont); 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); p.drawTextLeft(nameLeft + nameWidth - item->adminRankWidth, nameTop, width(), item->adminRank, item->adminRankWidth);
nameWidth -= item->adminRankWidth + skip; nameWidth -= item->adminRankWidth + skip;
} }