mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Removed text commands from skip blocks.
This commit is contained in:
@@ -480,10 +480,6 @@ int Element::skipBlockHeight() const {
|
||||
return st::msgDateFont->height - st::msgDateDelta.y();
|
||||
}
|
||||
|
||||
QString Element::skipBlock() const {
|
||||
return textcmdSkipBlock(skipBlockWidth(), skipBlockHeight());
|
||||
}
|
||||
|
||||
int Element::infoWidth() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,6 @@ public:
|
||||
|
||||
int skipBlockWidth() const;
|
||||
int skipBlockHeight() const;
|
||||
QString skipBlock() const;
|
||||
virtual int infoWidth() const;
|
||||
virtual int bottomInfoFirstLineWidth() const;
|
||||
virtual bool bottomInfoIsWide() const;
|
||||
|
||||
@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/view/history_view_cursor_state.h"
|
||||
#include "history/view/media/history_view_media_common.h"
|
||||
#include "ui/item_text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/cached_round_corners.h"
|
||||
#include "ui/chat/chat_style.h"
|
||||
#include "core/ui_integration.h"
|
||||
@@ -70,12 +71,14 @@ QSize Game::countOptimalSize() {
|
||||
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
||||
auto text = _data->description;
|
||||
if (!text.isEmpty()) {
|
||||
if (!_attach) {
|
||||
text += _parent->skipBlock();
|
||||
}
|
||||
auto marked = TextWithEntities { text };
|
||||
auto parseFlags = TextParseLinks | TextParseMultiline | TextParseRichText;
|
||||
TextUtilities::ParseEntities(marked, parseFlags);
|
||||
if (!_attach) {
|
||||
_description.updateSkipBlock(
|
||||
_parent->skipBlockWidth(),
|
||||
_parent->skipBlockHeight());
|
||||
}
|
||||
_description.setMarkedText(
|
||||
st::webPageDescriptionStyle,
|
||||
marked,
|
||||
|
||||
@@ -202,7 +202,9 @@ QSize WebPage::countOptimalSize() {
|
||||
auto text = _data->description;
|
||||
|
||||
if (textFloatsAroundInfo) {
|
||||
text.text += _parent->skipBlock();
|
||||
_description.updateSkipBlock(
|
||||
_parent->skipBlockWidth(),
|
||||
_parent->skipBlockHeight());
|
||||
}
|
||||
if (isLogEntryOriginal()) {
|
||||
// Fix layout for small bubbles (narrow media caption edit log entries).
|
||||
@@ -232,13 +234,16 @@ QSize WebPage::countOptimalSize() {
|
||||
Ui::WebpageTextTitleOptions());
|
||||
}
|
||||
if (_title.isEmpty() && !title.isEmpty()) {
|
||||
auto titleWithEntities = Ui::Text::Link(title, _data->url);
|
||||
if (textFloatsAroundInfo && _description.isEmpty()) {
|
||||
title += _parent->skipBlock();
|
||||
_title.updateSkipBlock(
|
||||
_parent->skipBlockWidth(),
|
||||
_parent->skipBlockHeight());
|
||||
}
|
||||
if (!_siteNameLines && !_data->url.isEmpty()) {
|
||||
_title.setMarkedText(
|
||||
st::webPageTitleStyle,
|
||||
Ui::Text::Link(title, _data->url),
|
||||
std::move(titleWithEntities),
|
||||
Ui::WebpageTextTitleOptions());
|
||||
|
||||
} else {
|
||||
|
||||
@@ -284,7 +284,12 @@ int Generator::computeInfoWidth(Status status, QString date) {
|
||||
void Generator::addTextBubble(QString text, QString date, Status status) {
|
||||
Bubble bubble;
|
||||
auto skipBlock = computeSkipBlock(status, date);
|
||||
bubble.text.setRichText(st::messageTextStyle, text + textcmdSkipBlock(skipBlock.width(), skipBlock.height()), Ui::ItemTextDefaultOptions());
|
||||
auto marked = TextWithEntities{ std::move(text) };
|
||||
bubble.text.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
std::move(marked),
|
||||
Ui::ItemTextDefaultOptions());
|
||||
bubble.text.updateSkipBlock(skipBlock.width(), skipBlock.height());
|
||||
|
||||
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
accumulate_min(width, st::msgPadding.left() + bubble.text.maxWidth() + st::msgPadding.right());
|
||||
@@ -308,7 +313,12 @@ void Generator::addPhotoBubble(QString image, QString caption, QString date, Sta
|
||||
bubble.photoWidth = style::ConvertScale(bubble.photo.width() / 2);
|
||||
bubble.photoHeight = style::ConvertScale(bubble.photo.height() / 2);
|
||||
auto skipBlock = computeSkipBlock(status, date);
|
||||
bubble.text.setRichText(st::messageTextStyle, caption + textcmdSkipBlock(skipBlock.width(), skipBlock.height()), Ui::ItemTextDefaultOptions());
|
||||
auto marked = TextWithEntities{ std::move(caption) };
|
||||
bubble.text.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
std::move(marked),
|
||||
Ui::ItemTextDefaultOptions());
|
||||
bubble.text.updateSkipBlock(skipBlock.width(), skipBlock.height());
|
||||
|
||||
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
accumulate_min(width, bubble.photoWidth);
|
||||
|
||||
Reference in New Issue
Block a user