mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed text commands from skip blocks.
This commit is contained in:
parent
f9c50fdc06
commit
74f9d0935b
5 changed files with 26 additions and 13 deletions
|
@ -480,10 +480,6 @@ int Element::skipBlockHeight() const {
|
||||||
return st::msgDateFont->height - st::msgDateDelta.y();
|
return st::msgDateFont->height - st::msgDateDelta.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Element::skipBlock() const {
|
|
||||||
return textcmdSkipBlock(skipBlockWidth(), skipBlockHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
int Element::infoWidth() const {
|
int Element::infoWidth() const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,7 +269,6 @@ public:
|
||||||
|
|
||||||
int skipBlockWidth() const;
|
int skipBlockWidth() const;
|
||||||
int skipBlockHeight() const;
|
int skipBlockHeight() const;
|
||||||
QString skipBlock() const;
|
|
||||||
virtual int infoWidth() const;
|
virtual int infoWidth() const;
|
||||||
virtual int bottomInfoFirstLineWidth() const;
|
virtual int bottomInfoFirstLineWidth() const;
|
||||||
virtual bool bottomInfoIsWide() 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/history_view_cursor_state.h"
|
||||||
#include "history/view/media/history_view_media_common.h"
|
#include "history/view/media/history_view_media_common.h"
|
||||||
#include "ui/item_text_options.h"
|
#include "ui/item_text_options.h"
|
||||||
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/cached_round_corners.h"
|
#include "ui/cached_round_corners.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
#include "core/ui_integration.h"
|
#include "core/ui_integration.h"
|
||||||
|
@ -70,12 +71,14 @@ QSize Game::countOptimalSize() {
|
||||||
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
if (_description.isEmpty() && !_data->description.isEmpty()) {
|
||||||
auto text = _data->description;
|
auto text = _data->description;
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
if (!_attach) {
|
|
||||||
text += _parent->skipBlock();
|
|
||||||
}
|
|
||||||
auto marked = TextWithEntities { text };
|
auto marked = TextWithEntities { text };
|
||||||
auto parseFlags = TextParseLinks | TextParseMultiline | TextParseRichText;
|
auto parseFlags = TextParseLinks | TextParseMultiline | TextParseRichText;
|
||||||
TextUtilities::ParseEntities(marked, parseFlags);
|
TextUtilities::ParseEntities(marked, parseFlags);
|
||||||
|
if (!_attach) {
|
||||||
|
_description.updateSkipBlock(
|
||||||
|
_parent->skipBlockWidth(),
|
||||||
|
_parent->skipBlockHeight());
|
||||||
|
}
|
||||||
_description.setMarkedText(
|
_description.setMarkedText(
|
||||||
st::webPageDescriptionStyle,
|
st::webPageDescriptionStyle,
|
||||||
marked,
|
marked,
|
||||||
|
|
|
@ -202,7 +202,9 @@ QSize WebPage::countOptimalSize() {
|
||||||
auto text = _data->description;
|
auto text = _data->description;
|
||||||
|
|
||||||
if (textFloatsAroundInfo) {
|
if (textFloatsAroundInfo) {
|
||||||
text.text += _parent->skipBlock();
|
_description.updateSkipBlock(
|
||||||
|
_parent->skipBlockWidth(),
|
||||||
|
_parent->skipBlockHeight());
|
||||||
}
|
}
|
||||||
if (isLogEntryOriginal()) {
|
if (isLogEntryOriginal()) {
|
||||||
// Fix layout for small bubbles (narrow media caption edit log entries).
|
// Fix layout for small bubbles (narrow media caption edit log entries).
|
||||||
|
@ -232,13 +234,16 @@ QSize WebPage::countOptimalSize() {
|
||||||
Ui::WebpageTextTitleOptions());
|
Ui::WebpageTextTitleOptions());
|
||||||
}
|
}
|
||||||
if (_title.isEmpty() && !title.isEmpty()) {
|
if (_title.isEmpty() && !title.isEmpty()) {
|
||||||
|
auto titleWithEntities = Ui::Text::Link(title, _data->url);
|
||||||
if (textFloatsAroundInfo && _description.isEmpty()) {
|
if (textFloatsAroundInfo && _description.isEmpty()) {
|
||||||
title += _parent->skipBlock();
|
_title.updateSkipBlock(
|
||||||
|
_parent->skipBlockWidth(),
|
||||||
|
_parent->skipBlockHeight());
|
||||||
}
|
}
|
||||||
if (!_siteNameLines && !_data->url.isEmpty()) {
|
if (!_siteNameLines && !_data->url.isEmpty()) {
|
||||||
_title.setMarkedText(
|
_title.setMarkedText(
|
||||||
st::webPageTitleStyle,
|
st::webPageTitleStyle,
|
||||||
Ui::Text::Link(title, _data->url),
|
std::move(titleWithEntities),
|
||||||
Ui::WebpageTextTitleOptions());
|
Ui::WebpageTextTitleOptions());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -284,7 +284,12 @@ int Generator::computeInfoWidth(Status status, QString date) {
|
||||||
void Generator::addTextBubble(QString text, QString date, Status status) {
|
void Generator::addTextBubble(QString text, QString date, Status status) {
|
||||||
Bubble bubble;
|
Bubble bubble;
|
||||||
auto skipBlock = computeSkipBlock(status, date);
|
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();
|
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
||||||
accumulate_min(width, st::msgPadding.left() + bubble.text.maxWidth() + st::msgPadding.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.photoWidth = style::ConvertScale(bubble.photo.width() / 2);
|
||||||
bubble.photoHeight = style::ConvertScale(bubble.photo.height() / 2);
|
bubble.photoHeight = style::ConvertScale(bubble.photo.height() / 2);
|
||||||
auto skipBlock = computeSkipBlock(status, date);
|
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();
|
auto width = _history.width() - st::msgMargin.left() - st::msgMargin.right();
|
||||||
accumulate_min(width, bubble.photoWidth);
|
accumulate_min(width, bubble.photoWidth);
|
||||||
|
|
Loading…
Add table
Reference in a new issue