mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-25 23:13:11 +02:00
Added ability to provide max width to about label in premium top bar.
This commit is contained in:
parent
50d74fcf25
commit
8e3100acdd
3 changed files with 9 additions and 2 deletions
|
@ -33,6 +33,7 @@ PremiumCover {
|
|||
titlePadding: margins;
|
||||
titleFont: font;
|
||||
about: FlatLabel;
|
||||
aboutMaxWidth: pixels;
|
||||
additionalShadowForDarkThemes: bool;
|
||||
}
|
||||
ComposePremiumRequired {
|
||||
|
@ -64,6 +65,7 @@ defaultPremiumCover: PremiumCover {
|
|||
textFg: premiumButtonFg;
|
||||
minWidth: 190px;
|
||||
}
|
||||
aboutMaxWidth: 0px;
|
||||
additionalShadowForDarkThemes: true;
|
||||
}
|
||||
userPremiumCoverAbout: FlatLabel(boxDividerLabel) {
|
||||
|
|
|
@ -107,6 +107,7 @@ TopBar::TopBar(
|
|||
, _logo(descriptor.logo)
|
||||
, _titleFont(st.titleFont)
|
||||
, _titlePadding(st.titlePadding)
|
||||
, _aboutMaxWidth(st.aboutMaxWidth)
|
||||
, _about(this, std::move(descriptor.about), st.about)
|
||||
, _ministars(this, descriptor.optimizeMinistars, MiniStars::Type::BiStars) {
|
||||
std::move(
|
||||
|
@ -212,8 +213,11 @@ void TopBar::resizeEvent(QResizeEvent *e) {
|
|||
const auto aboutTop = titleTop
|
||||
+ titlePathRect.height()
|
||||
+ _titlePadding.bottom();
|
||||
_about->resizeToWidth(availableWidth);
|
||||
_about->moveToLeft(padding.left(), aboutTop);
|
||||
_about->resizeToWidth(_aboutMaxWidth ? _aboutMaxWidth : availableWidth);
|
||||
_about->moveToLeft(
|
||||
padding.left()
|
||||
+ (_aboutMaxWidth ? (availableWidth - _about->width()) / 2 : 0),
|
||||
aboutTop);
|
||||
_about->setOpacity(_progress.body);
|
||||
|
||||
RpWidget::resizeEvent(e);
|
||||
|
|
|
@ -92,6 +92,7 @@ private:
|
|||
const QString _logo;
|
||||
const style::font &_titleFont;
|
||||
const style::margins &_titlePadding;
|
||||
const int _aboutMaxWidth = 0;
|
||||
object_ptr<FlatLabel> _about;
|
||||
ColoredMiniStars _ministars;
|
||||
QSvgRenderer _star;
|
||||
|
|
Loading…
Add table
Reference in a new issue