mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Use close icon from group calls in stories tooltip.
This commit is contained in:
parent
84ce95cc95
commit
1c1e643735
2 changed files with 15 additions and 29 deletions
|
@ -567,4 +567,11 @@ dialogsStoriesTooltip: ImportantTooltip(defaultImportantTooltip) {
|
||||||
}
|
}
|
||||||
dialogsStoriesTooltipLabel: defaultImportantTooltipLabel;
|
dialogsStoriesTooltipLabel: defaultImportantTooltipLabel;
|
||||||
dialogsStoriesTooltipMaxWidth: 200px;
|
dialogsStoriesTooltipMaxWidth: 200px;
|
||||||
dialogsStoriesTooltipHide: size(14px, 14px);
|
dialogsStoriesTooltipHide: IconButton(defaultIconButton) {
|
||||||
|
width: 34px;
|
||||||
|
height: 20px;
|
||||||
|
iconPosition: point(-1px, -1px);
|
||||||
|
icon: icon {{ "calls/video_tooltip", importantTooltipFg }};
|
||||||
|
iconOver: icon {{ "calls/video_tooltip", importantTooltipFg }};
|
||||||
|
ripple: emptyRippleAnimation;
|
||||||
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/effects/outline_segments.h"
|
#include "ui/effects/outline_segments.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/widgets/menu/menu_add_action_callback_factory.h"
|
#include "ui/widgets/menu/menu_add_action_callback_factory.h"
|
||||||
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/widgets/tooltip.h"
|
#include "ui/widgets/tooltip.h"
|
||||||
#include "ui/abstract_button.h"
|
|
||||||
#include "ui/painter.h"
|
#include "ui/painter.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
|
|
||||||
|
@ -49,8 +49,7 @@ constexpr auto kStoriesTooltipHideBgOpacity = 0.2;
|
||||||
not_null<QWidget*> parent,
|
not_null<QWidget*> parent,
|
||||||
rpl::producer<TextWithEntities> text,
|
rpl::producer<TextWithEntities> text,
|
||||||
Fn<void()> hide) {
|
Fn<void()> hide) {
|
||||||
const auto size = st::dialogsStoriesTooltipHide;
|
const auto size = st::dialogsStoriesTooltipHide.width;
|
||||||
const auto buttonw = size.width();
|
|
||||||
const auto skip = st::defaultImportantTooltip.padding.right();
|
const auto skip = st::defaultImportantTooltip.padding.right();
|
||||||
auto result = object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
auto result = object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||||
parent,
|
parent,
|
||||||
|
@ -60,36 +59,16 @@ constexpr auto kStoriesTooltipHideBgOpacity = 0.2;
|
||||||
st::dialogsStoriesTooltipMaxWidth,
|
st::dialogsStoriesTooltipMaxWidth,
|
||||||
st::dialogsStoriesTooltipLabel),
|
st::dialogsStoriesTooltipLabel),
|
||||||
(st::defaultImportantTooltip.padding
|
(st::defaultImportantTooltip.padding
|
||||||
+ QMargins(0, 0, skip + buttonw, 0)));
|
+ QMargins(0, 0, skip + size, 0)));
|
||||||
const auto button = Ui::CreateChild<Ui::AbstractButton>(result.data());
|
const auto button = Ui::CreateChild<Ui::IconButton>(
|
||||||
|
result.data(),
|
||||||
|
st::dialogsStoriesTooltipHide);
|
||||||
result->sizeValue(
|
result->sizeValue(
|
||||||
) | rpl::start_with_next([=](QSize size) {
|
) | rpl::start_with_next([=](QSize size) {
|
||||||
button->resize(skip * 2 + buttonw, size.height());
|
button->resize(button->width(), size.height());
|
||||||
button->moveToRight(0, 0, size.width());
|
button->moveToRight(0, 0, size.width());
|
||||||
}, button->lifetime());
|
}, button->lifetime());
|
||||||
button->setClickedCallback(std::move(hide));
|
button->setClickedCallback(std::move(hide));
|
||||||
button->paintRequest(
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
auto p = QPainter(button);
|
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
p.setBrush(st::importantTooltipFg);
|
|
||||||
p.setOpacity(kStoriesTooltipHideBgOpacity);
|
|
||||||
const auto rect = style::centerrect(
|
|
||||||
button->rect(),
|
|
||||||
QRect(QPoint(), size));
|
|
||||||
const auto center = QRectF(rect).center();
|
|
||||||
const auto half = QSizeF(rect.size()) / 6.;
|
|
||||||
const auto phalf = QPointF(half.width(), half.height());
|
|
||||||
const auto mhalf = QPointF(-half.width(), half.height());
|
|
||||||
p.drawEllipse(rect);
|
|
||||||
p.setOpacity(1.);
|
|
||||||
auto pen = st::importantTooltipFg->p;
|
|
||||||
pen.setWidthF(style::ConvertScaleExact(sqrtf(2.)));
|
|
||||||
p.setPen(pen);
|
|
||||||
p.drawLine(center - phalf, center + phalf);
|
|
||||||
p.drawLine(center - mhalf, center + mhalf);
|
|
||||||
}, button->lifetime());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue