mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Replaced repaint of loading transcribe button with repaint only in rect.
This commit is contained in:
@@ -519,7 +519,7 @@ QSize Message::performCountOptimalSize() {
|
||||
if (_summarize) {
|
||||
const auto &summary = item->summaryEntry();
|
||||
if (_summarize->loading() != summary.loading) {
|
||||
_summarize->setLoading(summary.loading, [this] { repaint(); });
|
||||
_summarize->setLoading(summary.loading);
|
||||
}
|
||||
}
|
||||
validateText();
|
||||
|
||||
@@ -71,14 +71,23 @@ QSize TranscribeButton::size() const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
void TranscribeButton::setLoading(bool loading, Fn<void()> update) {
|
||||
void TranscribeButton::setLoading(bool loading) {
|
||||
if (_loading == loading) {
|
||||
return;
|
||||
}
|
||||
_loading = loading;
|
||||
if (_loading) {
|
||||
const auto session = &_item->history()->session();
|
||||
_animation = std::make_unique<Ui::InfiniteRadialAnimation>(
|
||||
update,
|
||||
[=, itemId = _item->fullId()] {
|
||||
if (const auto item = session->data().message(itemId)) {
|
||||
session->data().requestItemRepaint(
|
||||
item,
|
||||
_lastPaintedPoint.isNull()
|
||||
? QRect()
|
||||
: QRect(_lastPaintedPoint, size()));
|
||||
}
|
||||
},
|
||||
st::historyTranscribeRadialAnimation);
|
||||
_animation->start();
|
||||
} else if (_animation) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
[[nodiscard]] QSize size() const;
|
||||
|
||||
void setOpened(bool opened, Fn<void()> update);
|
||||
void setLoading(bool loading, Fn<void()> update);
|
||||
void setLoading(bool loading);
|
||||
[[nodiscard]] bool loading() const;
|
||||
void paint(QPainter &p, int x, int y, const PaintContext &context);
|
||||
void addRipple(Fn<void()> callback);
|
||||
|
||||
@@ -440,8 +440,7 @@ QSize Document::countOptimalSize() {
|
||||
const auto &entry = transcribes->entry(_realParent);
|
||||
const auto update = [=] { repaint(); };
|
||||
voice->transcribe->setLoading(
|
||||
entry.shown && (entry.requestId || entry.pending),
|
||||
update);
|
||||
entry.shown && (entry.requestId || entry.pending));
|
||||
const auto pending = entry.pending;
|
||||
auto descriptor = pending
|
||||
? Lottie::IconDescriptor{
|
||||
|
||||
@@ -268,8 +268,7 @@ QSize Gif::countOptimalSize() {
|
||||
const auto &entry = _data->session().api().transcribes().entry(
|
||||
_realParent);
|
||||
_transcribe->setLoading(
|
||||
entry.shown && (entry.requestId || entry.pending),
|
||||
[=] { repaint(); });
|
||||
entry.shown && (entry.requestId || entry.pending));
|
||||
}
|
||||
|
||||
const auto minWidth = std::clamp(
|
||||
|
||||
Reference in New Issue
Block a user