From 9f73242cc5e54bd4f13b3a2c0afb084520a4cf87 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 10 Feb 2025 21:22:57 +0300 Subject: [PATCH] Improved width of voice waveform. --- .../history/view/media/history_view_document.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 14f6a0225..84f066884 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -503,9 +503,19 @@ QSize Document::countOptimalSize() { accumulate_max(maxWidth, tleft + named->name.maxWidth() + tright); accumulate_min(maxWidth, st::msgMaxWidth); } - if (voice && voice->transcribe) { - maxWidth += st::historyTranscribeSkip - + voice->transcribe->size().width(); + if (voice) { + const auto maxWaveformWidth = ::Media::Player::kWaveformSamplesCount * + (st::msgWaveformBar + st::msgWaveformSkip); + const auto transcribeWidth = voice->transcribe + ? (voice->transcribe->size().width() + st::historyTranscribeSkip) + : 0; + accumulate_max( + maxWidth, + maxWaveformWidth + + rect::m::sum::h(st.padding) + + st.thumbSize + + st.thumbSkip + + transcribeWidth); } auto minHeight = st.padding.top() + st.thumbSize + st.padding.bottom();