mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Improve info section navigation.
Also fix render glitch in StickersListWidget.
This commit is contained in:
parent
aecc119bac
commit
a86788f4d7
2 changed files with 31 additions and 4 deletions
|
@ -871,10 +871,18 @@ void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int index, bo
|
|||
auto w = qMax(qRound(coef * sticker->dimensions.width()), 1);
|
||||
auto h = qMax(qRound(coef * sticker->dimensions.height()), 1);
|
||||
auto ppos = pos + QPoint((_singleSize.width() - w) / 2, (_singleSize.height() - h) / 2);
|
||||
auto paintImage = [&](ImagePtr image) {
|
||||
if (image->loaded()) {
|
||||
p.drawPixmapLeft(
|
||||
ppos,
|
||||
width(),
|
||||
image->pixSingle(w, h, w, h, ImageRoundRadius::None));
|
||||
}
|
||||
};
|
||||
if (goodThumb) {
|
||||
p.drawPixmapLeft(ppos, width(), sticker->thumb->pixSingle(w, h, w, h, ImageRoundRadius::None));
|
||||
paintImage(sticker->thumb);
|
||||
} else if (!sticker->sticker()->img->isNull()) {
|
||||
p.drawPixmapLeft(ppos, width(), sticker->sticker()->img->pixSingle(w, h, w, h, ImageRoundRadius::None));
|
||||
paintImage(sticker->sticker()->img);
|
||||
}
|
||||
|
||||
if (selected && stickerHasDeleteButton(set, index)) {
|
||||
|
|
|
@ -590,9 +590,28 @@ bool WrapWidget::showInternal(
|
|||
return false;
|
||||
}
|
||||
auto content = infoMemento->content();
|
||||
if (_controller->validateMementoPeer(content)) {
|
||||
if (_content->showInternal(content)) {
|
||||
auto skipInternal = !_historyStack.empty()
|
||||
&& (params.way == Window::SectionShow::Way::ClearStack);
|
||||
if (_controller->validateMementoPeer(content)
|
||||
&& infoMemento->stackSize() == 1) {
|
||||
if (!skipInternal && _content->showInternal(content)) {
|
||||
return true;
|
||||
} else if (_topTabs) {
|
||||
// If we open the profile being in the media tab.
|
||||
// Just switch back to the profile tab.
|
||||
auto type = content->section().type();
|
||||
if (type == Section::Type::Profile
|
||||
&& _tab != Tab::Profile) {
|
||||
_anotherTabMemento = std::move(infoMemento->takeStack().back());
|
||||
_topTabs->setActiveSection(static_cast<int>(Tab::Profile));
|
||||
return true;
|
||||
} else if (type == Section::Type::Media
|
||||
&& _tab != Tab::Media
|
||||
&& Media::TypeToTabIndex(content->section().mediaType()).has_value()) {
|
||||
_anotherTabMemento = std::move(infoMemento->takeStack().back());
|
||||
_topTabs->setActiveSection(static_cast<int>(Tab::Media));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
showNewContent(
|
||||
|
|
Loading…
Add table
Reference in a new issue