mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
fixed item resize on entities receive
This commit is contained in:
parent
f6740f6c9e
commit
7bc27ba0bf
8 changed files with 73 additions and 74 deletions
|
@ -722,7 +722,7 @@ namespace App {
|
|||
bool hasLinks = m.has_entities() && !m.ventities.c_vector().v.isEmpty();
|
||||
if ((hasLinks && !existing->hasTextLinks()) || (!hasLinks && existing->textHasLinks())) {
|
||||
existing->setText(qs(m.vmessage), m.has_entities() ? linksFromMTP(m.ventities.c_vector().v) : LinksInText());
|
||||
existing->initDimensions(0);
|
||||
existing->initDimensions();
|
||||
if (App::main()) App::main()->itemResized(existing);
|
||||
if (existing->hasTextLinks()) {
|
||||
existing->history()->addToOverview(existing, OverviewLinks);
|
||||
|
|
|
@ -1293,7 +1293,7 @@ bool CreateGroupBox::failed(const RPCError &error) {
|
|||
return true;
|
||||
} else if (error.type() == "PEER_FLOOD") {
|
||||
emit closed();
|
||||
App::wnd()->showLayer(new ConfirmBox(lng_cant_invite_not_contact(lt_more_info, QString()), true));
|
||||
App::wnd()->showLayer(new ConfirmBox(lng_cant_invite_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq#can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info)))), true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1490,8 +1490,9 @@ MsgId History::maxMsgId() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32 History::geomResize(int32 newWidth, int32 *ytransform, bool dontRecountText) {
|
||||
if (width != newWidth || dontRecountText) {
|
||||
int32 History::geomResize(int32 newWidth, int32 *ytransform, HistoryItem *resizedItem) {
|
||||
if (width != newWidth) resizedItem = 0; // recount all items
|
||||
if (width != newWidth || resizedItem) {
|
||||
int32 y = 0;
|
||||
for (iterator i = begin(), e = end(); i != e; ++i) {
|
||||
HistoryBlock *block = *i;
|
||||
|
@ -1500,7 +1501,7 @@ int32 History::geomResize(int32 newWidth, int32 *ytransform, bool dontRecountTex
|
|||
if (block->y != y) {
|
||||
block->y = y;
|
||||
}
|
||||
y += block->geomResize(newWidth, ytransform, dontRecountText);
|
||||
y += block->geomResize(newWidth, ytransform, resizedItem);
|
||||
if (updTransform) {
|
||||
*ytransform += block->y;
|
||||
ytransform = 0;
|
||||
|
@ -1589,14 +1590,18 @@ void History::removeBlock(HistoryBlock *block) {
|
|||
delete block;
|
||||
}
|
||||
|
||||
int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, bool dontRecountText) {
|
||||
int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, HistoryItem *resizedItem) {
|
||||
int32 y = 0;
|
||||
for (iterator i = begin(), e = end(); i != e; ++i) {
|
||||
HistoryItem *item = *i;
|
||||
bool updTransform = ytransform && (*ytransform >= item->y) && (*ytransform < item->y + item->height());
|
||||
if (updTransform) *ytransform -= item->y;
|
||||
item->y = y;
|
||||
y += item->resize(newWidth, dontRecountText);
|
||||
if (!resizedItem || resizedItem == item) {
|
||||
y += item->resize(newWidth);
|
||||
} else {
|
||||
y += item->height();
|
||||
}
|
||||
if (updTransform) {
|
||||
*ytransform += item->y;
|
||||
ytransform = 0;
|
||||
|
@ -1895,7 +1900,7 @@ void HistoryPhoto::initDimensions(const HistoryItem *parent) {
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistoryPhoto::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryPhoto::resize(int32 width, const HistoryItem *parent) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
|
||||
|
@ -2615,7 +2620,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistoryVideo::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryVideo::resize(int32 width, const HistoryItem *parent) {
|
||||
w = qMin(width, _maxw);
|
||||
if (_caption.isEmpty()) return _height;
|
||||
|
||||
|
@ -3349,7 +3354,7 @@ void HistoryDocument::updateFrom(const MTPMessageMedia &media) {
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistoryDocument::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryDocument::resize(int32 width, const HistoryItem *parent) {
|
||||
w = qMin(width, _maxw);
|
||||
if (parent == animated.msg) {
|
||||
if (w > st::maxMediaSize) {
|
||||
|
@ -3591,7 +3596,7 @@ void HistorySticker::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistorySticker::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistorySticker::resize(int32 width, const HistoryItem *parent) {
|
||||
w = qMin(width, _maxw);
|
||||
lastw = width;
|
||||
return _height;
|
||||
|
@ -4288,7 +4293,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
|||
p.restore();
|
||||
}
|
||||
|
||||
int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryWebPage::resize(int32 width, const HistoryItem *parent) {
|
||||
if (data->pendingTill) {
|
||||
w = width;
|
||||
_height = _minh;
|
||||
|
@ -5087,7 +5092,7 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistoryImageLink::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryImageLink::resize(int32 width, const HistoryItem *parent) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = toHistoryForwarded(parent);
|
||||
|
||||
|
@ -5373,7 +5378,7 @@ void HistoryMessage::initMediaFromDocument(DocumentData *doc) {
|
|||
_media->regItem(this);
|
||||
}
|
||||
|
||||
void HistoryMessage::initDimensions(const HistoryItem *parent) {
|
||||
void HistoryMessage::initDimensions() {
|
||||
if (justMedia()) {
|
||||
_media->initDimensions(this);
|
||||
_maxw = _media->maxWidth();
|
||||
|
@ -5456,7 +5461,7 @@ void HistoryMessage::setMedia(const MTPMessageMedia *media) {
|
|||
_textWidth = 0;
|
||||
_textHeight = 0;
|
||||
}
|
||||
initDimensions(0);
|
||||
initDimensions();
|
||||
if (App::main()) App::main()->itemResized(this);
|
||||
}
|
||||
|
||||
|
@ -5593,15 +5598,13 @@ void HistoryMessage::drawMessageText(QPainter &p, const QRect &trect, uint32 sel
|
|||
textstyleRestore();
|
||||
}
|
||||
|
||||
int32 HistoryMessage::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryMessage::resize(int32 width) {
|
||||
if (width < st::msgMinWidth) return _height;
|
||||
|
||||
width -= st::msgMargin.left() + st::msgMargin.right();
|
||||
if (justMedia()) {
|
||||
_height = _media->resize(width, dontRecountText, this);
|
||||
_height = _media->resize(width, this);
|
||||
} else {
|
||||
if (dontRecountText && !_media) return _height;
|
||||
|
||||
if (width < st::msgPadding.left() + st::msgPadding.right() + 1) {
|
||||
width = st::msgPadding.left() + st::msgPadding.right() + 1;
|
||||
} else if (width > st::msgMaxWidth) {
|
||||
|
@ -5614,10 +5617,10 @@ int32 HistoryMessage::resize(int32 width, bool dontRecountText, const HistoryIte
|
|||
}
|
||||
if (width >= _maxw) {
|
||||
_height = _minh;
|
||||
if (_media) _media->resize(_maxw - st::msgPadding.left() - st::msgPadding.right(), dontRecountText, this);
|
||||
if (_media) _media->resize(_maxw - st::msgPadding.left() - st::msgPadding.right(), this);
|
||||
} else {
|
||||
_height = _textHeight;
|
||||
if (_media && _media->isDisplayed()) _height += st::msgPadding.bottom() + _media->resize(nwidth, dontRecountText, this);
|
||||
if (_media && _media->isDisplayed()) _height += st::msgPadding.bottom() + _media->resize(nwidth, this);
|
||||
}
|
||||
if (!out() && _history->peer->chat) {
|
||||
_height += st::msgNameFont->height;
|
||||
|
@ -5827,8 +5830,8 @@ QString HistoryForwarded::selectedText(uint32 selection) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void HistoryForwarded::initDimensions(const HistoryItem *parent) {
|
||||
HistoryMessage::initDimensions(parent);
|
||||
void HistoryForwarded::initDimensions() {
|
||||
HistoryMessage::initDimensions();
|
||||
fwdNameUpdated();
|
||||
}
|
||||
|
||||
|
@ -5871,11 +5874,10 @@ void HistoryForwarded::drawMessageText(QPainter &p, const QRect &trect, uint32 s
|
|||
HistoryMessage::drawMessageText(p, realtrect, selection);
|
||||
}
|
||||
|
||||
int32 HistoryForwarded::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
HistoryMessage::resize(width, dontRecountText, parent);
|
||||
if (!justMedia() && (_media || !dontRecountText)) {
|
||||
int32 HistoryForwarded::resize(int32 width) {
|
||||
HistoryMessage::resize(width);
|
||||
|
||||
_height += st::msgServiceNameFont->height;
|
||||
}
|
||||
return _height;
|
||||
}
|
||||
|
||||
|
@ -6027,11 +6029,11 @@ QString HistoryReply::selectedText(uint32 selection) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void HistoryReply::initDimensions(const HistoryItem *parent) {
|
||||
void HistoryReply::initDimensions() {
|
||||
if (!replyToMsg) {
|
||||
_maxReplyWidth = st::msgReplyBarSkip + st::msgDateFont->m.width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message)) + st::msgPadding.left() + st::msgPadding.right();
|
||||
}
|
||||
HistoryMessage::initDimensions(parent);
|
||||
HistoryMessage::initDimensions();
|
||||
if (replyToMsg) {
|
||||
replyToNameUpdated();
|
||||
} else if (!justMedia()) {
|
||||
|
@ -6174,11 +6176,10 @@ void HistoryReply::drawMessageText(QPainter &p, const QRect &trect, uint32 selec
|
|||
HistoryMessage::drawMessageText(p, realtrect, selection);
|
||||
}
|
||||
|
||||
int32 HistoryReply::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
HistoryMessage::resize(width, dontRecountText, parent);
|
||||
if (!justMedia() && (_media || !dontRecountText)) {
|
||||
int32 HistoryReply::resize(int32 width) {
|
||||
HistoryMessage::resize(width);
|
||||
|
||||
_height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
}
|
||||
return _height;
|
||||
}
|
||||
|
||||
|
@ -6405,10 +6406,10 @@ HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, MsgI
|
|||
{
|
||||
}
|
||||
|
||||
void HistoryServiceMsg::initDimensions(const HistoryItem *parent) {
|
||||
void HistoryServiceMsg::initDimensions() {
|
||||
_maxw = _text.maxWidth() + st::msgServicePadding.left() + st::msgServicePadding.right();
|
||||
_minh = _text.minHeight();
|
||||
if (_media) _media->initDimensions();
|
||||
if (_media) _media->initDimensions(this);
|
||||
}
|
||||
|
||||
QString HistoryServiceMsg::selectedText(uint32 selection) const {
|
||||
|
@ -6471,9 +6472,7 @@ void HistoryServiceMsg::draw(QPainter &p, uint32 selection) const {
|
|||
textstyleRestore();
|
||||
}
|
||||
|
||||
int32 HistoryServiceMsg::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
if (dontRecountText) return _height;
|
||||
|
||||
int32 HistoryServiceMsg::resize(int32 width) {
|
||||
width -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins
|
||||
if (width < st::msgServicePadding.left() + st::msgServicePadding.right() + 1) width = st::msgServicePadding.left() + st::msgServicePadding.right() + 1;
|
||||
|
||||
|
@ -6489,7 +6488,7 @@ int32 HistoryServiceMsg::resize(int32 width, bool dontRecountText, const History
|
|||
}
|
||||
_height += st::msgServicePadding.top() + st::msgServicePadding.bottom() + st::msgServiceMargin.top() + st::msgServiceMargin.bottom();
|
||||
if (_media) {
|
||||
_height += st::msgServiceMargin.top() + _media->resize(_media->currentWidth());
|
||||
_height += st::msgServiceMargin.top() + _media->resize(_media->currentWidth(), this);
|
||||
}
|
||||
return _height;
|
||||
}
|
||||
|
@ -6575,7 +6574,7 @@ HistoryUnreadBar::HistoryUnreadBar(History *history, HistoryBlock *block, int32
|
|||
initDimensions();
|
||||
}
|
||||
|
||||
void HistoryUnreadBar::initDimensions(const HistoryItem *parent) {
|
||||
void HistoryUnreadBar::initDimensions() {
|
||||
_maxw = st::msgPadding.left() + st::msgPadding.right() + 1;
|
||||
_minh = st::unreadBarHeight;
|
||||
}
|
||||
|
@ -6594,7 +6593,7 @@ void HistoryUnreadBar::draw(QPainter &p, uint32 selection) const {
|
|||
p.drawText(QRect(0, 0, _history->width, st::unreadBarHeight - st::lineWidth), text, style::al_center);
|
||||
}
|
||||
|
||||
int32 HistoryUnreadBar::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
int32 HistoryUnreadBar::resize(int32 width) {
|
||||
_height = st::unreadBarHeight;
|
||||
return _height;
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ struct History : public QList<HistoryBlock*> {
|
|||
MsgId minMsgId() const;
|
||||
MsgId maxMsgId() const;
|
||||
|
||||
int32 geomResize(int32 newWidth, int32 *ytransform = 0, bool dontRecountText = false); // return new size
|
||||
int32 geomResize(int32 newWidth, int32 *ytransform = 0, HistoryItem *resizedItem = 0); // return new size
|
||||
int32 width, height, msgCount, unreadCount;
|
||||
int32 inboxReadTill, outboxReadTill;
|
||||
HistoryItem *showFrom;
|
||||
|
@ -614,7 +614,7 @@ struct HistoryBlock : public QVector<HistoryItem*> {
|
|||
}
|
||||
void removeItem(HistoryItem *item);
|
||||
|
||||
int32 geomResize(int32 newWidth, int32 *ytransform, bool dontRecountText); // return new size
|
||||
int32 geomResize(int32 newWidth, int32 *ytransform, HistoryItem *resizedItem); // return new size
|
||||
int32 y, height;
|
||||
History *history;
|
||||
};
|
||||
|
@ -625,9 +625,6 @@ public:
|
|||
HistoryElem() : _height(0), _maxw(0) {
|
||||
}
|
||||
|
||||
virtual void initDimensions(const HistoryItem *parent = 0) = 0;
|
||||
virtual int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0) = 0; // return new height
|
||||
|
||||
int32 height() const {
|
||||
return _height;
|
||||
}
|
||||
|
@ -683,7 +680,10 @@ public:
|
|||
UnreadBarType
|
||||
};
|
||||
|
||||
virtual void initDimensions() = 0;
|
||||
virtual int32 resize(int32 width) = 0; // return new height
|
||||
virtual void draw(QPainter &p, uint32 selection) const = 0;
|
||||
|
||||
History *history() {
|
||||
return _history;
|
||||
}
|
||||
|
@ -869,7 +869,8 @@ public:
|
|||
virtual int32 countHeight(const HistoryItem *parent, int32 width = -1) const {
|
||||
return height();
|
||||
}
|
||||
virtual int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0) {
|
||||
virtual void initDimensions(const HistoryItem *parent) = 0;
|
||||
virtual int32 resize(int32 width, const HistoryItem *parent) { // return new height
|
||||
w = qMin(width, _maxw);
|
||||
return _height;
|
||||
}
|
||||
|
@ -924,7 +925,7 @@ public:
|
|||
void initDimensions(const HistoryItem *parent);
|
||||
|
||||
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width, const HistoryItem *parent);
|
||||
HistoryMediaType type() const {
|
||||
return MediaTypePhoto;
|
||||
}
|
||||
|
@ -974,7 +975,7 @@ public:
|
|||
void initDimensions(const HistoryItem *parent);
|
||||
|
||||
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width, const HistoryItem *parent);
|
||||
HistoryMediaType type() const {
|
||||
return MediaTypeVideo;
|
||||
}
|
||||
|
@ -1054,7 +1055,7 @@ public:
|
|||
void initDimensions(const HistoryItem *parent);
|
||||
|
||||
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width, const HistoryItem *parent);
|
||||
HistoryMediaType type() const {
|
||||
return MediaTypeDocument;
|
||||
}
|
||||
|
@ -1105,7 +1106,7 @@ public:
|
|||
void initDimensions(const HistoryItem *parent);
|
||||
|
||||
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width, const HistoryItem *parent);
|
||||
HistoryMediaType type() const {
|
||||
return MediaTypeSticker;
|
||||
}
|
||||
|
@ -1170,7 +1171,7 @@ public:
|
|||
bool isDisplayed() const {
|
||||
return !data->pendingTill;
|
||||
}
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width, const HistoryItem *parent);
|
||||
HistoryMediaType type() const {
|
||||
return MediaTypeWebPage;
|
||||
}
|
||||
|
@ -1269,7 +1270,7 @@ public:
|
|||
void initDimensions(const HistoryItem *parent);
|
||||
|
||||
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width, const HistoryItem *parent);
|
||||
HistoryMediaType type() const {
|
||||
return MediaTypeImageLink;
|
||||
}
|
||||
|
@ -1302,7 +1303,7 @@ public:
|
|||
void initMedia(const MTPMessageMedia *media, QString ¤tText);
|
||||
void initMediaFromText(QString ¤tText);
|
||||
void initMediaFromDocument(DocumentData *doc);
|
||||
void initDimensions(const HistoryItem *parent = 0);
|
||||
void initDimensions();
|
||||
void fromNameUpdated() const;
|
||||
|
||||
bool justMedia() const {
|
||||
|
@ -1314,7 +1315,7 @@ public:
|
|||
void draw(QPainter &p, uint32 selection) const;
|
||||
virtual void drawMessageText(QPainter &p, const QRect &trect, uint32 selection) const;
|
||||
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width);
|
||||
bool hasPoint(int32 x, int32 y) const;
|
||||
|
||||
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
|
||||
|
@ -1388,13 +1389,13 @@ public:
|
|||
HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessage &msg);
|
||||
HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg);
|
||||
|
||||
void initDimensions(const HistoryItem *parent = 0);
|
||||
void initDimensions();
|
||||
void fwdNameUpdated() const;
|
||||
|
||||
void draw(QPainter &p, uint32 selection) const;
|
||||
void drawForwardedFrom(QPainter &p, int32 x, int32 y, int32 w, bool selected) const;
|
||||
void drawMessageText(QPainter &p, const QRect &trect, uint32 selection) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width);
|
||||
bool hasPoint(int32 x, int32 y) const;
|
||||
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
|
||||
void getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const;
|
||||
|
@ -1432,7 +1433,7 @@ public:
|
|||
HistoryReply(History *history, HistoryBlock *block, const MTPDmessage &msg);
|
||||
HistoryReply(History *history, HistoryBlock *block, MsgId msgId, int32 flags, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc);
|
||||
|
||||
void initDimensions(const HistoryItem *parent = 0);
|
||||
void initDimensions();
|
||||
|
||||
bool updateReplyTo(bool force = false);
|
||||
void replyToNameUpdated() const;
|
||||
|
@ -1447,7 +1448,7 @@ public:
|
|||
void draw(QPainter &p, uint32 selection) const;
|
||||
void drawReplyTo(QPainter &p, int32 x, int32 y, int32 w, bool selected, bool likeService = false) const;
|
||||
void drawMessageText(QPainter &p, const QRect &trect, uint32 selection) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width);
|
||||
bool hasPoint(int32 x, int32 y) const;
|
||||
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
|
||||
void getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const;
|
||||
|
@ -1485,10 +1486,10 @@ public:
|
|||
HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg);
|
||||
HistoryServiceMsg(History *history, HistoryBlock *block, MsgId msgId, QDateTime date, const QString &msg, int32 flags = 0, HistoryMedia *media = 0, int32 from = 0);
|
||||
|
||||
void initDimensions(const HistoryItem *parent = 0);
|
||||
void initDimensions();
|
||||
|
||||
void draw(QPainter &p, uint32 selection) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width);
|
||||
bool hasPoint(int32 x, int32 y) const;
|
||||
void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const;
|
||||
void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const;
|
||||
|
@ -1555,12 +1556,12 @@ public:
|
|||
|
||||
HistoryUnreadBar(History *history, HistoryBlock *block, int32 count, const QDateTime &date);
|
||||
|
||||
void initDimensions(const HistoryItem *parent = 0);
|
||||
void initDimensions();
|
||||
|
||||
void setCount(int32 count);
|
||||
|
||||
void draw(QPainter &p, uint32 selection) const;
|
||||
int32 resize(int32 width, bool dontRecountText = false, const HistoryItem *parent = 0);
|
||||
int32 resize(int32 width);
|
||||
|
||||
void drawInDialog(QPainter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const;
|
||||
QString notificationText() const;
|
||||
|
|
|
@ -1063,7 +1063,7 @@ void HistoryList::keyPressEvent(QKeyEvent *e) {
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistoryList::recountHeight(bool dontRecountText) {
|
||||
int32 HistoryList::recountHeight(HistoryItem *resizedItem) {
|
||||
int32 st = hist->lastScrollTop;
|
||||
|
||||
int32 ph = scrollArea->height(), minadd = 0;
|
||||
|
@ -1073,7 +1073,7 @@ int32 HistoryList::recountHeight(bool dontRecountText) {
|
|||
}
|
||||
if (wasYSkip < minadd) wasYSkip = minadd;
|
||||
|
||||
hist->geomResize(scrollArea->width(), &st, dontRecountText);
|
||||
hist->geomResize(scrollArea->width(), &st, resizedItem);
|
||||
updateBotInfo(false);
|
||||
if (botInfo && !botInfo->text.isEmpty()) {
|
||||
int32 tw = scrollArea->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
|
@ -4799,7 +4799,7 @@ MsgId HistoryWidget::replyToId() const {
|
|||
void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, HistoryItem *resizedItem, bool scrollToIt) {
|
||||
if (!_history || (initial && _histInited) || (!initial && !_histInited)) return;
|
||||
if (_firstLoadRequest) {
|
||||
if (resizedItem) _list->recountHeight(true);
|
||||
if (resizedItem) _list->recountHeight(resizedItem);
|
||||
return; // scrollTopMax etc are not working after recountHeight()
|
||||
}
|
||||
|
||||
|
@ -4829,7 +4829,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
|||
if (!initial) {
|
||||
_history->lastScrollTop = _scroll.scrollTop();
|
||||
}
|
||||
int32 newSt = _list->recountHeight(!!resizedItem);
|
||||
int32 newSt = _list->recountHeight(resizedItem);
|
||||
bool washidden = _scroll.isHidden();
|
||||
if (washidden) {
|
||||
_scroll.show();
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
void touchScrollUpdated(const QPoint &screenPos);
|
||||
QPoint mapMouseToItem(QPoint p, HistoryItem *item);
|
||||
|
||||
int32 recountHeight(bool dontRecountText);
|
||||
int32 recountHeight(HistoryItem *resizedItem);
|
||||
void updateSize();
|
||||
|
||||
void updateMsg(const HistoryItem *msg);
|
||||
|
|
|
@ -823,7 +823,7 @@ bool MainWidget::addParticipantFail(UserData *user, const RPCError &error) {
|
|||
} else if (error.type() == "USER_ALREADY_PARTICIPANT" && user->botInfo) {
|
||||
text = lang(lng_bot_already_in_group);
|
||||
} else if (error.type() == "PEER_FLOOD") {
|
||||
text = lng_cant_invite_not_contact(lt_more_info, QString());
|
||||
text = lng_cant_invite_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq#can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info)));
|
||||
}
|
||||
App::wnd()->showLayer(new ConfirmBox(text, true));
|
||||
return false;
|
||||
|
@ -900,7 +900,7 @@ bool MainWidget::sendMessageFail(const RPCError &error) {
|
|||
if (mtpIsFlood(error)) return false;
|
||||
|
||||
if (error.type() == qsl("PEER_FLOOD")) {
|
||||
App::wnd()->showLayer(new ConfirmBox(lng_cant_send_to_not_contact(lt_more_info, QString()), true));
|
||||
App::wnd()->showLayer(new ConfirmBox(lng_cant_send_to_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq#can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info))), true));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -3443,7 +3443,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates, uint64 randomId) {
|
|||
if (item && ((hasLinks && !item->hasTextLinks()) || (!hasLinks && item->textHasLinks()))) {
|
||||
bool was = item->hasTextLinks();
|
||||
item->setText(text, d.has_entities() ? linksFromMTP(d.ventities.c_vector().v) : LinksInText());
|
||||
item->initDimensions(0);
|
||||
item->initDimensions();
|
||||
itemResized(item);
|
||||
if (!was && item->hasTextLinks()) {
|
||||
item->history()->addToOverview(item, OverviewLinks);
|
||||
|
|
|
@ -126,7 +126,6 @@ register.saveDeveloperInfo#9a5f6e95 name:string email:string phone_number:string
|
|||
|
||||
---types---
|
||||
|
||||
|
||||
error#c4b9f9bb code:int text:string = Error;
|
||||
|
||||
null#56730bcc = Null;
|
||||
|
|
Loading…
Add table
Reference in a new issue