From 2d6d89b1cfabc62bcb3ecb58864b804086cee297 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 30 Oct 2024 10:02:09 +0400 Subject: [PATCH] Fix recording single-listen tooltip text. --- Telegram/Resources/langs/lang.strings | 1 + .../controls/history_view_voice_record_bar.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index beb351b41..c0d7cd9ae 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3276,6 +3276,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_record_video_problem" = "Could not start video recording. Please check your camera."; "lng_record_once_first_tooltip" = "Click to set this message to **Play Once**."; "lng_record_once_active_tooltip" = "The recipient will be able to listen only once."; +"lng_record_once_active_video" = "The recipient will be able to watch only once."; "lng_will_be_notified" = "Subscribers will be notified when you post."; "lng_wont_be_notified" = "Subscribers will receive a silent notification."; "lng_willbe_history" = "Select a chat to start messaging"; diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index f21d35ab9..8a8c673ca 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -364,7 +364,8 @@ class TTLButton final : public Ui::RippleButton { public: TTLButton( not_null parent, - const style::RecordBar &st); + const style::RecordBar &st, + bool recordingVideo); void clearState() override; @@ -383,7 +384,8 @@ private: TTLButton::TTLButton( not_null parent, - const style::RecordBar &st) + const style::RecordBar &st, + bool recordingVideo) : RippleButton(parent, st.lock.ripple) , _st(st) , _rippleRect(Rect(Size(st::historyRecordLockTopShadow.width())) @@ -410,8 +412,10 @@ TTLButton::TTLButton( } auto text = rpl::conditional( Core::App().settings().ttlVoiceClickTooltipHiddenValue(), - tr::lng_record_once_active_tooltip( - Ui::Text::RichLangValue), + (recordingVideo + ? tr::lng_record_once_active_video + : tr::lng_record_once_active_tooltip)( + Ui::Text::RichLangValue), tr::lng_record_once_first_tooltip( Ui::Text::RichLangValue)); _tooltip.reset(Ui::CreateChild( @@ -1624,7 +1628,8 @@ void VoiceRecordBar::init() { if (!_ttlButton) { _ttlButton = std::make_unique( _outerContainer, - _st); + _st, + _recordingVideo); } _ttlButton->show(); } @@ -1659,6 +1664,7 @@ void VoiceRecordBar::init() { } _recordingTipRequire = crl::now(); _recordingVideo = (_send->type() == Ui::SendButton::Type::Round); + _ttlButton = nullptr; _lock->setRecordingVideo(_recordingVideo); _startTimer.callOnce(st::universalDuration); } else if (e->type() == QEvent::MouseButtonRelease) {