From a8a85b2acf763768ba9fbc5db26fab0178ccda7a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Mar 2021 18:46:02 +0400 Subject: [PATCH] Show correct tooltip on stopping recording. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/calls/calls_group_call.cpp | 5 +++++ Telegram/SourceFiles/calls/calls_group_call.h | 4 ++++ Telegram/SourceFiles/calls/calls_group_panel.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 61fddf8f21..2cc4daa882 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2000,6 +2000,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_group_call_recording_stop" = "Stop recording"; "lng_group_call_recording_started" = "Voice chat recording started."; "lng_group_call_recording_stopped" = "Voice chat recording stopped."; +"lng_group_call_recording_saved" = "Audio saved to Saved Messages"; "lng_group_call_recording_start_sure" = "Do you want to start recording this chat and save the result into an audio file?\n\nOther members will see the chat is being recorded."; "lng_group_call_recording_stop_sure" = "Do you want to stop recording this chat?"; "lng_group_call_recording_start_field" = "Recording Title"; diff --git a/Telegram/SourceFiles/calls/calls_group_call.cpp b/Telegram/SourceFiles/calls/calls_group_call.cpp index 4e6f5deb96..a09b89c507 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/calls_group_call.cpp @@ -903,6 +903,9 @@ void GroupCall::toggleRecording(bool enabled, const QString &title) { return; } + if (!enabled) { + _recordingStoppedByMe = true; + } using Flag = MTPphone_ToggleGroupCallRecord::Flag; _api.request(MTPphone_ToggleGroupCallRecord( MTP_flags((enabled ? Flag::f_start : Flag(0)) @@ -911,7 +914,9 @@ void GroupCall::toggleRecording(bool enabled, const QString &title) { MTP_string(title) )).done([=](const MTPUpdates &result) { _peer->session().api().applyUpdates(result); + _recordingStoppedByMe = false; }).fail([=](const RPCError &error) { + _recordingStoppedByMe = false; }).send(); } diff --git a/Telegram/SourceFiles/calls/calls_group_call.h b/Telegram/SourceFiles/calls/calls_group_call.h index 0571d1787c..e48f988a36 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.h +++ b/Telegram/SourceFiles/calls/calls_group_call.h @@ -118,6 +118,9 @@ public: void handleUpdate(const MTPDupdateGroupCallParticipants &data); void changeTitle(const QString &title); void toggleRecording(bool enabled, const QString &title); + [[nodiscard]] bool recordingStoppedByMe() const { + return _recordingStoppedByMe; + } void setMuted(MuteState mute); void setMutedAndUpdate(MuteState mute); @@ -261,6 +264,7 @@ private: base::flat_set _unresolvedSsrcs; std::vector _preparedParticipants; bool _addPreparedParticipantsScheduled = false; + bool _recordingStoppedByMe = false; MTP::DcId _broadcastDcId = 0; base::flat_map, LoadingPart> _broadcastParts; diff --git a/Telegram/SourceFiles/calls/calls_group_panel.cpp b/Telegram/SourceFiles/calls/calls_group_panel.cpp index 7c191e2178..0cfaf0a12c 100644 --- a/Telegram/SourceFiles/calls/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_group_panel.cpp @@ -580,6 +580,8 @@ void GroupPanel::subscribeToChanges(not_null real) { widget(), (recorded ? tr::lng_group_call_recording_started(tr::now) + : (_call && _call->recordingStoppedByMe()) + ? tr::lng_group_call_recording_saved(tr::now) : tr::lng_group_call_recording_stopped(tr::now))); }, widget()->lifetime()); validateRecordingMark(real->recordStartDate() != 0);