diff --git a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp index 23785a8882..74f4cf99c3 100644 --- a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp +++ b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp @@ -32,7 +32,7 @@ void AddHeader( tr::phrase<> text) { const auto header = content->add( object_ptr(content), - st::statisticsLayerMargins + st::statisticsChartHeaderPadding); + st::statisticsLayerMargins + st::boostsChartHeaderPadding); header->resizeToWidth(header->width()); header->setTitle(text(tr::now)); header->setSubTitle({}); @@ -43,7 +43,7 @@ void FillOverview( const Data::BoostStatus &status) { const auto &stats = status.overview; - ::Settings::AddSkip(content, st::statisticsLayerOverviewMargins.top()); + ::Settings::AddSkip(content, st::boostsLayerOverviewMargins.top()); AddHeader(content, tr::lng_stats_overview_title); ::Settings::AddSkip(content); @@ -125,7 +125,7 @@ void FillOverview( ) | rpl::start_with_next([=](const QSize &s) { const auto halfWidth = s.width() / 2; { - const auto &p = st::statisticsOverviewValuePadding; + const auto &p = st::boostsOverviewValuePadding; topLeftLabel->moveToLeft(p.left(), p.top()); } topRightLabel->moveToLeft( @@ -138,7 +138,7 @@ void FillOverview( topRightLabel->x(), bottomLeftLabel->y()); }, container->lifetime()); - ::Settings::AddSkip(content, st::statisticsLayerOverviewMargins.bottom()); + ::Settings::AddSkip(content, st::boostsLayerOverviewMargins.bottom()); } void FillShareLink( @@ -161,7 +161,7 @@ void FillShareLink( nullptr); content->add( label->take(), - st::inviteLinkFieldPadding); + st::boostsLinkFieldPadding); label->clicks( ) | rpl::start_with_next(copyLink, label->lifetime()); @@ -169,7 +169,7 @@ void FillShareLink( object_ptr(content)); Ui::AddCopyShareLinkButtons(copyShareWrap, copyLink, shareLink); copyShareWrap->widgetAt(0)->showChildren(); - ::Settings::AddSkip(content, st::inviteLinkFieldPadding.bottom()); + ::Settings::AddSkip(content, st::boostsLinkFieldPadding.bottom()); } } // namespace @@ -210,7 +210,8 @@ InnerWidget::InnerWidget( = status.overview.nextLevelBoostCount, .mine = status.overview.isBoosted, } - }); + }, + st::statisticsLimitsLinePadding); inner->add(object_ptr( inner, std::move(dividerContent), @@ -228,7 +229,8 @@ InnerWidget::InnerWidget( using PeerPtr = not_null; const auto header = inner->add( object_ptr(inner), - st::statisticsLayerMargins); + st::statisticsLayerMargins + + st::boostsChartHeaderPadding); header->resizeToWidth(header->width()); header->setTitle(tr::lng_boosts_list_title( tr::now, @@ -250,6 +252,7 @@ InnerWidget::InnerWidget( ::Settings::AddSkip(inner); AddHeader(inner, tr::lng_boosts_link_title); + ::Settings::AddSkip(inner, st::boostsLinkSkip); FillShareLink(inner, _show, status.link, peer); ::Settings::AddSkip(inner); ::Settings::AddDividerText(inner, tr::lng_boosts_link_subtext()); diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index af07515ac9..1666abbec8 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -355,6 +355,7 @@ BoostsController::BoostsController(BoostsDescriptor d) , _showPeerInfo(std::move(d.showPeerInfo)) , _api(d.peer) , _firstSlice(std::move(d.firstSlice)) { + PeerListController::setStyleOverrides(&st::boostsListBox); } Main::Session &BoostsController::session() const { diff --git a/Telegram/SourceFiles/statistics/statistics.style b/Telegram/SourceFiles/statistics/statistics.style index 02b63bbd53..e27059a41d 100644 --- a/Telegram/SourceFiles/statistics/statistics.style +++ b/Telegram/SourceFiles/statistics/statistics.style @@ -109,13 +109,35 @@ statisticsShowMoreButton: SettingsButton(defaultSettingsButton) { textFg: lightButtonFg; textFgOver: lightButtonFgOver; - padding: margins(73px, 10px, 22px, 8px); + padding: margins(70px, 10px, 22px, 8px); } statisticsShowMoreButtonArrowPosition: point(29px, 13px); statisticsShowMoreButtonArrowSize: 7px; -statisticsLimitsDividerPadding: margins(22px, -26px, 22px, 16px); +statisticsLimitsDividerPadding: margins(22px, -26px, 22px, 22px); +statisticsLimitsLinePadding: margins(0px, -2px, 0px, 0px); + +boostsLayerOverviewMargins: margins(0px, 12px, 0px, 4px); +boostsOverviewValuePadding: margins(2px, 0px, 0px, 0px); +boostsChartHeaderPadding: margins(2px, 1px, 0px, 1px); + +boostsListBox: PeerList(defaultPeerList) { + padding: margins( + 0px, + 7px, + 0px, + 7px); + item: PeerListItem(defaultPeerListItem) { + height: 52px; + photoPosition: point(18px, 4px); + namePosition: point(70px, 6px); + statusPosition: point(70px, 26px); + photoSize: 42px; + } +} +boostsLinkSkip: 5px; +boostsLinkFieldPadding: margins(22px, 7px, 22px, 12px); boostsButton: SettingsButton(defaultSettingsButton) { textFg: lightButtonFg; textFgOver: lightButtonFgOver; diff --git a/Telegram/SourceFiles/ui/boxes/boost_box.cpp b/Telegram/SourceFiles/ui/boxes/boost_box.cpp index e895029c89..abae42f218 100644 --- a/Telegram/SourceFiles/ui/boxes/boost_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/boost_box.cpp @@ -60,7 +60,8 @@ void BoostBox( BoxShowFinishes(box), state->you.value(), box->verticalLayout(), - data); + data, + st::boxRowPadding); box->addTopButton(st::boxTitleClose, [=] { box->closeBox(); }); @@ -176,7 +177,8 @@ void FillBoostLimit( rpl::producer<> showFinished, rpl::producer you, not_null container, - BoostBoxData data) { + BoostBoxData data, + style::margins limitLinePadding) { const auto full = !data.boost.nextLevelBoosts; if (data.boost.mine && data.boost.boosts > 0) { @@ -265,7 +267,8 @@ void FillBoostLimit( max, true, nullptr, - &st::premiumIconBoost); + &st::premiumIconBoost, + limitLinePadding); addSkip(st::premiumLineTextSkip); const auto level = [](int level) { @@ -284,7 +287,8 @@ void FillBoostLimit( .rightLabel = level(data.boost.level + 1), .dynamic = true, }, - std::move(ratioValue)); + std::move(ratioValue), + limitLinePadding); } } // namespace Ui diff --git a/Telegram/SourceFiles/ui/boxes/boost_box.h b/Telegram/SourceFiles/ui/boxes/boost_box.h index fb4e9f04e4..e35178fac7 100644 --- a/Telegram/SourceFiles/ui/boxes/boost_box.h +++ b/Telegram/SourceFiles/ui/boxes/boost_box.h @@ -34,6 +34,7 @@ void FillBoostLimit( rpl::producer<> showFinished, rpl::producer you, not_null container, - BoostBoxData data); + BoostBoxData data, + style::margins limitLinePadding); } // namespace Ui diff --git a/Telegram/SourceFiles/ui/effects/premium.style b/Telegram/SourceFiles/ui/effects/premium.style index e98e68d9ae..55e89602ad 100644 --- a/Telegram/SourceFiles/ui/effects/premium.style +++ b/Telegram/SourceFiles/ui/effects/premium.style @@ -95,6 +95,7 @@ defaultPremiumBubble: PremiumBubble { tailSize: size(21px, 7px); font: font(19px); } +premiumLineRadius: 5px; premiumLineTextSkip: 11px; premiumInfographicPadding: margins(0px, 10px, 0px, 15px); diff --git a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp index 151ee78cf7..310f2291dc 100644 --- a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp @@ -20,11 +20,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/padding_wrap.h" #include "ui/wrap/vertical_layout.h" #include "ui/painter.h" -#include "styles/style_premium.h" #include "styles/style_boxes.h" -#include "styles/style_settings.h" #include "styles/style_layers.h" -#include "styles/style_widgets.h" +#include "styles/style_premium.h" +#include "styles/style_settings.h" #include "styles/style_window.h" #include @@ -393,7 +392,8 @@ public: int maxCounter, bool premiumPossible, rpl::producer<> showFinishes, - const style::icon *icon); + const style::icon *icon, + const style::margins &outerPadding); protected: void paintEvent(QPaintEvent *e) override; @@ -418,6 +418,7 @@ private: Bubble _bubble; const int _maxBubbleWidth; const bool _premiumPossible; + const style::margins _outerPadding; Ui::Animations::Simple _appearanceAnimation; QSize _spaceForDeflection; @@ -441,7 +442,8 @@ BubbleWidget::BubbleWidget( int maxCounter, bool premiumPossible, rpl::producer<> showFinishes, - const style::icon *icon) + const style::icon *icon, + const style::margins &outerPadding) : RpWidget(parent) , _st(st) , _state(std::move(state)) @@ -454,6 +456,7 @@ BubbleWidget::BubbleWidget( premiumPossible) , _maxBubbleWidth(_bubble.countMaxWidth(_maxCounter)) , _premiumPossible(premiumPossible) +, _outerPadding(outerPadding) , _deflection(kDeflection) , _stepBeforeDeflection(kStepBeforeDeflection) , _stepAfterDeflection(kStepAfterDeflection) { @@ -484,10 +487,9 @@ BubbleWidget::BubbleWidget( void BubbleWidget::animateTo(BubbleRowState state) { const auto parent = parentWidget(); const auto computeLeft = [=](float64 pointRatio, float64 animProgress) { - const auto &padding = st::boxRowPadding; const auto halfWidth = (_maxBubbleWidth / 2); - const auto left = padding.left(); - const auto right = padding.right(); + const auto left = _outerPadding.left(); + const auto right = _outerPadding.right(); const auto available = parent->width() - left - right; const auto delta = (pointRatio - _animatingFromResultRatio); const auto center = available @@ -497,7 +499,7 @@ void BubbleWidget::animateTo(BubbleRowState state) { const auto moveEndPoint = state.ratio; const auto computeEdge = [=] { return parent->width() - - st::boxRowPadding.right() + - _outerPadding.right() - _maxBubbleWidth; }; struct LeftEdge final { @@ -506,7 +508,7 @@ void BubbleWidget::animateTo(BubbleRowState state) { }; const auto leftEdge = [&]() -> LeftEdge { const auto finish = computeLeft(moveEndPoint, 1.); - const auto &padding = st::boxRowPadding; + const auto &padding = _outerPadding; if (finish <= padding.left()) { const auto halfWidth = (_maxBubbleWidth / 2); const auto goodPointRatio = float64(halfWidth) @@ -834,7 +836,10 @@ void Line::recache(const QSize &s) { const auto pathRound = [&](int width) { auto result = QPainterPath(); - result.addRoundedRect(r(width), st::buttonRadius, st::buttonRadius); + result.addRoundedRect( + r(width), + st::premiumLineRadius, + st::premiumLineRadius); return result; }; const auto width = s.width(); @@ -904,7 +909,8 @@ void AddBubbleRow( max, premiumPossible, ProcessTextFactory(phrase), - icon); + icon, + st::boxRowPadding); } void AddBubbleRow( @@ -915,7 +921,8 @@ void AddBubbleRow( int max, bool premiumPossible, Fn text, - const style::icon *icon) { + const style::icon *icon, + const style::margins &outerPadding) { const auto container = parent->add( object_ptr(parent, 0)); const auto bubble = Ui::CreateChild( @@ -926,7 +933,8 @@ void AddBubbleRow( max, premiumPossible, std::move(showFinishes), - icon); + icon, + outerPadding); rpl::combine( container->sizeValue(), bubble->sizeValue() @@ -967,10 +975,11 @@ void AddLimitRow( not_null parent, const style::PremiumLimits &st, LimitRowLabels labels, - rpl::producer ratio) { + rpl::producer ratio, + const style::margins &padding) { parent->add( object_ptr(parent, st, std::move(labels), std::move(ratio)), - st::boxRowPadding); + padding); } void AddAccountsRow( diff --git a/Telegram/SourceFiles/ui/effects/premium_graphics.h b/Telegram/SourceFiles/ui/effects/premium_graphics.h index eefd9a8852..1292a69804 100644 --- a/Telegram/SourceFiles/ui/effects/premium_graphics.h +++ b/Telegram/SourceFiles/ui/effects/premium_graphics.h @@ -65,7 +65,8 @@ void AddBubbleRow( int max, bool premiumPossible, Fn text, - const style::icon *icon); + const style::icon *icon, + const style::margins &outerPadding); void AddLimitRow( not_null parent, @@ -93,7 +94,8 @@ void AddLimitRow( not_null parent, const style::PremiumLimits &st, LimitRowLabels labels, - rpl::producer ratio); + rpl::producer ratio, + const style::margins &padding); struct AccountsRowArgs final { std::shared_ptr group;