diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 55f978f2cf..57abdd1e12 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -419,7 +419,8 @@ infoProfileTopBarHeightMax: 180px + infoLayerTopBarHeight; infoProfileTopBarTitleTop: 113px; infoProfileTopBarStatusTop: 134px; infoProfileTopBarPhotoTop: 24px; -infoProfileTopBarPhotoBgShift: 60px; +infoProfileTopBarPhotoBgShift: 55px; +infoProfileTopBarPhotoBgNoActionsShift: 30px; infoProfileTopBarPhotoSize: 80px; infoProfileTopBarLastSeenSkip: 8px; @@ -448,6 +449,8 @@ infoProfileTopBarActionButtonsSpace: 10px; infoProfileTopBarStep2: infoProfileTopBarHeightMax - infoLayerTopBarHeight; infoProfileTopBarStep1: infoProfileTopBarStep2 - infoProfileTopBarActionButtonsHeight; +infoProfileTopBarNoActionsHeightMax: infoProfileTopBarHeightMax - infoProfileTopBarActionButtonSize; + infoProfileTopBarActionMessage: icon{{ "profile/message-22x22", windowBoldFg }}; infoProfileTopBarActionMute: icon{{ "profile/mute-22x22", windowBoldFg }}; infoProfileTopBarActionUnmute: icon{{ "profile/unmute-22x22", windowBoldFg }}; diff --git a/Telegram/SourceFiles/info/info_flexible_scroll.cpp b/Telegram/SourceFiles/info/info_flexible_scroll.cpp index 574cd384df..1e051cb442 100644 --- a/Telegram/SourceFiles/info/info_flexible_scroll.cpp +++ b/Telegram/SourceFiles/info/info_flexible_scroll.cpp @@ -75,7 +75,10 @@ void FlexibleScrollHelper::setupScrollHandling() { const auto singleStep = _scroll->verticalScrollBar()->singleStep() * QApplication::wheelScrollLines(); - const auto step1 = st::infoProfileTopBarStep1; + const auto step1 = (_pinnedToTop->maximumHeight() + < st::infoProfileTopBarHeightMax) + ? (st::infoProfileTopBarStep2 + st::lineWidth) + : st::infoProfileTopBarStep1; const auto step2 = st::infoProfileTopBarStep2; // const auto stepDepreciation = singleStep // - st::infoProfileTopBarActionButtonsHeight; diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index f0733591d4..83b0f5ea91 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -39,7 +39,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/notify/data_peer_notify_settings.h" #include "data/stickers/data_custom_emoji.h" #include "history/history.h" -#include "info_profile_actions.h" #include "info/info_controller.h" #include "info/info_memento.h" #include "info/profile/info_profile_badge_tooltip.h" @@ -192,6 +191,17 @@ TopBar::TopBar( VerifiedContentForPeer(_peer), nullptr, _gifPausedChecker)) +, _hasActions(descriptor.source != Source::Stories) +, _minForProgress([&] { + QWidget::setMinimumHeight(st::infoLayerTopBarHeight); + QWidget::setMaximumHeight(_hasActions + ? st::infoProfileTopBarHeightMax + : st::infoProfileTopBarNoActionsHeightMax); + return QWidget::minimumHeight() + + (!_hasActions + ? 0 + : st::infoProfileTopBarActionButtonsHeight); +}()) , _title(this, Info::Profile::NameValue(_peer), _st.title) , _starsRating(_peer->isUser() ? std::make_unique( @@ -214,9 +224,6 @@ TopBar::TopBar( this, tr::lng_status_lastseen_when(), st::infoProfileCover.showLastSeen) { - QWidget::setMinimumHeight(st::infoLayerTopBarHeight); - QWidget::setMaximumHeight(st::infoProfileTopBarHeightMax); - const auto controller = descriptor.controller; if (_peer->isMegagroup() || _peer->isChat()) { @@ -282,7 +289,9 @@ TopBar::TopBar( descriptor.backToggles.value(), descriptor.source); setupUserpicButton(controller); - setupActions(controller); + if (_hasActions) { + setupActions(controller); + } setupStoryOutline(); if (_topic) { _topicIconView = std::make_unique( @@ -795,8 +804,7 @@ int TopBar::statusMostLeft() const { void TopBar::updateLabelsPosition() { _progress = [&] { const auto max = QWidget::maximumHeight(); - const auto min = QWidget::minimumHeight() - + st::infoProfileTopBarActionButtonsHeight; + const auto min = _minForProgress; const auto p = (max > min) ? ((height() - min) / float64(max - min)) : 1.; @@ -1023,7 +1031,11 @@ void TopBar::paintEvent(QPaintEvent *e) { _cachedGradient = Ui::CreateTopBgGradient( QSize(width(), maximumHeight()), _peer, - QPoint(0, -st::infoProfileTopBarPhotoBgShift)); + QPoint( + 0, + _hasActions + ? -st::infoProfileTopBarPhotoBgShift + : -st::infoProfileTopBarPhotoBgNoActionsShift)); } if (!_hasBackground) { paintEdges(p); diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h index 5e7ae59803..76cbd70d89 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h @@ -181,6 +181,9 @@ private: const std::unique_ptr _badge; const std::unique_ptr _verified; + const bool _hasActions; + const int _minForProgress; + std::unique_ptr _badgeTooltip; std::vector> _badgeOldTooltips; uint64 _badgeCollectibleId = 0; diff --git a/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp b/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp index 1e66c14ff0..ffa5deb370 100644 --- a/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp +++ b/Telegram/SourceFiles/info/stories/info_stories_inner_widget.cpp @@ -294,7 +294,6 @@ void InnerWidget::createProfileTop() { startTop(); using namespace Profile; - AddCover(_top, _controller, _peer, nullptr, nullptr); AddDetails(_top, _controller, _peer, nullptr, nullptr, { v::null }); auto tracker = Ui::MultiSlideTracker();