mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-10-18 08:25:30 +02:00
Added lottie icon to transcribe voices while loading.
This commit is contained in:
parent
9ef54d1218
commit
8bc2d3184a
4 changed files with 20 additions and 4 deletions
BIN
Telegram/Resources/animations/transcribe_loading.tgs
Normal file
BIN
Telegram/Resources/animations/transcribe_loading.tgs
Normal file
Binary file not shown.
|
@ -39,6 +39,7 @@
|
|||
<file alias="topics_list.tgs">../../animations/edit_peers/topics_list.tgs</file>
|
||||
<file alias="direct_messages.tgs">../../animations/edit_peers/direct_messages.tgs</file>
|
||||
<file alias="no_chats.tgs">../../animations/no_chats.tgs</file>
|
||||
<file alias="transcribe_loading.tgs">../../animations/transcribe_loading.tgs</file>
|
||||
|
||||
<file alias="dice_idle.tgs">../../animations/dice/dice_idle.tgs</file>
|
||||
<file alias="dart_idle.tgs">../../animations/dice/dart_idle.tgs</file>
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "lang/lang_keys.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "main/main_session.h"
|
||||
#include "media/player/media_player_float.h" // Media::Player::RoundPainter.
|
||||
#include "media/audio/media_audio.h"
|
||||
|
@ -25,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/view/media/history_view_media_common.h"
|
||||
#include "ui/text/format_values.h"
|
||||
#include "ui/text/format_song_document_name.h"
|
||||
#include "ui/text/text_lottie_custom_emoji.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/chat/chat_style.h"
|
||||
#include "ui/painter.h"
|
||||
|
@ -440,15 +442,23 @@ QSize Document::countOptimalSize() {
|
|||
voice->transcribe->setLoading(
|
||||
entry.shown && (entry.requestId || entry.pending),
|
||||
update);
|
||||
const auto pending = entry.pending;
|
||||
auto descriptor = pending
|
||||
? Lottie::IconDescriptor{
|
||||
.name = u"transcribe_loading"_q,
|
||||
.sizeOverride = Size(st::historyTranscribeLoadingSize),
|
||||
}
|
||||
: Lottie::IconDescriptor();
|
||||
auto text = (entry.requestId || !entry.shown)
|
||||
? TextWithEntities()
|
||||
: entry.toolong
|
||||
? Ui::Text::Italic(tr::lng_audio_transcribe_long(tr::now))
|
||||
: entry.failed
|
||||
? Ui::Text::Italic(tr::lng_attach_failed(tr::now))
|
||||
: TextWithEntities{
|
||||
entry.result + (entry.pending ? " [...]" : ""),
|
||||
};
|
||||
: TextWithEntities(entry.result).append(
|
||||
pending
|
||||
? Ui::Text::LottieEmoji(descriptor)
|
||||
: TextWithEntities());
|
||||
voice->transcribe->setOpened(
|
||||
!text.empty(),
|
||||
creating ? Fn<void()>() : update);
|
||||
|
@ -461,7 +471,11 @@ QSize Document::countOptimalSize() {
|
|||
voice->transcribeText = Ui::Text::String(minResizeWidth);
|
||||
voice->transcribeText.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
text);
|
||||
text,
|
||||
kMarkupTextOptions,
|
||||
pending
|
||||
? Ui::Text::LottieEmojiContext(std::move(descriptor))
|
||||
: Ui::Text::MarkedContext());
|
||||
hasTranscribe = true;
|
||||
if (const auto skipBlockWidth = _parent->hasVisibleText()
|
||||
? 0
|
||||
|
|
|
@ -528,6 +528,7 @@ historyVoiceMessageOutTTLSelected: icon {{ "chat/mini_media_once", historyFileOu
|
|||
historyTranscribeSkip: 10px;
|
||||
historyTranscribeSize: size(28px, 22px);
|
||||
historyTranscribeRadius: 4px;
|
||||
historyTranscribeLoadingSize: 24px;
|
||||
historyTranscribeInIcon: icon {{ "chat/voice_to_text", msgFileInBg }};
|
||||
historyTranscribeInIconSelected: icon {{ "chat/voice_to_text", msgFileInBgSelected }};
|
||||
historyTranscribeOutIcon: icon {{ "chat/voice_to_text", msgFileOutBg }};
|
||||
|
|
Loading…
Add table
Reference in a new issue