mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Improved style of boosts info.
This commit is contained in:
parent
d3aa0664a7
commit
daf76c1bc2
8 changed files with 76 additions and 33 deletions
|
@ -32,7 +32,7 @@ void AddHeader(
|
||||||
tr::phrase<> text) {
|
tr::phrase<> text) {
|
||||||
const auto header = content->add(
|
const auto header = content->add(
|
||||||
object_ptr<Statistic::Header>(content),
|
object_ptr<Statistic::Header>(content),
|
||||||
st::statisticsLayerMargins + st::statisticsChartHeaderPadding);
|
st::statisticsLayerMargins + st::boostsChartHeaderPadding);
|
||||||
header->resizeToWidth(header->width());
|
header->resizeToWidth(header->width());
|
||||||
header->setTitle(text(tr::now));
|
header->setTitle(text(tr::now));
|
||||||
header->setSubTitle({});
|
header->setSubTitle({});
|
||||||
|
@ -43,7 +43,7 @@ void FillOverview(
|
||||||
const Data::BoostStatus &status) {
|
const Data::BoostStatus &status) {
|
||||||
const auto &stats = status.overview;
|
const auto &stats = status.overview;
|
||||||
|
|
||||||
::Settings::AddSkip(content, st::statisticsLayerOverviewMargins.top());
|
::Settings::AddSkip(content, st::boostsLayerOverviewMargins.top());
|
||||||
AddHeader(content, tr::lng_stats_overview_title);
|
AddHeader(content, tr::lng_stats_overview_title);
|
||||||
::Settings::AddSkip(content);
|
::Settings::AddSkip(content);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void FillOverview(
|
||||||
) | rpl::start_with_next([=](const QSize &s) {
|
) | rpl::start_with_next([=](const QSize &s) {
|
||||||
const auto halfWidth = s.width() / 2;
|
const auto halfWidth = s.width() / 2;
|
||||||
{
|
{
|
||||||
const auto &p = st::statisticsOverviewValuePadding;
|
const auto &p = st::boostsOverviewValuePadding;
|
||||||
topLeftLabel->moveToLeft(p.left(), p.top());
|
topLeftLabel->moveToLeft(p.left(), p.top());
|
||||||
}
|
}
|
||||||
topRightLabel->moveToLeft(
|
topRightLabel->moveToLeft(
|
||||||
|
@ -138,7 +138,7 @@ void FillOverview(
|
||||||
topRightLabel->x(),
|
topRightLabel->x(),
|
||||||
bottomLeftLabel->y());
|
bottomLeftLabel->y());
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
::Settings::AddSkip(content, st::statisticsLayerOverviewMargins.bottom());
|
::Settings::AddSkip(content, st::boostsLayerOverviewMargins.bottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillShareLink(
|
void FillShareLink(
|
||||||
|
@ -161,7 +161,7 @@ void FillShareLink(
|
||||||
nullptr);
|
nullptr);
|
||||||
content->add(
|
content->add(
|
||||||
label->take(),
|
label->take(),
|
||||||
st::inviteLinkFieldPadding);
|
st::boostsLinkFieldPadding);
|
||||||
|
|
||||||
label->clicks(
|
label->clicks(
|
||||||
) | rpl::start_with_next(copyLink, label->lifetime());
|
) | rpl::start_with_next(copyLink, label->lifetime());
|
||||||
|
@ -169,7 +169,7 @@ void FillShareLink(
|
||||||
object_ptr<Ui::VerticalLayout>(content));
|
object_ptr<Ui::VerticalLayout>(content));
|
||||||
Ui::AddCopyShareLinkButtons(copyShareWrap, copyLink, shareLink);
|
Ui::AddCopyShareLinkButtons(copyShareWrap, copyLink, shareLink);
|
||||||
copyShareWrap->widgetAt(0)->showChildren();
|
copyShareWrap->widgetAt(0)->showChildren();
|
||||||
::Settings::AddSkip(content, st::inviteLinkFieldPadding.bottom());
|
::Settings::AddSkip(content, st::boostsLinkFieldPadding.bottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -210,7 +210,8 @@ InnerWidget::InnerWidget(
|
||||||
= status.overview.nextLevelBoostCount,
|
= status.overview.nextLevelBoostCount,
|
||||||
.mine = status.overview.isBoosted,
|
.mine = status.overview.isBoosted,
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
st::statisticsLimitsLinePadding);
|
||||||
inner->add(object_ptr<Ui::DividerLabel>(
|
inner->add(object_ptr<Ui::DividerLabel>(
|
||||||
inner,
|
inner,
|
||||||
std::move(dividerContent),
|
std::move(dividerContent),
|
||||||
|
@ -228,7 +229,8 @@ InnerWidget::InnerWidget(
|
||||||
using PeerPtr = not_null<PeerData*>;
|
using PeerPtr = not_null<PeerData*>;
|
||||||
const auto header = inner->add(
|
const auto header = inner->add(
|
||||||
object_ptr<Statistic::Header>(inner),
|
object_ptr<Statistic::Header>(inner),
|
||||||
st::statisticsLayerMargins);
|
st::statisticsLayerMargins
|
||||||
|
+ st::boostsChartHeaderPadding);
|
||||||
header->resizeToWidth(header->width());
|
header->resizeToWidth(header->width());
|
||||||
header->setTitle(tr::lng_boosts_list_title(
|
header->setTitle(tr::lng_boosts_list_title(
|
||||||
tr::now,
|
tr::now,
|
||||||
|
@ -250,6 +252,7 @@ InnerWidget::InnerWidget(
|
||||||
|
|
||||||
::Settings::AddSkip(inner);
|
::Settings::AddSkip(inner);
|
||||||
AddHeader(inner, tr::lng_boosts_link_title);
|
AddHeader(inner, tr::lng_boosts_link_title);
|
||||||
|
::Settings::AddSkip(inner, st::boostsLinkSkip);
|
||||||
FillShareLink(inner, _show, status.link, peer);
|
FillShareLink(inner, _show, status.link, peer);
|
||||||
::Settings::AddSkip(inner);
|
::Settings::AddSkip(inner);
|
||||||
::Settings::AddDividerText(inner, tr::lng_boosts_link_subtext());
|
::Settings::AddDividerText(inner, tr::lng_boosts_link_subtext());
|
||||||
|
|
|
@ -355,6 +355,7 @@ BoostsController::BoostsController(BoostsDescriptor d)
|
||||||
, _showPeerInfo(std::move(d.showPeerInfo))
|
, _showPeerInfo(std::move(d.showPeerInfo))
|
||||||
, _api(d.peer)
|
, _api(d.peer)
|
||||||
, _firstSlice(std::move(d.firstSlice)) {
|
, _firstSlice(std::move(d.firstSlice)) {
|
||||||
|
PeerListController::setStyleOverrides(&st::boostsListBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
Main::Session &BoostsController::session() const {
|
Main::Session &BoostsController::session() const {
|
||||||
|
|
|
@ -109,13 +109,35 @@ statisticsShowMoreButton: SettingsButton(defaultSettingsButton) {
|
||||||
textFg: lightButtonFg;
|
textFg: lightButtonFg;
|
||||||
textFgOver: lightButtonFgOver;
|
textFgOver: lightButtonFgOver;
|
||||||
|
|
||||||
padding: margins(73px, 10px, 22px, 8px);
|
padding: margins(70px, 10px, 22px, 8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
statisticsShowMoreButtonArrowPosition: point(29px, 13px);
|
statisticsShowMoreButtonArrowPosition: point(29px, 13px);
|
||||||
statisticsShowMoreButtonArrowSize: 7px;
|
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) {
|
boostsButton: SettingsButton(defaultSettingsButton) {
|
||||||
textFg: lightButtonFg;
|
textFg: lightButtonFg;
|
||||||
textFgOver: lightButtonFgOver;
|
textFgOver: lightButtonFgOver;
|
||||||
|
|
|
@ -60,7 +60,8 @@ void BoostBox(
|
||||||
BoxShowFinishes(box),
|
BoxShowFinishes(box),
|
||||||
state->you.value(),
|
state->you.value(),
|
||||||
box->verticalLayout(),
|
box->verticalLayout(),
|
||||||
data);
|
data,
|
||||||
|
st::boxRowPadding);
|
||||||
|
|
||||||
box->addTopButton(st::boxTitleClose, [=] { box->closeBox(); });
|
box->addTopButton(st::boxTitleClose, [=] { box->closeBox(); });
|
||||||
|
|
||||||
|
@ -176,7 +177,8 @@ void FillBoostLimit(
|
||||||
rpl::producer<> showFinished,
|
rpl::producer<> showFinished,
|
||||||
rpl::producer<bool> you,
|
rpl::producer<bool> you,
|
||||||
not_null<VerticalLayout*> container,
|
not_null<VerticalLayout*> container,
|
||||||
BoostBoxData data) {
|
BoostBoxData data,
|
||||||
|
style::margins limitLinePadding) {
|
||||||
const auto full = !data.boost.nextLevelBoosts;
|
const auto full = !data.boost.nextLevelBoosts;
|
||||||
|
|
||||||
if (data.boost.mine && data.boost.boosts > 0) {
|
if (data.boost.mine && data.boost.boosts > 0) {
|
||||||
|
@ -265,7 +267,8 @@ void FillBoostLimit(
|
||||||
max,
|
max,
|
||||||
true,
|
true,
|
||||||
nullptr,
|
nullptr,
|
||||||
&st::premiumIconBoost);
|
&st::premiumIconBoost,
|
||||||
|
limitLinePadding);
|
||||||
addSkip(st::premiumLineTextSkip);
|
addSkip(st::premiumLineTextSkip);
|
||||||
|
|
||||||
const auto level = [](int level) {
|
const auto level = [](int level) {
|
||||||
|
@ -284,7 +287,8 @@ void FillBoostLimit(
|
||||||
.rightLabel = level(data.boost.level + 1),
|
.rightLabel = level(data.boost.level + 1),
|
||||||
.dynamic = true,
|
.dynamic = true,
|
||||||
},
|
},
|
||||||
std::move(ratioValue));
|
std::move(ratioValue),
|
||||||
|
limitLinePadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -34,6 +34,7 @@ void FillBoostLimit(
|
||||||
rpl::producer<> showFinished,
|
rpl::producer<> showFinished,
|
||||||
rpl::producer<bool> you,
|
rpl::producer<bool> you,
|
||||||
not_null<VerticalLayout*> container,
|
not_null<VerticalLayout*> container,
|
||||||
BoostBoxData data);
|
BoostBoxData data,
|
||||||
|
style::margins limitLinePadding);
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
|
@ -95,6 +95,7 @@ defaultPremiumBubble: PremiumBubble {
|
||||||
tailSize: size(21px, 7px);
|
tailSize: size(21px, 7px);
|
||||||
font: font(19px);
|
font: font(19px);
|
||||||
}
|
}
|
||||||
|
premiumLineRadius: 5px;
|
||||||
premiumLineTextSkip: 11px;
|
premiumLineTextSkip: 11px;
|
||||||
premiumInfographicPadding: margins(0px, 10px, 0px, 15px);
|
premiumInfographicPadding: margins(0px, 10px, 0px, 15px);
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/wrap/padding_wrap.h"
|
#include "ui/wrap/padding_wrap.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "ui/painter.h"
|
#include "ui/painter.h"
|
||||||
#include "styles/style_premium.h"
|
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_settings.h"
|
|
||||||
#include "styles/style_layers.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 "styles/style_window.h"
|
||||||
|
|
||||||
#include <QtGui/QBrush>
|
#include <QtGui/QBrush>
|
||||||
|
@ -393,7 +392,8 @@ public:
|
||||||
int maxCounter,
|
int maxCounter,
|
||||||
bool premiumPossible,
|
bool premiumPossible,
|
||||||
rpl::producer<> showFinishes,
|
rpl::producer<> showFinishes,
|
||||||
const style::icon *icon);
|
const style::icon *icon,
|
||||||
|
const style::margins &outerPadding);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
@ -418,6 +418,7 @@ private:
|
||||||
Bubble _bubble;
|
Bubble _bubble;
|
||||||
const int _maxBubbleWidth;
|
const int _maxBubbleWidth;
|
||||||
const bool _premiumPossible;
|
const bool _premiumPossible;
|
||||||
|
const style::margins _outerPadding;
|
||||||
|
|
||||||
Ui::Animations::Simple _appearanceAnimation;
|
Ui::Animations::Simple _appearanceAnimation;
|
||||||
QSize _spaceForDeflection;
|
QSize _spaceForDeflection;
|
||||||
|
@ -441,7 +442,8 @@ BubbleWidget::BubbleWidget(
|
||||||
int maxCounter,
|
int maxCounter,
|
||||||
bool premiumPossible,
|
bool premiumPossible,
|
||||||
rpl::producer<> showFinishes,
|
rpl::producer<> showFinishes,
|
||||||
const style::icon *icon)
|
const style::icon *icon,
|
||||||
|
const style::margins &outerPadding)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _st(st)
|
, _st(st)
|
||||||
, _state(std::move(state))
|
, _state(std::move(state))
|
||||||
|
@ -454,6 +456,7 @@ BubbleWidget::BubbleWidget(
|
||||||
premiumPossible)
|
premiumPossible)
|
||||||
, _maxBubbleWidth(_bubble.countMaxWidth(_maxCounter))
|
, _maxBubbleWidth(_bubble.countMaxWidth(_maxCounter))
|
||||||
, _premiumPossible(premiumPossible)
|
, _premiumPossible(premiumPossible)
|
||||||
|
, _outerPadding(outerPadding)
|
||||||
, _deflection(kDeflection)
|
, _deflection(kDeflection)
|
||||||
, _stepBeforeDeflection(kStepBeforeDeflection)
|
, _stepBeforeDeflection(kStepBeforeDeflection)
|
||||||
, _stepAfterDeflection(kStepAfterDeflection) {
|
, _stepAfterDeflection(kStepAfterDeflection) {
|
||||||
|
@ -484,10 +487,9 @@ BubbleWidget::BubbleWidget(
|
||||||
void BubbleWidget::animateTo(BubbleRowState state) {
|
void BubbleWidget::animateTo(BubbleRowState state) {
|
||||||
const auto parent = parentWidget();
|
const auto parent = parentWidget();
|
||||||
const auto computeLeft = [=](float64 pointRatio, float64 animProgress) {
|
const auto computeLeft = [=](float64 pointRatio, float64 animProgress) {
|
||||||
const auto &padding = st::boxRowPadding;
|
|
||||||
const auto halfWidth = (_maxBubbleWidth / 2);
|
const auto halfWidth = (_maxBubbleWidth / 2);
|
||||||
const auto left = padding.left();
|
const auto left = _outerPadding.left();
|
||||||
const auto right = padding.right();
|
const auto right = _outerPadding.right();
|
||||||
const auto available = parent->width() - left - right;
|
const auto available = parent->width() - left - right;
|
||||||
const auto delta = (pointRatio - _animatingFromResultRatio);
|
const auto delta = (pointRatio - _animatingFromResultRatio);
|
||||||
const auto center = available
|
const auto center = available
|
||||||
|
@ -497,7 +499,7 @@ void BubbleWidget::animateTo(BubbleRowState state) {
|
||||||
const auto moveEndPoint = state.ratio;
|
const auto moveEndPoint = state.ratio;
|
||||||
const auto computeEdge = [=] {
|
const auto computeEdge = [=] {
|
||||||
return parent->width()
|
return parent->width()
|
||||||
- st::boxRowPadding.right()
|
- _outerPadding.right()
|
||||||
- _maxBubbleWidth;
|
- _maxBubbleWidth;
|
||||||
};
|
};
|
||||||
struct LeftEdge final {
|
struct LeftEdge final {
|
||||||
|
@ -506,7 +508,7 @@ void BubbleWidget::animateTo(BubbleRowState state) {
|
||||||
};
|
};
|
||||||
const auto leftEdge = [&]() -> LeftEdge {
|
const auto leftEdge = [&]() -> LeftEdge {
|
||||||
const auto finish = computeLeft(moveEndPoint, 1.);
|
const auto finish = computeLeft(moveEndPoint, 1.);
|
||||||
const auto &padding = st::boxRowPadding;
|
const auto &padding = _outerPadding;
|
||||||
if (finish <= padding.left()) {
|
if (finish <= padding.left()) {
|
||||||
const auto halfWidth = (_maxBubbleWidth / 2);
|
const auto halfWidth = (_maxBubbleWidth / 2);
|
||||||
const auto goodPointRatio = float64(halfWidth)
|
const auto goodPointRatio = float64(halfWidth)
|
||||||
|
@ -834,7 +836,10 @@ void Line::recache(const QSize &s) {
|
||||||
|
|
||||||
const auto pathRound = [&](int width) {
|
const auto pathRound = [&](int width) {
|
||||||
auto result = QPainterPath();
|
auto result = QPainterPath();
|
||||||
result.addRoundedRect(r(width), st::buttonRadius, st::buttonRadius);
|
result.addRoundedRect(
|
||||||
|
r(width),
|
||||||
|
st::premiumLineRadius,
|
||||||
|
st::premiumLineRadius);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
const auto width = s.width();
|
const auto width = s.width();
|
||||||
|
@ -904,7 +909,8 @@ void AddBubbleRow(
|
||||||
max,
|
max,
|
||||||
premiumPossible,
|
premiumPossible,
|
||||||
ProcessTextFactory(phrase),
|
ProcessTextFactory(phrase),
|
||||||
icon);
|
icon,
|
||||||
|
st::boxRowPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBubbleRow(
|
void AddBubbleRow(
|
||||||
|
@ -915,7 +921,8 @@ void AddBubbleRow(
|
||||||
int max,
|
int max,
|
||||||
bool premiumPossible,
|
bool premiumPossible,
|
||||||
Fn<QString(int)> text,
|
Fn<QString(int)> text,
|
||||||
const style::icon *icon) {
|
const style::icon *icon,
|
||||||
|
const style::margins &outerPadding) {
|
||||||
const auto container = parent->add(
|
const auto container = parent->add(
|
||||||
object_ptr<Ui::FixedHeightWidget>(parent, 0));
|
object_ptr<Ui::FixedHeightWidget>(parent, 0));
|
||||||
const auto bubble = Ui::CreateChild<BubbleWidget>(
|
const auto bubble = Ui::CreateChild<BubbleWidget>(
|
||||||
|
@ -926,7 +933,8 @@ void AddBubbleRow(
|
||||||
max,
|
max,
|
||||||
premiumPossible,
|
premiumPossible,
|
||||||
std::move(showFinishes),
|
std::move(showFinishes),
|
||||||
icon);
|
icon,
|
||||||
|
outerPadding);
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
container->sizeValue(),
|
container->sizeValue(),
|
||||||
bubble->sizeValue()
|
bubble->sizeValue()
|
||||||
|
@ -967,10 +975,11 @@ void AddLimitRow(
|
||||||
not_null<Ui::VerticalLayout*> parent,
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
const style::PremiumLimits &st,
|
const style::PremiumLimits &st,
|
||||||
LimitRowLabels labels,
|
LimitRowLabels labels,
|
||||||
rpl::producer<float64> ratio) {
|
rpl::producer<float64> ratio,
|
||||||
|
const style::margins &padding) {
|
||||||
parent->add(
|
parent->add(
|
||||||
object_ptr<Line>(parent, st, std::move(labels), std::move(ratio)),
|
object_ptr<Line>(parent, st, std::move(labels), std::move(ratio)),
|
||||||
st::boxRowPadding);
|
padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddAccountsRow(
|
void AddAccountsRow(
|
||||||
|
|
|
@ -65,7 +65,8 @@ void AddBubbleRow(
|
||||||
int max,
|
int max,
|
||||||
bool premiumPossible,
|
bool premiumPossible,
|
||||||
Fn<QString(int)> text,
|
Fn<QString(int)> text,
|
||||||
const style::icon *icon);
|
const style::icon *icon,
|
||||||
|
const style::margins &outerPadding);
|
||||||
|
|
||||||
void AddLimitRow(
|
void AddLimitRow(
|
||||||
not_null<Ui::VerticalLayout*> parent,
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
|
@ -93,7 +94,8 @@ void AddLimitRow(
|
||||||
not_null<Ui::VerticalLayout*> parent,
|
not_null<Ui::VerticalLayout*> parent,
|
||||||
const style::PremiumLimits &st,
|
const style::PremiumLimits &st,
|
||||||
LimitRowLabels labels,
|
LimitRowLabels labels,
|
||||||
rpl::producer<float64> ratio);
|
rpl::producer<float64> ratio,
|
||||||
|
const style::margins &padding);
|
||||||
|
|
||||||
struct AccountsRowArgs final {
|
struct AccountsRowArgs final {
|
||||||
std::shared_ptr<Ui::RadiobuttonGroup> group;
|
std::shared_ptr<Ui::RadiobuttonGroup> group;
|
||||||
|
|
Loading…
Add table
Reference in a new issue