mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 15:05:56 +00:00
Show expand/collapse icon in factcheck.
This commit is contained in:
@@ -598,6 +598,7 @@ QSize WebPage::countCurrentSize(int newWidth) {
|
|||||||
: FactcheckMetrics();
|
: FactcheckMetrics();
|
||||||
if (factcheck) {
|
if (factcheck) {
|
||||||
factcheck->expandable = factcheckMetrics.expandable;
|
factcheck->expandable = factcheckMetrics.expandable;
|
||||||
|
factcheck->expanded = factcheckMetrics.expanded;
|
||||||
_openl = factcheck->expandable
|
_openl = factcheck->expandable
|
||||||
? ToggleFactcheckClickHandler(_parent)
|
? ToggleFactcheckClickHandler(_parent)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
@@ -779,11 +780,12 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||||||
auto paintw = inner.width();
|
auto paintw = inner.width();
|
||||||
|
|
||||||
const auto sponsored = sponsoredData();
|
const auto sponsored = sponsoredData();
|
||||||
|
const auto factcheck = factcheckData();
|
||||||
|
|
||||||
const auto selected = context.selected();
|
const auto selected = context.selected();
|
||||||
const auto view = parent();
|
const auto view = parent();
|
||||||
const auto from = view->data()->contentColorsFrom();
|
const auto from = view->data()->contentColorsFrom();
|
||||||
const auto colorIndex = factcheckData()
|
const auto colorIndex = factcheck
|
||||||
? 0 // red
|
? 0 // red
|
||||||
: (sponsored && sponsored->colorIndex)
|
: (sponsored && sponsored->colorIndex)
|
||||||
? sponsored->colorIndex
|
? sponsored->colorIndex
|
||||||
@@ -793,8 +795,9 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||||||
const auto cache = context.outbg
|
const auto cache = context.outbg
|
||||||
? stm->replyCache[st->colorPatternIndex(colorIndex)].get()
|
? stm->replyCache[st->colorPatternIndex(colorIndex)].get()
|
||||||
: st->coloredReplyCache(selected, colorIndex).get();
|
: st->coloredReplyCache(selected, colorIndex).get();
|
||||||
const auto backgroundEmojiId = (sponsored
|
const auto backgroundEmojiId = factcheck
|
||||||
&& sponsored->backgroundEmojiId)
|
? DocumentId()
|
||||||
|
: (sponsored && sponsored->backgroundEmojiId)
|
||||||
? sponsored->backgroundEmojiId
|
? sponsored->backgroundEmojiId
|
||||||
: from
|
: from
|
||||||
? from->backgroundEmojiId()
|
? from->backgroundEmojiId()
|
||||||
@@ -821,6 +824,15 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
|
|||||||
if (!backgroundEmojiCache->frames[0].isNull()) {
|
if (!backgroundEmojiCache->frames[0].isNull()) {
|
||||||
FillBackgroundEmoji(p, outer, false, *backgroundEmojiCache);
|
FillBackgroundEmoji(p, outer, false, *backgroundEmojiCache);
|
||||||
}
|
}
|
||||||
|
} else if (factcheck && factcheck->expandable) {
|
||||||
|
const auto &icon = factcheck->expanded
|
||||||
|
? st::factcheckIconCollapse
|
||||||
|
: st::factcheckIconExpand;
|
||||||
|
icon.paint(
|
||||||
|
p,
|
||||||
|
outer.x() + outer.width() - icon.width() - _st.padding.right(),
|
||||||
|
outer.y() + _st.padding.top(),
|
||||||
|
width());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ripple) {
|
if (_ripple) {
|
||||||
@@ -1487,6 +1499,7 @@ WebPage::FactcheckMetrics WebPage::computeFactcheckMetrics(
|
|||||||
return {
|
return {
|
||||||
.lines = allowExpanding ? possible : kFactcheckCollapsedLines,
|
.lines = allowExpanding ? possible : kFactcheckCollapsedLines,
|
||||||
.expandable = expandable,
|
.expandable = expandable,
|
||||||
|
.expanded = expanded,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -104,6 +104,7 @@ private:
|
|||||||
struct FactcheckMetrics {
|
struct FactcheckMetrics {
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
bool expandable = false;
|
bool expandable = false;
|
||||||
|
bool expanded = false;
|
||||||
};
|
};
|
||||||
struct HintData {
|
struct HintData {
|
||||||
QSize size;
|
QSize size;
|
||||||
@@ -129,6 +130,7 @@ private:
|
|||||||
struct FactcheckData {
|
struct FactcheckData {
|
||||||
HintData hint;
|
HintData hint;
|
||||||
bool expandable = false;
|
bool expandable = false;
|
||||||
|
bool expanded = false;
|
||||||
};
|
};
|
||||||
using AdditionalData = std::variant<
|
using AdditionalData = std::variant<
|
||||||
StickerSetData,
|
StickerSetData,
|
||||||
|
@@ -1132,3 +1132,6 @@ effectPreviewPromoPadding: margins(4px, 6px, 4px, 6px);
|
|||||||
effectPreviewLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
|
effectPreviewLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
|
||||||
thickness: 2px;
|
thickness: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
factcheckIconExpand: icon {{ "fast_to_original-rotate_cw", historyPeer1NameFg }};
|
||||||
|
factcheckIconCollapse: icon {{ "fast_to_original-rotate_ccw", historyPeer1NameFg }};
|
||||||
|
Submodule Telegram/codegen updated: 6462cda46e...0af1361240
Reference in New Issue
Block a user