mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-20 23:27:23 +00:00
resizing inline results to small heights started, fixed sticker with reply display
This commit is contained in:
parent
6236ef717e
commit
e43ea5101e
@ -1252,8 +1252,8 @@ void StickerPanInner::setScrollTop(int top) {
|
||||
updateSelected();
|
||||
}
|
||||
|
||||
int StickerPanInner::countHeight() {
|
||||
int result = 0, minLastH = _maxHeight - st::stickerPanPadding;
|
||||
int32 StickerPanInner::countHeight(bool plain) {
|
||||
int result = 0, minLastH = plain ? 0 : (_maxHeight - st::stickerPanPadding);
|
||||
if (_showingInlineItems) {
|
||||
result = st::emojiPanHeader;
|
||||
for (int i = 0, l = _inlineRows.count(); i < l; ++i) {
|
||||
@ -1876,20 +1876,27 @@ uint64 StickerPanInner::currentSet(int yOffset) const {
|
||||
return _sets.isEmpty() ? RecentStickerSetId : _sets.back().id;
|
||||
}
|
||||
|
||||
void StickerPanInner::hideInlineRowsPanel() {
|
||||
clearInlineRows(false);
|
||||
if (_showingInlineItems) {
|
||||
_showingSavedGifs = cShowingSavedGifs();
|
||||
if (_showingSavedGifs) {
|
||||
refreshSavedGifs();
|
||||
emit scrollToY(0);
|
||||
emit scrollUpdated();
|
||||
} else {
|
||||
showStickerSet(RecentStickerSetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted) {
|
||||
int32 count = results.size(), until = 0, untilrow = 0, untilcol = 0;
|
||||
if (!count) {
|
||||
clearInlineRows(resultsDeleted);
|
||||
if (_showingInlineItems) {
|
||||
_showingSavedGifs = cShowingSavedGifs();
|
||||
if (_showingSavedGifs) {
|
||||
refreshSavedGifs();
|
||||
emit scrollToY(0);
|
||||
emit scrollUpdated();
|
||||
} else {
|
||||
showStickerSet(RecentStickerSetId);
|
||||
}
|
||||
if (resultsDeleted) {
|
||||
clearInlineRows(true);
|
||||
}
|
||||
emit emptyInlineRows();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2559,6 +2566,8 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
|
||||
, _iconSelX(0, 0)
|
||||
, _iconsStartAnim(0)
|
||||
, _stickersShown(false)
|
||||
, _shownFromInlineQuery(false)
|
||||
, _contentMaxHeight(st::emojiPanMaxHeight)
|
||||
, _a_slide(animation(this, &EmojiPan::step_slide))
|
||||
, e_scroll(this, st::emojiScroll)
|
||||
, e_inner()
|
||||
@ -2620,6 +2629,8 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
|
||||
connect(&s_inner, SIGNAL(selected(PhotoData*)), this, SIGNAL(photoSelected(PhotoData*)));
|
||||
connect(&s_inner, SIGNAL(selected(InlineResult*,UserData*)), this, SIGNAL(inlineResultSelected(InlineResult*,UserData*)));
|
||||
|
||||
connect(&s_inner, SIGNAL(emptyInlineRows()), this, SLOT(onEmptyInlineRows()));
|
||||
|
||||
connect(&s_switch, SIGNAL(clicked()), this, SLOT(onSwitch()));
|
||||
connect(&e_switch, SIGNAL(clicked()), this, SLOT(onSwitch()));
|
||||
s_switch.moveToRight(0, 0, st::emojiPanWidth);
|
||||
@ -2648,7 +2659,7 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent)
|
||||
}
|
||||
|
||||
void EmojiPan::setMaxHeight(int32 h) {
|
||||
h = qMin(int(st::emojiPanMaxHeight), h);
|
||||
h = qMin(_contentMaxHeight, h);
|
||||
int32 he = h - st::rbEmoji.height;
|
||||
int32 hs = h - (s_inner.showSectionIcons() ? st::rbEmoji.height : 0);
|
||||
if (h == _maxHeight && he == _maxHeightEmoji && hs == _maxHeightStickers) return;
|
||||
@ -3170,6 +3181,8 @@ void EmojiPan::hideStart() {
|
||||
}
|
||||
|
||||
void EmojiPan::hideAnimated() {
|
||||
if (_hiding) return;
|
||||
|
||||
if (_cache.isNull()) {
|
||||
QPixmap from = _fromCache, to = _toCache;
|
||||
_fromCache = _toCache = QPixmap();
|
||||
@ -3219,9 +3232,13 @@ void EmojiPan::showStart() {
|
||||
e_inner.refreshRecent();
|
||||
if (s_inner.inlineResultsShown() && refreshInlineRows()) {
|
||||
_stickersShown = true;
|
||||
_shownFromInlineQuery = true;
|
||||
_contentMaxHeight = qMin(s_inner.countHeight(true), int(st::emojiPanMaxHeight));
|
||||
} else {
|
||||
s_inner.refreshRecent();
|
||||
_stickersShown = false;
|
||||
_shownFromInlineQuery = false;
|
||||
_contentMaxHeight = st::emojiPanMaxHeight;
|
||||
}
|
||||
s_inner.preloadImages();
|
||||
setMaxHeight(_maxHeight);
|
||||
@ -3706,6 +3723,14 @@ void EmojiPan::onInlineRequest() {
|
||||
_inlineRequestId = MTP::send(MTPmessages_GetInlineBotResults(_inlineBot->inputUser, MTP_string(_inlineQuery), MTP_string(nextOffset)), rpcDone(&EmojiPan::inlineResultsDone), rpcFail(&EmojiPan::inlineResultsFail));
|
||||
}
|
||||
|
||||
void EmojiPan::onEmptyInlineRows() {
|
||||
if (_shownFromInlineQuery) {
|
||||
hideAnimated();
|
||||
} else {
|
||||
s_inner.hideInlineRowsPanel();
|
||||
}
|
||||
}
|
||||
|
||||
bool EmojiPan::refreshInlineRows() {
|
||||
bool clear = true;
|
||||
InlineCache::const_iterator i = _inlineCache.constFind(_inlineQuery);
|
||||
@ -3726,6 +3751,10 @@ void EmojiPan::showInlineRows(bool newResults) {
|
||||
e_switch.moveToRight(0, 0, st::emojiPanWidth);
|
||||
|
||||
bool hidden = isHidden();
|
||||
if (!hidden && _shownFromInlineQuery && !clear) {
|
||||
_contentMaxHeight = qMax(s_inner.countHeight(true), int(st::emojiPanMaxHeight));
|
||||
setMaxHeight(_maxHeight);
|
||||
}
|
||||
if (clear && !hidden && _stickersShown && s_inner.inlineResultsShown()) {
|
||||
hideAnimated();
|
||||
} else if (!clear) {
|
||||
|
@ -347,6 +347,7 @@ public:
|
||||
void refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted);
|
||||
void refreshRecent();
|
||||
void inlineBotChanged();
|
||||
void hideInlineRowsPanel();
|
||||
|
||||
void fillIcons(QList<StickerIcon> &icons);
|
||||
void fillPanels(QVector<EmojiPanel*> &panels);
|
||||
@ -364,6 +365,7 @@ public:
|
||||
bool inlineResultsShown() const {
|
||||
return _showingInlineItems && !_showingSavedGifs;
|
||||
}
|
||||
int32 countHeight(bool plain = false);
|
||||
|
||||
~StickerPanInner() {
|
||||
clearInlineRows(true);
|
||||
@ -387,6 +389,7 @@ signals:
|
||||
void removing(quint64 setId);
|
||||
|
||||
void refreshIcons();
|
||||
void emptyInlineRows();
|
||||
|
||||
void switchToEmoji();
|
||||
|
||||
@ -406,7 +409,6 @@ private:
|
||||
|
||||
void appendSet(uint64 setId);
|
||||
|
||||
int32 countHeight();
|
||||
void selectEmoji(EmojiPtr emoji);
|
||||
QRect stickerRect(int tab, int sel);
|
||||
|
||||
@ -608,6 +610,7 @@ public slots:
|
||||
void onSaveConfigDelayed(int32 delay);
|
||||
|
||||
void onInlineRequest();
|
||||
void onEmptyInlineRows();
|
||||
|
||||
signals:
|
||||
|
||||
@ -664,7 +667,8 @@ private:
|
||||
anim::ivalue _iconsX, _iconSelX;
|
||||
uint64 _iconsStartAnim;
|
||||
|
||||
bool _stickersShown;
|
||||
bool _stickersShown, _shownFromInlineQuery;
|
||||
int32 _contentMaxHeight;
|
||||
QPixmap _fromCache, _toCache;
|
||||
anim::ivalue a_fromCoord, a_toCoord;
|
||||
anim::fvalue a_fromAlpha, a_toAlpha;
|
||||
|
@ -6554,12 +6554,12 @@ int32 HistoryMessage::resize(int32 width) {
|
||||
if (width < st::msgMinWidth) return _height;
|
||||
|
||||
width -= st::msgMargin.left() + st::msgMargin.right();
|
||||
if (width < st::msgPadding.left() + st::msgPadding.right() + 1) {
|
||||
width = st::msgPadding.left() + st::msgPadding.right() + 1;
|
||||
} else if (width > st::msgMaxWidth) {
|
||||
width = st::msgMaxWidth;
|
||||
}
|
||||
if (drawBubble()) {
|
||||
if (width < st::msgPadding.left() + st::msgPadding.right() + 1) {
|
||||
width = st::msgPadding.left() + st::msgPadding.right() + 1;
|
||||
} else if (width > st::msgMaxWidth) {
|
||||
width = st::msgMaxWidth;
|
||||
}
|
||||
bool media = (_media && _media->isDisplayed());
|
||||
if (width >= _maxw) {
|
||||
_height = _minh;
|
||||
|
Loading…
Reference in New Issue
Block a user