mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed height of top bar with large subtext in premium settings.
This commit is contained in:
parent
cf4dfa55da
commit
68b1b595a5
1 changed files with 33 additions and 3 deletions
|
@ -397,6 +397,8 @@ public:
|
||||||
virtual void setPaused(bool paused) = 0;
|
virtual void setPaused(bool paused) = 0;
|
||||||
virtual void setTextPosition(int x, int y) = 0;
|
virtual void setTextPosition(int x, int y) = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual rpl::producer<int> additionalHeight() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEdges(QPainter &p, const QBrush &brush) const;
|
void paintEdges(QPainter &p, const QBrush &brush) const;
|
||||||
void paintEdges(QPainter &p) const;
|
void paintEdges(QPainter &p) const;
|
||||||
|
@ -601,6 +603,8 @@ public:
|
||||||
void setPaused(bool paused) override;
|
void setPaused(bool paused) override;
|
||||||
void setTextPosition(int x, int y) override;
|
void setTextPosition(int x, int y) override;
|
||||||
|
|
||||||
|
rpl::producer<int> additionalHeight() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
@ -912,6 +916,10 @@ void TopBarUser::setTextPosition(int x, int y) {
|
||||||
_smallTop.position = { x, y };
|
_smallTop.position = { x, y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<int> TopBarUser::additionalHeight() const {
|
||||||
|
return rpl::never<int>();
|
||||||
|
}
|
||||||
|
|
||||||
void TopBarUser::paintEvent(QPaintEvent *e) {
|
void TopBarUser::paintEvent(QPaintEvent *e) {
|
||||||
auto p = QPainter(this);
|
auto p = QPainter(this);
|
||||||
|
|
||||||
|
@ -939,6 +947,8 @@ public:
|
||||||
void setPaused(bool paused) override;
|
void setPaused(bool paused) override;
|
||||||
void setTextPosition(int x, int y) override;
|
void setTextPosition(int x, int y) override;
|
||||||
|
|
||||||
|
rpl::producer<int> additionalHeight() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
@ -1020,6 +1030,13 @@ void TopBar::setTextPosition(int x, int y) {
|
||||||
_titlePosition = { x, y };
|
_titlePosition = { x, y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<int> TopBar::additionalHeight() const {
|
||||||
|
return _about->heightValue(
|
||||||
|
) | rpl::map([l = st::settingsPremiumAbout.style.lineHeight](int height) {
|
||||||
|
return std::max(height - l * 2, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void TopBar::resizeEvent(QResizeEvent *e) {
|
void TopBar::resizeEvent(QResizeEvent *e) {
|
||||||
const auto progress = (e->size().height() - minimumHeight())
|
const auto progress = (e->size().height() - minimumHeight())
|
||||||
/ float64(maximumHeight() - minimumHeight());
|
/ float64(maximumHeight() - minimumHeight());
|
||||||
|
@ -1530,12 +1547,25 @@ QPointer<Ui::RpWidget> Premium::createPinnedToTop(
|
||||||
content->setRoundEdges(wrap == Info::Wrap::Layer);
|
content->setRoundEdges(wrap == Info::Wrap::Layer);
|
||||||
}, content->lifetime());
|
}, content->lifetime());
|
||||||
|
|
||||||
content->setMaximumHeight(isEmojiStatus
|
const auto calculateMaximumHeight = [=] {
|
||||||
? st::settingsPremiumUserHeight + TopTransitionSkip()
|
return isEmojiStatus
|
||||||
: st::settingsPremiumTopHeight);
|
? st::settingsPremiumUserHeight + TopTransitionSkip()
|
||||||
|
: st::settingsPremiumTopHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
content->setMaximumHeight(calculateMaximumHeight());
|
||||||
content->setMinimumHeight(st::infoLayerTopBarHeight);
|
content->setMinimumHeight(st::infoLayerTopBarHeight);
|
||||||
|
|
||||||
content->resize(content->width(), content->maximumHeight());
|
content->resize(content->width(), content->maximumHeight());
|
||||||
|
content->additionalHeight(
|
||||||
|
) | rpl::start_with_next([=](int additionalHeight) {
|
||||||
|
const auto wasMax = (content->height() == content->maximumHeight());
|
||||||
|
content->setMaximumHeight(calculateMaximumHeight()
|
||||||
|
+ additionalHeight);
|
||||||
|
if (wasMax) {
|
||||||
|
content->resize(content->width(), content->maximumHeight());
|
||||||
|
}
|
||||||
|
}, content->lifetime());
|
||||||
|
|
||||||
_wrap.value(
|
_wrap.value(
|
||||||
) | rpl::start_with_next([=](Info::Wrap wrap) {
|
) | rpl::start_with_next([=](Info::Wrap wrap) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue