diff --git a/Telegram/SourceFiles/export/view/export_view_progress.cpp b/Telegram/SourceFiles/export/view/export_view_progress.cpp index f9a7e249a7..301fafadd2 100644 --- a/Telegram/SourceFiles/export/view/export_view_progress.cpp +++ b/Telegram/SourceFiles/export/view/export_view_progress.cpp @@ -314,6 +314,14 @@ void ProgressWidget::showDone() { this, langFactory(lng_export_done), st::exportDoneButton); + const auto desired = std::min( + st::exportDoneButton.font->width(lang(lng_export_done).toUpper()) + + st::exportDoneButton.height + - st::exportDoneButton.font->height, + st::exportPanelSize.width() - 2 * st::exportCancelBottom); + if (_done->width() < desired) { + _done->setFullWidth(desired); + } _done->clicks() | rpl::start_to_stream(_doneClicks, _done->lifetime()); setupBottomButton(_done.get()); } diff --git a/Telegram/SourceFiles/ui/widgets/buttons.cpp b/Telegram/SourceFiles/ui/widgets/buttons.cpp index 993692c47c..136d269d96 100644 --- a/Telegram/SourceFiles/ui/widgets/buttons.cpp +++ b/Telegram/SourceFiles/ui/widgets/buttons.cpp @@ -263,7 +263,7 @@ void RoundButton::numbersAnimationCallback() { void RoundButton::setFullWidth(int newFullWidth) { _fullWidthOverride = newFullWidth; - resizeToText(); + refreshText(); } void RoundButton::refreshText() { @@ -282,6 +282,10 @@ QString RoundButton::computeFullText() const { void RoundButton::resizeToText() { int innerWidth = contentWidth(); if (_fullWidthOverride > 0) { + if (_fullWidthOverride < innerWidth + (_st.height - _st.font->height)) { + _text = _st.font->elided(computeFullText(), qMax(_fullWidthOverride - (_st.height - _st.font->height), 1)); + _textWidth = _st.font->width(_text); + } resize(_fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom()); } else if (_fullWidthOverride < 0) { resize(innerWidth - _fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom());