mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-13 04:37:11 +02:00
Fix paid media price tag background.
This commit is contained in:
parent
aaa72b7c30
commit
bd49887607
4 changed files with 24 additions and 2 deletions
|
@ -343,6 +343,14 @@ rpl::producer<int> SendFilesBox::Block::itemModifyRequest() const {
|
|||
}
|
||||
}
|
||||
|
||||
rpl::producer<> SendFilesBox::Block::orderUpdated() const {
|
||||
if (_isAlbum) {
|
||||
const auto album = static_cast<Ui::AlbumPreview*>(_preview.get());
|
||||
return album->orderUpdated();
|
||||
}
|
||||
return rpl::never<>();
|
||||
}
|
||||
|
||||
void SendFilesBox::Block::setSendWay(Ui::SendFilesWay way) {
|
||||
if (!_isAlbum) {
|
||||
if (_isSingleMedia) {
|
||||
|
@ -1123,6 +1131,13 @@ void SendFilesBox::pushBlock(int from, int till) {
|
|||
st::sendMediaPreviewSize,
|
||||
[=] { refreshAllAfterChanges(from); });
|
||||
}, widget->lifetime());
|
||||
|
||||
block.orderUpdated() | rpl::start_with_next([=]{
|
||||
if (_priceTag) {
|
||||
_priceTagBg = QImage();
|
||||
_priceTag->update();
|
||||
}
|
||||
}, widget->lifetime());
|
||||
}
|
||||
|
||||
void SendFilesBox::refreshControls(bool initial) {
|
||||
|
|
|
@ -161,6 +161,7 @@ private:
|
|||
[[nodiscard]] rpl::producer<int> itemDeleteRequest() const;
|
||||
[[nodiscard]] rpl::producer<int> itemReplaceRequest() const;
|
||||
[[nodiscard]] rpl::producer<int> itemModifyRequest() const;
|
||||
[[nodiscard]] rpl::producer<> orderUpdated() const;
|
||||
|
||||
void setSendWay(Ui::SendFilesWay way);
|
||||
void toggleSpoilers(bool enabled);
|
||||
|
|
|
@ -279,6 +279,7 @@ void AlbumPreview::finishDrag() {
|
|||
_finishDragAnimation.start([=] { update(); }, 0., 1., kDragDuration);
|
||||
|
||||
updateSizeAnimated(layout);
|
||||
_orderUpdated.fire({});
|
||||
} else {
|
||||
for (const auto &thumb : _thumbs) {
|
||||
thumb->resetLayoutAnimation();
|
||||
|
@ -297,7 +298,7 @@ int AlbumPreview::countLayoutHeight(
|
|||
}
|
||||
|
||||
void AlbumPreview::updateSizeAnimated(
|
||||
const std::vector<GroupMediaLayout> &layout) {
|
||||
const std::vector<GroupMediaLayout> &layout) {
|
||||
const auto newHeight = countLayoutHeight(layout);
|
||||
if (newHeight != _thumbsHeight) {
|
||||
_thumbsHeightAnimation.start(
|
||||
|
@ -649,7 +650,7 @@ QImage AlbumPreview::generatePriceTagBackground() const {
|
|||
p.translate(geometry.center());
|
||||
p.scale(wscale, hscale);
|
||||
p.translate(-geometry.center());
|
||||
thumb->paintInAlbum(p, 0, 0, 0., 0.);
|
||||
thumb->paintInAlbum(p, 0, 0, 1., 1.);
|
||||
p.restore();
|
||||
}
|
||||
p.end();
|
||||
|
|
|
@ -51,6 +51,10 @@ public:
|
|||
return _thumbModified.events();
|
||||
}
|
||||
|
||||
[[nodiscard]] rpl::producer<> orderUpdated() const {
|
||||
return _orderUpdated.events();
|
||||
}
|
||||
|
||||
[[nodiscard]] QImage generatePriceTagBackground() const;
|
||||
|
||||
protected:
|
||||
|
@ -120,6 +124,7 @@ private:
|
|||
rpl::event_stream<int> _thumbDeleted;
|
||||
rpl::event_stream<int> _thumbChanged;
|
||||
rpl::event_stream<int> _thumbModified;
|
||||
rpl::event_stream<> _orderUpdated;
|
||||
|
||||
base::unique_qptr<PopupMenu> _menu;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue