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