mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Removed three dots button from invite link label when menu is disabled.
This commit is contained in:
parent
1bbac5784b
commit
0aa1cd0b52
2 changed files with 39 additions and 25 deletions
Telegram/SourceFiles
|
@ -758,7 +758,8 @@ topBarConnectingAnimation: InfiniteRadialAnimation(defaultInfiniteRadialAnimatio
|
|||
size: size(8px, 8px);
|
||||
}
|
||||
|
||||
inviteLinkFieldHeight: 44px;
|
||||
inviteLinkFieldRadius: 5px;
|
||||
inviteLinkFieldHeight: 42px;
|
||||
inviteLinkFieldMargin: margins(14px, 12px, 36px, 9px);
|
||||
inviteLinkThreeDotsIcon: icon {{ "info/edit/dotsmini", dialogsMenuIconFg }};
|
||||
inviteLinkThreeDotsIconOver: icon {{ "info/edit/dotsmini", dialogsMenuIconFgOver }};
|
||||
|
@ -773,10 +774,14 @@ inviteLinkThreeDots: IconButton(defaultIconButton) {
|
|||
rippleAreaSize: 0px;
|
||||
}
|
||||
inviteLinkFieldPadding: margins(22px, 7px, 22px, 14px);
|
||||
inviteLinkFieldLabel: FlatLabel(defaultFlatLabel) {
|
||||
align: align(center);
|
||||
}
|
||||
|
||||
inviteLinkButton: RoundButton(defaultActiveButton) {
|
||||
height: 36px;
|
||||
textTop: 9px;
|
||||
radius: 6px;
|
||||
}
|
||||
inviteLinkButtonsPadding: margins(22px, 0px, 22px, 0px);
|
||||
inviteLinkButtonsSkip: 10px;
|
||||
|
|
|
@ -25,19 +25,26 @@ InviteLinkLabel::InviteLinkLabel(
|
|||
const auto label = CreateChild<FlatLabel>(
|
||||
_outer.get(),
|
||||
std::move(text),
|
||||
st::defaultFlatLabel);
|
||||
createMenu ? st::defaultFlatLabel : st::inviteLinkFieldLabel);
|
||||
label->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
const auto button = CreateChild<IconButton>(
|
||||
_outer.get(),
|
||||
st::inviteLinkThreeDots);
|
||||
const auto button = createMenu
|
||||
? CreateChild<IconButton>(_outer.get(), st::inviteLinkThreeDots)
|
||||
: (IconButton*)(nullptr);
|
||||
|
||||
_outer->widthValue(
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
const auto margin = st::inviteLinkFieldMargin;
|
||||
label->resizeToWidth(width - margin.left() - margin.right());
|
||||
label->moveToLeft(margin.left(), margin.top());
|
||||
button->moveToRight(0, 0);
|
||||
const auto labelWidth = width - margin.left() - margin.right();
|
||||
label->resizeToWidth(labelWidth);
|
||||
label->moveToLeft(
|
||||
createMenu
|
||||
? margin.left()
|
||||
: (width - labelWidth) / 2,
|
||||
margin.top());
|
||||
if (button) {
|
||||
button->moveToRight(0, 0);
|
||||
}
|
||||
}, _outer->lifetime());
|
||||
|
||||
_outer->paintRequest(
|
||||
|
@ -49,28 +56,30 @@ InviteLinkLabel::InviteLinkLabel(
|
|||
PainterHighQualityEnabler hq(p);
|
||||
p.drawRoundedRect(
|
||||
_outer->rect(),
|
||||
st::roundRadiusSmall,
|
||||
st::roundRadiusSmall);
|
||||
st::inviteLinkFieldRadius,
|
||||
st::inviteLinkFieldRadius);
|
||||
}
|
||||
}, _outer->lifetime());
|
||||
|
||||
_outer->setCursor(style::cur_pointer);
|
||||
|
||||
rpl::merge(
|
||||
button->clicks() | rpl::to_empty,
|
||||
_outer->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> event) {
|
||||
return (event->type() == QEvent::MouseButtonPress)
|
||||
&& (static_cast<QMouseEvent*>(event.get())->button()
|
||||
== Qt::RightButton);
|
||||
}) | rpl::to_empty
|
||||
) | rpl::start_with_next([=] {
|
||||
if (_menu) {
|
||||
_menu = nullptr;
|
||||
} else if ((_menu = createMenu())) {
|
||||
_menu->popup(QCursor::pos());
|
||||
}
|
||||
}, _outer->lifetime());
|
||||
if (createMenu) {
|
||||
rpl::merge(
|
||||
button->clicks() | rpl::to_empty,
|
||||
_outer->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> event) {
|
||||
return (event->type() == QEvent::MouseButtonPress)
|
||||
&& (static_cast<QMouseEvent*>(event.get())->button()
|
||||
== Qt::RightButton);
|
||||
}) | rpl::to_empty
|
||||
) | rpl::start_with_next([=] {
|
||||
if (_menu) {
|
||||
_menu = nullptr;
|
||||
} else if ((_menu = createMenu())) {
|
||||
_menu->popup(QCursor::pos());
|
||||
}
|
||||
}, _outer->lifetime());
|
||||
}
|
||||
}
|
||||
|
||||
object_ptr<RpWidget> InviteLinkLabel::take() {
|
||||
|
|
Loading…
Add table
Reference in a new issue