From 5b10b7e15ff53a4c30f0c423413295d3cd2d4027 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 20 Jul 2023 10:33:45 +0400 Subject: [PATCH] Use separate record cancel text in stories. --- Telegram/Resources/langs/lang.strings | 1 + .../history/view/controls/history_view_compose_controls.cpp | 1 + .../history/view/controls/history_view_compose_controls.h | 1 + .../history/view/controls/history_view_voice_record_bar.cpp | 4 +++- .../history/view/controls/history_view_voice_record_bar.h | 1 + Telegram/SourceFiles/media/stories/media_stories_reply.cpp | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 592cc337e..ce176c6d1 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2062,6 +2062,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_send_as_premium_required" = "Subscribe to {link} to be able to comment on behalf of your channels in group chats."; "lng_send_as_premium_required_link" = "Telegram Premium"; "lng_record_cancel" = "Release outside this field to cancel"; +"lng_record_cancel_stories" = "Release outside to cancel"; "lng_record_lock_cancel_sure" = "Are you sure you want to stop recording and discard your voice message?"; "lng_record_listen_cancel_sure" = "Are you sure you want to discard your recorded voice message?"; "lng_record_lock_discard" = "Discard"; diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 8d72bfbce..b18fba987 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -996,6 +996,7 @@ ComposeControls::ComposeControls( .outerContainer = parent, .show = _show, .send = _send, + .customCancelText = descriptor.voiceCustomCancelText, .stOverride = &_st.record, .recorderHeight = st::historySendSize.height(), .lockFromBottom = descriptor.voiceLockFromBottom, diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h index ce734f280..984509323 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.h @@ -103,6 +103,7 @@ struct ComposeControlsDescriptor { Window::SessionController *regularWindow = nullptr; rpl::producer stickerOrEmojiChosen; rpl::producer customPlaceholder; + QString voiceCustomCancelText; bool voiceLockFromBottom = false; ChatHelpers::ComposeFeatures features; }; 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 757b85444..6f30a8e59 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 @@ -1024,7 +1024,9 @@ VoiceRecordBar::VoiceRecordBar( , _startTimer([=] { startRecording(); }) , _message( st::historyRecordTextStyle, - tr::lng_record_cancel(tr::now), + (!descriptor.customCancelText.isEmpty() + ? descriptor.customCancelText + : tr::lng_record_cancel(tr::now)), TextParseOptions{ TextParseMultiline, 0, 0, Qt::LayoutDirectionAuto }) , _lockFromBottom(descriptor.lockFromBottom) , _cancelFont(st::historyRecordFont) { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h index 2d04e98a7..09c491678 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h @@ -43,6 +43,7 @@ struct VoiceRecordBarDescriptor { not_null outerContainer; std::shared_ptr show; std::shared_ptr send; + QString customCancelText; const style::RecordBar *stOverride = nullptr; int recorderHeight = 0; bool lockFromBottom = false; diff --git a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp index 1497a60e4..c9eeed94d 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp @@ -86,6 +86,7 @@ ReplyArea::ReplyArea(not_null controller) .sendMenuType = SendMenu::Type::SilentOnly, .stickerOrEmojiChosen = _controller->stickerOrEmojiChosen(), .customPlaceholder = tr::lng_story_reply_ph(), + .voiceCustomCancelText = tr::lng_record_cancel_stories(tr::now), .voiceLockFromBottom = true, .features = { .sendAs = false,