mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Added simple tooltip to ttl button from voice record bar.
This commit is contained in:
parent
f9b5789cf7
commit
d1f4463c2a
4 changed files with 53 additions and 1 deletions
|
@ -2492,6 +2492,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_record_listen_cancel_sure" = "Are you sure you want to discard your recorded voice message?";
|
||||
"lng_record_lock_discard" = "Discard";
|
||||
"lng_record_hold_tip" = "Please hold the mouse button pressed to record a voice message.";
|
||||
"lng_record_once_active_tooltip" = "The recipients will be able to listen to it only once.";
|
||||
"lng_will_be_notified" = "Members will be notified when you post";
|
||||
"lng_wont_be_notified" = "Members will not be notified when you post";
|
||||
"lng_willbe_history" = "Please select a chat to start messaging";
|
||||
|
|
|
@ -1130,6 +1130,12 @@ historyRecordLockPosition: point(1px, 22px);
|
|||
historyRecordCancelButtonWidth: 100px;
|
||||
historyRecordCancelButtonFg: lightButtonFg;
|
||||
|
||||
historyRecordTooltip: ImportantTooltip(defaultImportantTooltip) {
|
||||
padding: margins(4px, 4px, 4px, 4px);
|
||||
radius: 11px;
|
||||
arrow: 6px;
|
||||
}
|
||||
|
||||
historySilentToggle: IconButton(historyBotKeyboardShow) {
|
||||
icon: icon {{ "chat/input_silent", historyComposeIconFg }};
|
||||
iconOver: icon {{ "chat/input_silent", historyComposeIconFgOver }};
|
||||
|
|
|
@ -31,7 +31,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/effects/animation_value.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/text/format_values.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/widgets/tooltip.h"
|
||||
#include "ui/rect.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
@ -304,6 +306,49 @@ TTLButton::TTLButton(
|
|||
st::historyRecordVoiceShowDuration);
|
||||
});
|
||||
|
||||
{
|
||||
const auto tooltip = Ui::CreateChild<Ui::ImportantTooltip>(
|
||||
parent.get(),
|
||||
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
parent.get(),
|
||||
Ui::MakeNiceTooltipLabel(
|
||||
parent,
|
||||
tr::lng_record_once_active_tooltip(
|
||||
Ui::Text::RichLangValue),
|
||||
st::historyMessagesTTLLabel.minWidth,
|
||||
st::ttlMediaImportantTooltipLabel),
|
||||
st::defaultImportantTooltip.padding),
|
||||
st::historyRecordTooltip);
|
||||
geometryValue(
|
||||
) | rpl::start_with_next([=](const QRect &r) {
|
||||
if (r.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
tooltip->pointAt(r, RectPart::Right, [=](QSize size) {
|
||||
return QPoint(
|
||||
r.left()
|
||||
- size.width()
|
||||
- st::defaultImportantTooltip.padding.left(),
|
||||
r.top()
|
||||
+ r.height()
|
||||
- size.height()
|
||||
+ st::historyRecordTooltip.padding.top());
|
||||
});
|
||||
}, tooltip->lifetime());
|
||||
tooltip->show();
|
||||
|
||||
clicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto toggled = !Ui::AbstractButton::isDisabled();
|
||||
tooltip->toggleAnimated(toggled);
|
||||
|
||||
if (toggled) {
|
||||
constexpr auto kTimeout = crl::time(3000);
|
||||
tooltip->hideAfter(kTimeout);
|
||||
}
|
||||
}, tooltip->lifetime());
|
||||
}
|
||||
|
||||
paintRequest(
|
||||
) | rpl::start_with_next([=](const QRect &clip) {
|
||||
auto p = QPainter(this);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit aa39793a91f1186879c15c214a2671d78eab5085
|
||||
Subproject commit 08a19be802cef8ee801121906c5f0ce9d2fa65b0
|
Loading…
Add table
Reference in a new issue