mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to provide custom view to sending animation controller.
This commit is contained in:
parent
abbfdf211b
commit
afdfe1c2e8
3 changed files with 17 additions and 11 deletions
|
@ -805,7 +805,7 @@ HistoryWidget::HistoryWidget(
|
||||||
action.replyTo));
|
action.replyTo));
|
||||||
if (action.options.scheduled) {
|
if (action.options.scheduled) {
|
||||||
cancelReply(lastKeyboardUsed);
|
cancelReply(lastKeyboardUsed);
|
||||||
crl::on_main(this, [=, history = action.history]{
|
crl::on_main(this, [=, history = action.history] {
|
||||||
controller->showSection(
|
controller->showSection(
|
||||||
std::make_shared<HistoryView::ScheduledMemento>(history));
|
std::make_shared<HistoryView::ScheduledMemento>(history));
|
||||||
});
|
});
|
||||||
|
@ -5408,7 +5408,7 @@ void HistoryWidget::startMessageSendingAnimation(
|
||||||
|
|
||||||
sendingAnimation.startAnimation({
|
sendingAnimation.startAnimation({
|
||||||
.globalEndGeometry = std::move(globalEndGeometry),
|
.globalEndGeometry = std::move(globalEndGeometry),
|
||||||
.item = item,
|
.view = [=] { return item->mainView(); },
|
||||||
.theme = _list->theme(),
|
.theme = _list->theme(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ private:
|
||||||
void updateCache();
|
void updateCache();
|
||||||
|
|
||||||
const not_null<Window::SessionController*> _controller;
|
const not_null<Window::SessionController*> _controller;
|
||||||
not_null<HistoryItem*> _item;
|
Fn<not_null<HistoryView::Element*>()> _view;
|
||||||
not_null<ChatTheme*> _theme;
|
not_null<ChatTheme*> _theme;
|
||||||
QImage _cache;
|
QImage _cache;
|
||||||
QRect _from;
|
QRect _from;
|
||||||
|
@ -138,9 +138,10 @@ Content::Content(
|
||||||
MessageSendingAnimationController::SendingInfoTo &&to)
|
MessageSendingAnimationController::SendingInfoTo &&to)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _item(to.item)
|
, _view(std::move(to.view))
|
||||||
, _theme(to.theme)
|
, _theme(to.theme)
|
||||||
, _from(parent->mapFromGlobal(globalGeometryFrom)) {
|
, _from(parent->mapFromGlobal(globalGeometryFrom)) {
|
||||||
|
Expects(_view != nullptr);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
@ -162,7 +163,7 @@ Content::Content(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
const auto innerContentRect
|
const auto innerContentRect
|
||||||
= _item->mainView()->media()->contentRectForReactions();
|
= _view()->media()->contentRectForReactions();
|
||||||
auto animationCallback = [=](float64 value) {
|
auto animationCallback = [=](float64 value) {
|
||||||
auto resultFrom = QRect(
|
auto resultFrom = QRect(
|
||||||
QPoint(),
|
QPoint(),
|
||||||
|
@ -183,7 +184,7 @@ Content::Content(
|
||||||
Context::SkipDrawingParts::Content,
|
Context::SkipDrawingParts::Content,
|
||||||
QRect(
|
QRect(
|
||||||
QPoint(),
|
QPoint(),
|
||||||
_item->mainView()->innerGeometry().size())),
|
_view()->innerGeometry().size())),
|
||||||
_minScale);
|
_minScale);
|
||||||
_surrounding->show();
|
_surrounding->show();
|
||||||
_surrounding->raise();
|
_surrounding->raise();
|
||||||
|
@ -236,7 +237,7 @@ rpl::producer<> Content::destroyRequests() const {
|
||||||
void Content::updateCache() {
|
void Content::updateCache() {
|
||||||
_cache = drawMedia(
|
_cache = drawMedia(
|
||||||
Context::SkipDrawingParts::Surrounding,
|
Context::SkipDrawingParts::Surrounding,
|
||||||
_item->mainView()->media()->contentRectForReactions());
|
_view()->media()->contentRectForReactions());
|
||||||
resize(_cache.size() / style::DevicePixelRatio());
|
resize(_cache.size() / style::DevicePixelRatio());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,10 +256,11 @@ QImage Content::drawMedia(
|
||||||
auto context = _controller->preparePaintContext({
|
auto context = _controller->preparePaintContext({
|
||||||
.theme = _theme,
|
.theme = _theme,
|
||||||
});
|
});
|
||||||
|
const auto view = _view();
|
||||||
context.skipDrawingParts = skipParts;
|
context.skipDrawingParts = skipParts;
|
||||||
context.outbg = _item->mainView()->hasOutLayout();
|
context.outbg = view->hasOutLayout();
|
||||||
p.translate(-rect.left(), -rect.top());
|
p.translate(-rect.left(), -rect.top());
|
||||||
_item->mainView()->media()->draw(p, context);
|
view->media()->draw(p, context);
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +287,7 @@ void MessageSendingAnimationController::startAnimation(SendingInfoTo &&to) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto container = _controller->content();
|
const auto container = _controller->content();
|
||||||
const auto item = to.item;
|
const auto item = to.view()->data();
|
||||||
|
|
||||||
const auto it = _itemSendPending.find(item->fullId().msg);
|
const auto it = _itemSendPending.find(item->fullId().msg);
|
||||||
if (it == end(_itemSendPending)) {
|
if (it == end(_itemSendPending)) {
|
||||||
|
|
|
@ -10,6 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/unique_qptr.h"
|
#include "base/unique_qptr.h"
|
||||||
#include "ui/effects/message_sending_animation_common.h"
|
#include "ui/effects/message_sending_animation_common.h"
|
||||||
|
|
||||||
|
namespace HistoryView {
|
||||||
|
class Element;
|
||||||
|
} // namespace HistoryView
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
class SessionController;
|
class SessionController;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
@ -26,7 +30,7 @@ public:
|
||||||
|
|
||||||
struct SendingInfoTo {
|
struct SendingInfoTo {
|
||||||
rpl::producer<QRect> globalEndGeometry;
|
rpl::producer<QRect> globalEndGeometry;
|
||||||
not_null<HistoryItem*> item;
|
Fn<not_null<HistoryView::Element*>()> view;
|
||||||
not_null<Ui::ChatTheme*> theme;
|
not_null<Ui::ChatTheme*> theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue