Improve invite links UI.

This commit is contained in:
John Preston 2021-02-09 21:03:05 +04:00
parent 756fa702b2
commit 7a5dc72f86
13 changed files with 38 additions and 20 deletions

Binary file not shown.

After

(image error) Size: 347 B

Binary file not shown.

After

(image error) Size: 584 B

Binary file not shown.

After

(image error) Size: 863 B

Binary file not shown.

After

(image error) Size: 737 B

Binary file not shown.

After

(image error) Size: 1.4 KiB

Binary file not shown.

After

(image error) Size: 2.2 KiB

Binary file not shown.

Before

(image error) Size: 289 B

After

(image error) Size: 287 B

Binary file not shown.

Before

(image error) Size: 460 B

After

(image error) Size: 465 B

Binary file not shown.

Before

(image error) Size: 752 B

After

(image error) Size: 787 B

View file

@ -1229,11 +1229,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_group_invite_custom_limit" = "Enter custom limit";
"lng_group_invite_usage_any" = "No limit";
"lng_group_invite_usage_custom" = "Custom";
"lng_group_invite_other_title" = "Invite links created by other admins";
"lng_group_invite_other_title" = "Links created by other admins";
"lng_group_invite_other_count#one" = "{count} invite link";
"lng_group_invite_other_count#other" = "{count} invite links";
"lng_group_invite_permanent_other" = "Permanent link of this admin";
"lng_group_invite_other_list" = "Invite links created by this admin";
"lng_group_invite_other_list" = "Links created by this admin";
"lng_group_invite_expired_about" = "The time limit for this link has expired.";
"lng_group_invite_used_about" = "This link reached its usage limit.";
"lng_group_invite_can_join_via_link#one" = "{count} person can join via this link.";

View file

@ -865,9 +865,11 @@ void ShowInviteLinkBox(
return;
}
const auto now = base::unixtime::now();
box->setTitle(IsExpiredLink(link, now)
box->setTitle(link.revoked
? tr::lng_manage_peer_link_invite()
: IsExpiredLink(link, now)
? tr::lng_manage_peer_link_expired()
: (link.permanent && !link.revoked)
: link.permanent
? tr::lng_manage_peer_link_permanent()
: tr::lng_manage_peer_link_invite());
}, box->lifetime());

View file

@ -691,6 +691,7 @@ void LinksController::rowPaintIcon(
}
Unexpected("Color in LinksController::rowPaintIcon.");
}();
const auto stroke = st::inviteLinkIconStroke;
auto &icon = _icons[int(color)];
if (icon.isNull()) {
icon = QImage(
@ -703,12 +704,17 @@ void LinksController::rowPaintIcon(
p.setPen(Qt::NoPen);
p.setBrush(*bg);
auto hq = PainterHighQualityEnabler(p);
p.drawEllipse(0, 0, inner, inner);
st::inviteLinkIcon.paintInCenter(p, { 0, 0, inner, inner });
auto rect = QRect(0, 0, inner, inner);
if (color == Color::Expiring || color == Color::ExpireSoon) {
rect = rect.marginsRemoved({ stroke, stroke, stroke, stroke });
}
p.drawEllipse(rect);
(color == Color::Revoked
? st::inviteLinkRevokedIcon
: st::inviteLinkIcon).paintInCenter(p, { 0, 0, inner, inner });
}
p.drawImage(x + skip, y + skip, icon);
if (progress >= 0. && progress < 1.) {
const auto stroke = st::inviteLinkIconStroke;
auto hq = PainterHighQualityEnabler(p);
auto pen = QPen((*bg)->c);
pen.setWidth(stroke);
@ -716,7 +722,7 @@ void LinksController::rowPaintIcon(
p.setPen(pen);
p.setBrush(Qt::NoBrush);
const auto margins = 1.5 * stroke;
const auto margins = .5 * stroke;
p.drawArc(QRectF(x + skip, y + skip, inner, inner).marginsAdded({
margins,
margins,

View file

@ -868,7 +868,10 @@ inviteLinkShare: RoundButton(inviteLinkCopy) {
icon: icon {{ "info/edit/links_share", activeButtonFg }};
iconOver: icon {{ "info/edit/links_share", activeButtonFgOver }};
}
inviteLinkReactivate: inviteLinkShare;
inviteLinkReactivate: RoundButton(inviteLinkCopy) {
icon: icon {{ "info/edit/links_reactivate", activeButtonFg }};
iconOver: icon {{ "info/edit/links_reactivate", activeButtonFgOver }};
}
inviteLinkUserpics: GroupCallUserpics {
size: 28px;
shift: 6px;
@ -879,7 +882,7 @@ inviteLinkUserpicsSkip: 8px;
inviteLinkJoinedFont: font(14px);
inviteLinkJoinedRowPadding: margins(0px, 18px, 0px, 8px);
inviteLinkCreateSkip: 8px;
inviteLinkCreateSkip: 10px;
inviteLinkCreate: SettingsButton(defaultSettingsButton) {
textFg: lightButtonFg;
textFgOver: lightButtonFgOver;
@ -889,7 +892,7 @@ inviteLinkCreate: SettingsButton(defaultSettingsButton) {
font: semiboldFont;
height: 20px;
padding: margins(58px, 7px, 12px, 5px);
padding: margins(60px, 7px, 12px, 5px);
toggle: infoProfileToggle;
toggleOver: infoProfileToggleOver;
@ -898,28 +901,35 @@ inviteLinkCreate: SettingsButton(defaultSettingsButton) {
ripple: defaultRippleAnimation;
}
inviteLinkCreateIcon: icon {{ "info/edit/roundbtn_plus", windowFgActive }};
inviteLinkCreateIconSize: 20px;
inviteLinkCreateIconSize: 18px;
inviteLinkListItem: PeerListItem(defaultPeerListItem) {
button: OutlineButton(defaultPeerListButton) {
font: normalFont;
padding: margins(11px, 5px, 11px, 5px);
}
height: 52px;
photoPosition: point(8px, 6px);
namePosition: point(58px, 6px);
statusPosition: point(58px, 25px);
photoSize: 40px;
photoPosition: point(9px, 4px);
namePosition: point(60px, 6px);
statusPosition: point(60px, 26px);
photoSize: 44px;
}
inviteLinkList: PeerList(defaultPeerList) {
item: inviteLinkListItem;
padding: margins(0px, 4px, 0px, 4px);
padding: margins(0px, 4px, 0px, 0px);
}
inviteLinkAdminsList: PeerList(peerListBox) {
padding: margins(0px, 4px, 0px, membersMarginBottom);
inviteLinkAdminsList: PeerList(inviteLinkList) {
item: PeerListItem(inviteLinkListItem) {
photoPosition: point(16px, 9px);
namePosition: point(62px, 6px);
statusPosition: point(62px, 26px);
photoSize: 34px;
}
padding: margins(0px, 5px, 0px, 6px);
}
inviteLinkIconSkip: 7px;
inviteLinkIconStroke: 2px;
inviteLinkIcon: icon {{ "info/edit/links_link", mediaviewFileExtFg }};
inviteLinkRevokedIcon: icon {{ "info/edit/links_revoked", mediaviewFileExtFg }};
inviteLinkThreeDotsSkip: 12px;
inviteLinkRevokedTitlePadding: margins(22px, 16px, 10px, 9px);
inviteLinkRevokedTitlePadding: margins(22px, 16px, 10px, 4px);
inviteLinkLimitMargin: margins(22px, 8px, 22px, 8px);