mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-05 14:47:39 +00:00
Fix render bug, enable wide third column.
This commit is contained in:
parent
fe9630bb20
commit
866ff628b7
@ -588,16 +588,18 @@ int StickersListWidget::countDesiredHeight(int newWidth) {
|
||||
return 0;
|
||||
}
|
||||
auto availableWidth = newWidth - (st::stickerPanPadding - st::buttonRadius);
|
||||
_columnCount = availableWidth / st::stickerPanWidthMin;
|
||||
auto singleWidth = availableWidth / _columnCount;
|
||||
auto columnCount = availableWidth / st::stickerPanWidthMin;
|
||||
auto singleWidth = availableWidth / columnCount;
|
||||
auto fullWidth = (st::buttonRadius + newWidth + st::emojiScroll.width);
|
||||
auto rowsRight = (fullWidth - _columnCount * singleWidth) / 2;
|
||||
auto rowsRight = (fullWidth - columnCount * singleWidth) / 2;
|
||||
accumulate_max(rowsRight, st::emojiScroll.width);
|
||||
_rowsLeft = fullWidth
|
||||
- _columnCount * singleWidth
|
||||
- columnCount * singleWidth
|
||||
- rowsRight
|
||||
- st::buttonRadius;
|
||||
_singleSize = QSize(singleWidth, singleWidth);
|
||||
setColumnCount(columnCount);
|
||||
|
||||
auto visibleHeight = minimalHeight();
|
||||
auto minimalLastHeight = (visibleHeight - st::stickerPanPadding);
|
||||
auto countResult = [this, minimalLastHeight] {
|
||||
@ -1120,6 +1122,13 @@ void StickersListWidget::removeFavedSticker(int section, int index) {
|
||||
MTP::send(MTPmessages_FaveSticker(sticker->mtpInput(), MTP_bool(unfave)));
|
||||
}
|
||||
|
||||
void StickersListWidget::setColumnCount(int count) {
|
||||
if (_columnCount != count) {
|
||||
_columnCount = count;
|
||||
refreshFooterIcons();
|
||||
}
|
||||
}
|
||||
|
||||
void StickersListWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||
_lastMousePosition = e->globalPos();
|
||||
updateSelected();
|
||||
@ -1194,10 +1203,7 @@ void StickersListWidget::refreshStickers() {
|
||||
resizeToWidth(width());
|
||||
|
||||
if (_footer && _columnCount > 0) {
|
||||
_footer->refreshIcons(ValidateIconAnimations::None);
|
||||
if (_footer->hasOnlyFeaturedSets() && _section != Section::Featured) {
|
||||
showStickerSet(Stickers::FeaturedSetId);
|
||||
}
|
||||
refreshFooterIcons();
|
||||
}
|
||||
|
||||
_settings->setVisible(_section == Section::Stickers && _mySets.isEmpty());
|
||||
@ -1207,6 +1213,15 @@ void StickersListWidget::refreshStickers() {
|
||||
update();
|
||||
}
|
||||
|
||||
void StickersListWidget::refreshFooterIcons() {
|
||||
Expects(_columnCount > 0);
|
||||
|
||||
_footer->refreshIcons(ValidateIconAnimations::None);
|
||||
if (_footer->hasOnlyFeaturedSets() && _section != Section::Featured) {
|
||||
showStickerSet(Stickers::FeaturedSetId);
|
||||
}
|
||||
}
|
||||
|
||||
void StickersListWidget::preloadImages() {
|
||||
auto &sets = shownSets();
|
||||
for (int i = 0, l = sets.size(), k = 0; i < l; ++i) {
|
||||
|
@ -217,6 +217,8 @@ private:
|
||||
|
||||
void removeRecentSticker(int section, int index);
|
||||
void removeFavedSticker(int section, int index);
|
||||
void setColumnCount(int count);
|
||||
void refreshFooterIcons();
|
||||
|
||||
ChannelData *_megagroupSet = nullptr;
|
||||
Sets _mySets;
|
||||
|
@ -184,9 +184,12 @@ SectionWithToggle *SectionWithToggle::setToggleShown(
|
||||
return this;
|
||||
}
|
||||
|
||||
void SectionWithToggle::toggle(bool toggled) {
|
||||
void SectionWithToggle::toggle(bool toggled, anim::type animated) {
|
||||
if (_toggle) {
|
||||
_toggle->setChecked(toggled);
|
||||
if (animated == anim::type::instant) {
|
||||
_toggle->finishAnimating();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
using FixedHeightWidget::FixedHeightWidget;
|
||||
|
||||
SectionWithToggle *setToggleShown(rpl::producer<bool> &&shown);
|
||||
void toggle(bool toggled);
|
||||
void toggle(bool toggled, anim::type animated);
|
||||
bool toggled() const;
|
||||
rpl::producer<bool> toggledValue() const;
|
||||
|
||||
|
@ -245,7 +245,7 @@ void InnerWidget::saveState(not_null<Memento*> memento) {
|
||||
}
|
||||
|
||||
void InnerWidget::restoreState(not_null<Memento*> memento) {
|
||||
_cover->toggle(memento->infoExpanded());
|
||||
_cover->toggle(memento->infoExpanded(), anim::type::instant);
|
||||
if (_members) {
|
||||
_members->restoreState(memento);
|
||||
}
|
||||
|
@ -33,8 +33,9 @@ windowShadowShift: 1px;
|
||||
columnMinimalWidthLeft: 260px;
|
||||
columnMaximalWidthLeft: 540px;
|
||||
columnMinimalWidthMain: 380px;
|
||||
columnDesiredWidthMain: 512px;
|
||||
columnMinimalWidthThird: 292px;//345px;
|
||||
columnMaximalWidthThird: 345px;
|
||||
columnMaximalWidthThird: 430px;//345px;
|
||||
|
||||
adaptiveChatWideWidth: 880px;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user