mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added ability to provide max width to about label in premium top bar.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user