2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-29 13:39:06 +00:00

Improve rating layout.

This commit is contained in:
John Preston 2025-08-05 11:36:39 +04:00
parent bf0b85afd1
commit ee85bb9a1b
2 changed files with 32 additions and 30 deletions

View File

@ -12,67 +12,68 @@ LevelShape {
position: point; position: point;
} }
levelStyle: TextStyle(defaultTextStyle) { levelStyle: TextStyle(defaultTextStyle) {
font: font(11px semibold); font: font(9px semibold);
} }
levelTextFg: windowFgActive; levelTextFg: windowFgActive;
levelMargin: margins(6px, 6px, 6px, 6px); levelMargin: margins(4px, 3px, 2px, 2px);
levelBase: LevelShape { levelBase: LevelShape {
position: point(0px, 8px); position: point(0px, 6px);
} }
level1: LevelShape(levelBase) { level1: LevelShape(levelBase) {
icon: icon {{ "levels/level1_inner-31x31", windowBgActive }}; position: point(-1px, 6px);
icon: icon {{ "levels/level1_inner-26x26", windowBgActive }};
} }
level2: LevelShape(levelBase) { level2: LevelShape(level1) {
icon: icon {{ "levels/level2_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level2_inner-26x26", windowBgActive }};
} }
level3: LevelShape(levelBase) { level3: LevelShape(level1) {
icon: icon {{ "levels/level3_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level3_inner-26x26", windowBgActive }};
} }
level4: LevelShape(levelBase) { level4: LevelShape(level1) {
icon: icon {{ "levels/level4_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level4_inner-26x26", windowBgActive }};
} }
level5: LevelShape(levelBase) { level5: LevelShape(level1) {
icon: icon {{ "levels/level5_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level5_inner-26x26", windowBgActive }};
} }
level6: LevelShape(levelBase) { level6: LevelShape(level1) {
icon: icon {{ "levels/level6_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level6_inner-26x26", windowBgActive }};
} }
level7: LevelShape(levelBase) { level7: LevelShape(level1) {
icon: icon {{ "levels/level7_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level7_inner-26x26", windowBgActive }};
} }
level8: LevelShape(levelBase) { level8: LevelShape(level1) {
icon: icon {{ "levels/level8_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level8_inner-26x26", windowBgActive }};
} }
level9: LevelShape(levelBase) { level9: LevelShape(level1) {
icon: icon {{ "levels/level9_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level9_inner-26x26", windowBgActive }};
} }
level10: LevelShape(levelBase) { level10: LevelShape(levelBase) {
icon: icon {{ "levels/level10_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level10_inner-26x26", windowBgActive }};
} }
level20: LevelShape(levelBase) { level20: LevelShape(levelBase) {
icon: icon {{ "levels/level20_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level20_inner-26x26", windowBgActive }};
} }
level30: LevelShape(levelBase) { level30: LevelShape(levelBase) {
icon: icon {{ "levels/level30_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level30_inner-26x26", windowBgActive }};
} }
level40: LevelShape(levelBase) { level40: LevelShape(levelBase) {
icon: icon {{ "levels/level40_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level40_inner-26x26", windowBgActive }};
} }
level50: LevelShape(levelBase) { level50: LevelShape(levelBase) {
icon: icon {{ "levels/level50_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level50_inner-26x26", windowBgActive }};
} }
level60: LevelShape(levelBase) { level60: LevelShape(levelBase) {
icon: icon {{ "levels/level60_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level60_inner-26x26", windowBgActive }};
} }
level70: LevelShape(levelBase) { level70: LevelShape(levelBase) {
icon: icon {{ "levels/level70_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level70_inner-26x26", windowBgActive }};
} }
level80: LevelShape(levelBase) { level80: LevelShape(levelBase) {
icon: icon {{ "levels/level80_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level80_inner-26x26", windowBgActive }};
} }
level90: LevelShape(levelBase) { level90: LevelShape(levelBase) {
icon: icon {{ "levels/level90_inner-31x31", windowBgActive }}; icon: icon {{ "levels/level90_inner-26x26", windowBgActive }};
} }
levelNegative: LevelShape(levelBase) { levelNegative: LevelShape(levelBase) {
icon: icon {{ "levels/level_warning-18x18", attentionButtonFg, point(6px, 7px) }}; icon: icon {{ "levels/level_warning-18x18", attentionButtonFg, point(6px, 7px) }};

View File

@ -494,7 +494,8 @@ void StarsRating::updateData(Data::StarsRating rating) {
(rating.level < 0 (rating.level < 0
? QString() ? QString()
: Lang::FormatCountDecimal(rating.level))); : Lang::FormatCountDecimal(rating.level)));
_widthValue = _shape->icon.width() - st::levelMargin.left(); const auto &margin = st::levelMargin;
_widthValue = _shape->icon.width() + margin.right() - margin.left();
} }
updateWidth(); updateWidth();
} }