This commit is contained in:
John Preston 2015-04-13 10:59:32 +01:00
commit 47b0f901c8
2 changed files with 16 additions and 6 deletions

View File

@ -3257,17 +3257,19 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
} }
} }
if (!data->description.isEmpty()) { if (!data->description.isEmpty()) {
QString text = textClean(data->description);
if (!_asArticle) text += textcmdSkipBlock(parent->timeWidth(), st::msgDateFont->height - st::msgDateDelta.y());
const TextParseOptions *opts = &_webpageDescriptionOptions;
if (data->siteName == QLatin1String("Twitter")) { if (data->siteName == QLatin1String("Twitter")) {
_description.setText(st::webPageDescriptionFont, textClean(data->description), _twitterDescriptionOptions); opts = &_twitterDescriptionOptions;
} else if (data->siteName == QLatin1String("Instagram")) { } else if (data->siteName == QLatin1String("Instagram")) {
_description.setText(st::webPageDescriptionFont, textClean(data->description), _instagramDescriptionOptions); opts = &_instagramDescriptionOptions;
} else {
_description.setText(st::webPageDescriptionFont, textClean(data->description), _webpageDescriptionOptions);
} }
_description.setText(st::webPageDescriptionFont, text, *opts);
if (_asArticle) { if (_asArticle) {
_maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth() + st::webPagePhotoDelta + st::webPagePhotoSize)); _maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth() + st::webPagePhotoDelta + st::webPagePhotoSize));
} else { } else {
_maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth() + parent->timeWidth())); _maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth()));
_minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height); _minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height);
} }
} }
@ -4443,7 +4445,7 @@ HistoryMedia *HistoryMessage::getMedia(bool inOverview) const {
} }
void HistoryMessage::setMedia(const MTPmessageMedia &media) { void HistoryMessage::setMedia(const MTPmessageMedia &media) {
if (!_media && media.type() == mtpc_messageMediaEmpty) return; if ((!_media || _media->isImageLink()) && media.type() == mtpc_messageMediaEmpty) return;
if (_media) { if (_media) {
delete _media; delete _media;
_media = 0; _media = 0;

View File

@ -802,6 +802,10 @@ public:
virtual void updateFrom(const MTPMessageMedia &media) { virtual void updateFrom(const MTPMessageMedia &media) {
} }
virtual bool isImageLink() const {
return false;
}
virtual bool updateStickerEmoji() { virtual bool updateStickerEmoji() {
return false; return false;
} }
@ -1167,6 +1171,10 @@ public:
void getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const; void getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, const HistoryItem *parent, int32 width = -1) const;
HistoryMedia *clone() const; HistoryMedia *clone() const;
bool isImageLink() const {
return true;
}
private: private:
ImageLinkData *data; ImageLinkData *data;
TextLinkPtr link; TextLinkPtr link;