mirror of https://github.com/procxx/kepka.git
Displaying of games finished.
This commit is contained in:
parent
538ffb9727
commit
5529e24000
|
@ -808,6 +808,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
"lng_duration_played" = "{played} / {duration}";
|
"lng_duration_played" = "{played} / {duration}";
|
||||||
"lng_date_and_duration" = "{date}, {duration}";
|
"lng_date_and_duration" = "{date}, {duration}";
|
||||||
"lng_choose_images" = "Choose images";
|
"lng_choose_images" = "Choose images";
|
||||||
|
"lng_game_tag" = "Game";
|
||||||
|
|
||||||
"lng_context_view_profile" = "View profile";
|
"lng_context_view_profile" = "View profile";
|
||||||
"lng_context_view_group" = "View group info";
|
"lng_context_view_group" = "View group info";
|
||||||
|
|
|
@ -1791,15 +1791,15 @@ namespace {
|
||||||
}
|
}
|
||||||
if ((convert->url.isEmpty() && !url.isEmpty()) || (convert->pendingTill && convert->pendingTill != pendingTill && pendingTill >= -1)) {
|
if ((convert->url.isEmpty() && !url.isEmpty()) || (convert->pendingTill && convert->pendingTill != pendingTill && pendingTill >= -1)) {
|
||||||
convert->type = toWebPageType(type);
|
convert->type = toWebPageType(type);
|
||||||
convert->url = url;
|
convert->url = textClean(url);
|
||||||
convert->displayUrl = displayUrl;
|
convert->displayUrl = textClean(displayUrl);
|
||||||
convert->siteName = siteName;
|
convert->siteName = textClean(siteName);
|
||||||
convert->title = title;
|
convert->title = textOneLine(textClean(title));
|
||||||
convert->description = description;
|
convert->description = textClean(description);
|
||||||
convert->photo = photo;
|
convert->photo = photo;
|
||||||
convert->document = document;
|
convert->document = document;
|
||||||
convert->duration = duration;
|
convert->duration = duration;
|
||||||
convert->author = author;
|
convert->author = textClean(author);
|
||||||
if (convert->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(convert);
|
if (convert->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(convert);
|
||||||
convert->pendingTill = pendingTill;
|
convert->pendingTill = pendingTill;
|
||||||
if (App::main()) App::main()->webPageUpdated(convert);
|
if (App::main()) App::main()->webPageUpdated(convert);
|
||||||
|
@ -1822,15 +1822,15 @@ namespace {
|
||||||
if (result != convert) {
|
if (result != convert) {
|
||||||
if ((result->url.isEmpty() && !url.isEmpty()) || (result->pendingTill && result->pendingTill != pendingTill && pendingTill >= -1)) {
|
if ((result->url.isEmpty() && !url.isEmpty()) || (result->pendingTill && result->pendingTill != pendingTill && pendingTill >= -1)) {
|
||||||
result->type = toWebPageType(type);
|
result->type = toWebPageType(type);
|
||||||
result->url = url;
|
result->url = textClean(url);
|
||||||
result->displayUrl = displayUrl;
|
result->displayUrl = textClean(displayUrl);
|
||||||
result->siteName = siteName;
|
result->siteName = textClean(siteName);
|
||||||
result->title = title;
|
result->title = textOneLine(textClean(title));
|
||||||
result->description = description;
|
result->description = textClean(description);
|
||||||
result->photo = photo;
|
result->photo = photo;
|
||||||
result->document = document;
|
result->document = document;
|
||||||
result->duration = duration;
|
result->duration = duration;
|
||||||
result->author = author;
|
result->author = textClean(author);
|
||||||
if (result->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(result);
|
if (result->pendingTill > 0 && pendingTill <= 0 && api()) api()->clearWebPageRequest(result);
|
||||||
result->pendingTill = pendingTill;
|
result->pendingTill = pendingTill;
|
||||||
if (App::main()) App::main()->webPageUpdated(result);
|
if (App::main()) App::main()->webPageUpdated(result);
|
||||||
|
@ -1859,9 +1859,9 @@ namespace {
|
||||||
}
|
}
|
||||||
if (convert->shortName.isEmpty() && !shortName.isEmpty()) {
|
if (convert->shortName.isEmpty() && !shortName.isEmpty()) {
|
||||||
convert->accessHash = accessHash;
|
convert->accessHash = accessHash;
|
||||||
convert->shortName = shortName;
|
convert->shortName = textClean(shortName);
|
||||||
convert->title = title;
|
convert->title = textOneLine(textClean(title));
|
||||||
convert->description = description;
|
convert->description = textClean(description);
|
||||||
convert->photo = photo;
|
convert->photo = photo;
|
||||||
convert->document = document;
|
convert->document = document;
|
||||||
if (App::main()) App::main()->gameUpdated(convert);
|
if (App::main()) App::main()->gameUpdated(convert);
|
||||||
|
@ -1881,9 +1881,9 @@ namespace {
|
||||||
if (result != convert) {
|
if (result != convert) {
|
||||||
if (result->shortName.isEmpty() && !shortName.isEmpty()) {
|
if (result->shortName.isEmpty() && !shortName.isEmpty()) {
|
||||||
result->accessHash = accessHash;
|
result->accessHash = accessHash;
|
||||||
result->shortName = shortName;
|
result->shortName = textClean(shortName);
|
||||||
result->title = title;
|
result->title = textOneLine(textClean(title));
|
||||||
result->description = description;
|
result->description = textClean(description);
|
||||||
result->photo = photo;
|
result->photo = photo;
|
||||||
result->document = document;
|
result->document = document;
|
||||||
if (App::main()) App::main()->gameUpdated(result);
|
if (App::main()) App::main()->gameUpdated(result);
|
||||||
|
|
|
@ -79,6 +79,9 @@ public:
|
||||||
virtual TextSelection adjustSelection(TextSelection selection, TextSelectType type) const {
|
virtual TextSelection adjustSelection(TextSelection selection, TextSelectType type) const {
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
virtual bool consumeMessageText(const TextWithEntities &textWithEntities) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// if we press and drag this link should we drag the item
|
// if we press and drag this link should we drag the item
|
||||||
virtual bool dragItemByHandler(const ClickHandlerPtr &p) const = 0;
|
virtual bool dragItemByHandler(const ClickHandlerPtr &p) const = 0;
|
||||||
|
|
|
@ -2481,36 +2481,24 @@ void HistoryWebPage::initDimensions() {
|
||||||
|
|
||||||
// init strings
|
// init strings
|
||||||
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
||||||
QString text = textClean(_data->description);
|
auto text = _data->description;
|
||||||
if (text.isEmpty()) {
|
|
||||||
_data->description = QString();
|
if (!_asArticle && !_attach) {
|
||||||
} else {
|
text += _parent->skipBlock();
|
||||||
if (!_asArticle && !_attach) {
|
|
||||||
text += _parent->skipBlock();
|
|
||||||
}
|
|
||||||
const TextParseOptions *opts = &_webpageDescriptionOptions;
|
|
||||||
if (_data->siteName == qstr("Twitter")) {
|
|
||||||
opts = &_twitterDescriptionOptions;
|
|
||||||
} else if (_data->siteName == qstr("Instagram")) {
|
|
||||||
opts = &_instagramDescriptionOptions;
|
|
||||||
}
|
|
||||||
_description.setText(st::webPageDescriptionFont, text, *opts);
|
|
||||||
}
|
}
|
||||||
|
const TextParseOptions *opts = &_webpageDescriptionOptions;
|
||||||
|
if (_data->siteName == qstr("Twitter")) {
|
||||||
|
opts = &_twitterDescriptionOptions;
|
||||||
|
} else if (_data->siteName == qstr("Instagram")) {
|
||||||
|
opts = &_instagramDescriptionOptions;
|
||||||
|
}
|
||||||
|
_description.setText(st::webPageDescriptionFont, text, *opts);
|
||||||
}
|
}
|
||||||
if (_title.isEmpty() && !title.isEmpty()) {
|
if (_title.isEmpty() && !title.isEmpty()) {
|
||||||
title = textOneLine(textClean(title));
|
if (!_asArticle && !_attach && _description.isEmpty()) {
|
||||||
if (title.isEmpty()) {
|
title += _parent->skipBlock();
|
||||||
if (_data->title.isEmpty()) {
|
|
||||||
_data->author = QString();
|
|
||||||
} else {
|
|
||||||
_data->title = QString();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!_asArticle && !_attach && _description.isEmpty()) {
|
|
||||||
title += _parent->skipBlock();
|
|
||||||
}
|
|
||||||
_title.setText(st::webPageTitleFont, title, _webpageTitleOptions);
|
|
||||||
}
|
}
|
||||||
|
_title.setText(st::webPageTitleFont, title, _webpageTitleOptions);
|
||||||
}
|
}
|
||||||
if (!_siteNameWidth && !_data->siteName.isEmpty()) {
|
if (!_siteNameWidth && !_data->siteName.isEmpty()) {
|
||||||
_siteNameWidth = st::webPageTitleFont->width(_data->siteName);
|
_siteNameWidth = st::webPageTitleFont->width(_data->siteName);
|
||||||
|
@ -2964,20 +2952,13 @@ void HistoryGame::initDimensions() {
|
||||||
|
|
||||||
// init strings
|
// init strings
|
||||||
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
||||||
auto text = textClean(_data->description);
|
auto text = _data->description;
|
||||||
if (text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
_data->description = QString();
|
|
||||||
} else {
|
|
||||||
_description.setText(st::webPageDescriptionFont, text, _webpageDescriptionOptions);
|
_description.setText(st::webPageDescriptionFont, text, _webpageDescriptionOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_title.isEmpty() && !title.isEmpty()) {
|
if (_title.isEmpty() && !title.isEmpty()) {
|
||||||
title = textOneLine(textClean(title));
|
_title.setText(st::webPageTitleFont, title, _webpageTitleOptions);
|
||||||
if (title.isEmpty()) {
|
|
||||||
_data->title = QString();
|
|
||||||
} else {
|
|
||||||
_title.setText(st::webPageTitleFont, title, _webpageTitleOptions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// init dimensions
|
// init dimensions
|
||||||
|
@ -3014,13 +2995,18 @@ void HistoryGame::initDimensions() {
|
||||||
_maxw += st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
_maxw += st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
||||||
auto padding = inBubblePadding();
|
auto padding = inBubblePadding();
|
||||||
_minh += padding.top() + padding.bottom();
|
_minh += padding.top() + padding.bottom();
|
||||||
|
|
||||||
|
if (!_gameTagWidth) {
|
||||||
|
_gameTagWidth = st::msgDateFont->width(lang(lng_game_tag).toUpper());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int HistoryGame::resizeGetHeight(int width) {
|
int HistoryGame::resizeGetHeight(int width) {
|
||||||
_width = qMin(width, _maxw);
|
_width = qMin(width, _maxw);
|
||||||
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
||||||
|
|
||||||
int linesMax = 5;
|
// enable any count of lines in game description / message
|
||||||
|
int linesMax = 4096;
|
||||||
_height = 0;
|
_height = 0;
|
||||||
if (_title.isEmpty()) {
|
if (_title.isEmpty()) {
|
||||||
_titleLines = 0;
|
_titleLines = 0;
|
||||||
|
@ -3116,6 +3102,19 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, uint
|
||||||
|
|
||||||
p.translate(attachLeft, attachTop);
|
p.translate(attachLeft, attachTop);
|
||||||
_attach->draw(p, r.translated(-attachLeft, -attachTop), attachSelection, ms);
|
_attach->draw(p, r.translated(-attachLeft, -attachTop), attachSelection, ms);
|
||||||
|
auto pixwidth = _attach->currentWidth();
|
||||||
|
|
||||||
|
auto gameX = st::msgDateImgDelta;
|
||||||
|
auto gameY = st::msgDateImgDelta;
|
||||||
|
auto gameW = _gameTagWidth + 2 * st::msgDateImgPadding.x();
|
||||||
|
auto gameH = st::msgDateFont->height + 2 * st::msgDateImgPadding.y();
|
||||||
|
|
||||||
|
App::roundRect(p, rtlrect(gameX, gameY, gameW, gameH, pixwidth), selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners);
|
||||||
|
|
||||||
|
p.setFont(st::msgDateFont);
|
||||||
|
p.setPen(st::msgDateImgColor);
|
||||||
|
p.drawTextLeft(gameX + st::msgDateImgPadding.x(), gameY + st::msgDateImgPadding.y(), pixwidth, lang(lng_game_tag).toUpper());
|
||||||
|
|
||||||
p.translate(-attachLeft, -attachTop);
|
p.translate(-attachLeft, -attachTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3188,6 +3187,11 @@ TextSelection HistoryGame::adjustSelection(TextSelection selection, TextSelectTy
|
||||||
return { titleSelection.from, fromDescriptionSelection(descriptionSelection).to };
|
return { titleSelection.from, fromDescriptionSelection(descriptionSelection).to };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HistoryGame::consumeMessageText(const TextWithEntities &textWithEntities) {
|
||||||
|
_description.setMarkedText(st::webPageDescriptionFont, textWithEntities, itemTextOptions(_parent));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryGame::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) {
|
void HistoryGame::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) {
|
||||||
if (_attach) {
|
if (_attach) {
|
||||||
_attach->clickHandlerActiveChanged(p, active);
|
_attach->clickHandlerActiveChanged(p, active);
|
||||||
|
@ -3210,6 +3214,14 @@ void HistoryGame::detachFromParent() {
|
||||||
if (_attach) _attach->detachFromParent();
|
if (_attach) _attach->detachFromParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString HistoryGame::notificationText() const {
|
||||||
|
return _data->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString HistoryGame::inDialogsText() const {
|
||||||
|
return textcmdLink(1, _data->title);
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities HistoryGame::selectedText(TextSelection selection) const {
|
TextWithEntities HistoryGame::selectedText(TextSelection selection) const {
|
||||||
if (selection == FullSelection) {
|
if (selection == FullSelection) {
|
||||||
return TextWithEntities();
|
return TextWithEntities();
|
||||||
|
|
|
@ -752,6 +752,7 @@ public:
|
||||||
bool hasTextForCopy() const override {
|
bool hasTextForCopy() const override {
|
||||||
return false; // we do not add _title and _description in FullSelection text copy.
|
return false; // we do not add _title and _description in FullSelection text copy.
|
||||||
}
|
}
|
||||||
|
bool consumeMessageText(const TextWithEntities &textWithEntities) override;
|
||||||
|
|
||||||
bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override {
|
bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override {
|
||||||
return _attach && _attach->toggleSelectionByHandlerClick(p);
|
return _attach && _attach->toggleSelectionByHandlerClick(p);
|
||||||
|
@ -760,6 +761,8 @@ public:
|
||||||
return _attach && _attach->dragItemByHandler(p);
|
return _attach && _attach->dragItemByHandler(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString notificationText() const override;
|
||||||
|
QString inDialogsText() const override;
|
||||||
TextWithEntities selectedText(TextSelection selection) const override;
|
TextWithEntities selectedText(TextSelection selection) const override;
|
||||||
|
|
||||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
||||||
|
@ -819,6 +822,8 @@ private:
|
||||||
|
|
||||||
Text _title, _description;
|
Text _title, _description;
|
||||||
|
|
||||||
|
int _gameTagWidth = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LocationCoords;
|
struct LocationCoords;
|
||||||
|
|
|
@ -347,8 +347,8 @@ int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::But
|
||||||
int result = 2 * buttonPadding(), iconWidth = 0;
|
int result = 2 * buttonPadding(), iconWidth = 0;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Button::Type::Url: iconWidth = st::msgBotKbUrlIcon.pxWidth(); break;
|
case Button::Type::Url: iconWidth = st::msgBotKbUrlIcon.pxWidth(); break;
|
||||||
//case Button::Type::RequestPhone: iconWidth = st::msgBotKbRequestPhoneIcon.pxWidth(); break;
|
//case Button::Type::RequestPhone: iconWidth = st::msgBotKbRequestPhoneIcon.pxWidth(); break;
|
||||||
//case Button::Type::RequestLocation: iconWidth = st::msgBotKbRequestLocationIcon.pxWidth(); break;
|
//case Button::Type::RequestLocation: iconWidth = st::msgBotKbRequestLocationIcon.pxWidth(); break;
|
||||||
case Button::Type::SwitchInlineSame:
|
case Button::Type::SwitchInlineSame:
|
||||||
case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break;
|
case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break;
|
||||||
case Button::Type::Callback:
|
case Button::Type::Callback:
|
||||||
|
@ -380,13 +380,12 @@ HistoryMessage::HistoryMessage(History *history, const MTPDmessage &msg)
|
||||||
|
|
||||||
createComponents(config);
|
createComponents(config);
|
||||||
|
|
||||||
QString text(textClean(qs(msg.vmessage)));
|
initMedia(msg.has_media() ? (&msg.vmedia) : nullptr);
|
||||||
initMedia(msg.has_media() ? (&msg.vmedia) : nullptr, text);
|
|
||||||
|
|
||||||
TextWithEntities textWithEntities = { text, EntitiesInText() };
|
TextWithEntities textWithEntities = {
|
||||||
if (msg.has_entities()) {
|
textClean(qs(msg.vmessage)),
|
||||||
textWithEntities.entities = entitiesFromMTP(msg.ventities.c_vector().v);
|
msg.has_entities() ? entitiesFromMTP(msg.ventities.c_vector().v) : EntitiesInText(),
|
||||||
}
|
};
|
||||||
setText(textWithEntities);
|
setText(textWithEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +619,7 @@ void HistoryMessage::initTime() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMessage::initMedia(const MTPMessageMedia *media, QString ¤tText) {
|
void HistoryMessage::initMedia(const MTPMessageMedia *media) {
|
||||||
switch (media ? media->type() : mtpc_messageMediaEmpty) {
|
switch (media ? media->type() : mtpc_messageMediaEmpty) {
|
||||||
case mtpc_messageMediaContact: {
|
case mtpc_messageMediaContact: {
|
||||||
auto &d = media->c_messageMediaContact();
|
auto &d = media->c_messageMediaContact();
|
||||||
|
@ -961,16 +960,16 @@ void HistoryMessage::setMedia(const MTPMessageMedia *media) {
|
||||||
|
|
||||||
bool mediaRemovedSkipBlock = false;
|
bool mediaRemovedSkipBlock = false;
|
||||||
if (_media) {
|
if (_media) {
|
||||||
mediaRemovedSkipBlock = _media->isDisplayed() && !_media->isAboveMessage();
|
mediaRemovedSkipBlock = _media->isDisplayed() && _media->isBubbleBottom();
|
||||||
_media.clear();
|
_media.clear();
|
||||||
}
|
}
|
||||||
QString t;
|
initMedia(media);
|
||||||
initMedia(media, t);
|
auto mediaDisplayed = _media && _media->isDisplayed();
|
||||||
if (_media && _media->isDisplayed() && !_media->isAboveMessage() && !mediaRemovedSkipBlock) {
|
if (mediaDisplayed && _media->isBubbleBottom() && !mediaRemovedSkipBlock) {
|
||||||
_text.removeSkipBlock();
|
_text.removeSkipBlock();
|
||||||
_textWidth = -1;
|
_textWidth = -1;
|
||||||
_textHeight = 0;
|
_textHeight = 0;
|
||||||
} else if (mediaRemovedSkipBlock && (!_media || !_media->isDisplayed() || _media->isAboveMessage())) {
|
} else if (mediaRemovedSkipBlock && (!mediaDisplayed || !_media->isBubbleBottom())) {
|
||||||
_text.setSkipBlock(skipBlockWidth(), skipBlockHeight());
|
_text.setSkipBlock(skipBlockWidth(), skipBlockHeight());
|
||||||
_textWidth = -1;
|
_textWidth = -1;
|
||||||
_textHeight = 0;
|
_textHeight = 0;
|
||||||
|
@ -978,14 +977,6 @@ void HistoryMessage::setMedia(const MTPMessageMedia *media) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
|
void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
|
||||||
textstyleSet(&((out() && !isPost()) ? st::outTextStyle : st::inTextStyle));
|
|
||||||
if (_media && _media->isDisplayed() && !_media->isAboveMessage()) {
|
|
||||||
_text.setMarkedText(st::msgFont, textWithEntities, itemTextOptions(this));
|
|
||||||
} else {
|
|
||||||
_text.setMarkedText(st::msgFont, { textWithEntities.text + skipBlock(), textWithEntities.entities }, itemTextOptions(this));
|
|
||||||
}
|
|
||||||
textstyleRestore();
|
|
||||||
|
|
||||||
for_const (auto &entity, textWithEntities.entities) {
|
for_const (auto &entity, textWithEntities.entities) {
|
||||||
auto type = entity.type();
|
auto type = entity.type();
|
||||||
if (type == EntityInTextUrl || type == EntityInTextCustomUrl || type == EntityInTextEmail) {
|
if (type == EntityInTextUrl || type == EntityInTextCustomUrl || type == EntityInTextEmail) {
|
||||||
|
@ -993,8 +984,21 @@ void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_textWidth = -1;
|
|
||||||
_textHeight = 0;
|
auto mediaDisplayed = _media && _media->isDisplayed();
|
||||||
|
if (mediaDisplayed && _media->consumeMessageText(textWithEntities)) {
|
||||||
|
setEmptyText();
|
||||||
|
} else {
|
||||||
|
textstyleSet(&((out() && !isPost()) ? st::outTextStyle : st::inTextStyle));
|
||||||
|
if (_media && _media->isDisplayed() && !_media->isAboveMessage()) {
|
||||||
|
_text.setMarkedText(st::msgFont, textWithEntities, itemTextOptions(this));
|
||||||
|
} else {
|
||||||
|
_text.setMarkedText(st::msgFont, { textWithEntities.text + skipBlock(), textWithEntities.entities }, itemTextOptions(this));
|
||||||
|
}
|
||||||
|
textstyleRestore();
|
||||||
|
_textWidth = -1;
|
||||||
|
_textHeight = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMessage::setEmptyText() {
|
void HistoryMessage::setEmptyText() {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTime();
|
void initTime();
|
||||||
void initMedia(const MTPMessageMedia *media, QString ¤tText);
|
void initMedia(const MTPMessageMedia *media);
|
||||||
void initMediaFromDocument(DocumentData *doc, const QString &caption);
|
void initMediaFromDocument(DocumentData *doc, const QString &caption);
|
||||||
void fromNameUpdated(int32 width) const;
|
void fromNameUpdated(int32 width) const;
|
||||||
|
|
||||||
|
|
|
@ -4507,6 +4507,7 @@ void HistoryWidget::updateControlsVisibility() {
|
||||||
if (!_a_show.animating()) {
|
if (!_a_show.animating()) {
|
||||||
_topShadow.setVisible(_peer ? true : false);
|
_topShadow.setVisible(_peer ? true : false);
|
||||||
}
|
}
|
||||||
|
updateToEndVisibility();
|
||||||
if (!_history || _a_show.animating()) {
|
if (!_history || _a_show.animating()) {
|
||||||
_reportSpamPanel.hide();
|
_reportSpamPanel.hide();
|
||||||
_scroll.hide();
|
_scroll.hide();
|
||||||
|
@ -4537,7 +4538,6 @@ void HistoryWidget::updateControlsVisibility() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateToEndVisibility();
|
|
||||||
if (_pinnedBar) {
|
if (_pinnedBar) {
|
||||||
_pinnedBar->cancel.show();
|
_pinnedBar->cancel.show();
|
||||||
_pinnedBar->shadow.show();
|
_pinnedBar->shadow.show();
|
||||||
|
@ -7380,6 +7380,8 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateToEndVisibility() {
|
void HistoryWidget::updateToEndVisibility() {
|
||||||
|
if (_a_show.animating()) return;
|
||||||
|
|
||||||
auto haveUnreadBelowBottom = [this](History *history) {
|
auto haveUnreadBelowBottom = [this](History *history) {
|
||||||
if (!_list || !history || history->unreadCount() <= 0) {
|
if (!_list || !history || history->unreadCount() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -7390,7 +7392,7 @@ void HistoryWidget::updateToEndVisibility() {
|
||||||
return (_list->itemTop(history->showFrom) >= _scroll.scrollTop() + _scroll.height());
|
return (_list->itemTop(history->showFrom) >= _scroll.scrollTop() + _scroll.height());
|
||||||
};
|
};
|
||||||
auto isToEndVisible = [this, &haveUnreadBelowBottom]() {
|
auto isToEndVisible = [this, &haveUnreadBelowBottom]() {
|
||||||
if (!_history || _a_show.animating() || _firstLoadRequest) {
|
if (!_history || _firstLoadRequest) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!_history->loadedAtBottom() || _replyReturn) {
|
if (!_history->loadedAtBottom() || _replyReturn) {
|
||||||
|
|
Loading…
Reference in New Issue