Moved public var indicating stickers presence to private in PhotoData.

This commit is contained in:
23rd 2020-10-30 03:07:59 +03:00
parent 1459e6f38e
commit 391ec8ac28
6 changed files with 20 additions and 9 deletions

View file

@ -376,6 +376,14 @@ void PhotoData::updateImages(
[&](Data::FileOrigin origin) { loadVideo(origin); }); [&](Data::FileOrigin origin) { loadVideo(origin); });
} }
[[nodiscard]] bool PhotoData::hasAttachedStickers() const {
return _hasStickers;
}
void PhotoData::setHasAttachedStickers(bool value) {
_hasStickers = value;
}
int PhotoData::width() const { int PhotoData::width() const {
return _images[PhotoSizeIndex(PhotoSize::Large)].location.width(); return _images[PhotoSizeIndex(PhotoSize::Large)].location.width();
} }

View file

@ -142,13 +142,15 @@ public:
bool forceRemoteLoader) const bool forceRemoteLoader) const
-> std::unique_ptr<Media::Streaming::Loader>; -> std::unique_ptr<Media::Streaming::Loader>;
[[nodiscard]] bool hasAttachedStickers() const;
void setHasAttachedStickers(bool value);
// For now they return size of the 'large' image. // For now they return size of the 'large' image.
int width() const; int width() const;
int height() const; int height() const;
PhotoId id = 0; PhotoId id = 0;
TimeId date = 0; TimeId date = 0;
bool hasSticker = false;
PeerData *peer = nullptr; // for chat and channel photos connection PeerData *peer = nullptr; // for chat and channel photos connection
// geo, caption // geo, caption
@ -164,6 +166,7 @@ private:
int32 _dc = 0; int32 _dc = 0;
uint64 _access = 0; uint64 _access = 0;
bool _hasStickers = false;
QByteArray _fileReference; QByteArray _fileReference;
std::unique_ptr<Data::ReplyPreview> _replyPreview; std::unique_ptr<Data::ReplyPreview> _replyPreview;
std::weak_ptr<Data::PhotoMedia> _media; std::weak_ptr<Data::PhotoMedia> _media;

View file

@ -2291,7 +2291,7 @@ not_null<PhotoData*> Session::photo(
const QByteArray &fileReference, const QByteArray &fileReference,
TimeId date, TimeId date,
int32 dc, int32 dc,
bool hasSticker, bool hasStickers,
const QByteArray &inlineThumbnailBytes, const QByteArray &inlineThumbnailBytes,
const ImageWithLocation &small, const ImageWithLocation &small,
const ImageWithLocation &thumbnail, const ImageWithLocation &thumbnail,
@ -2305,7 +2305,7 @@ not_null<PhotoData*> Session::photo(
fileReference, fileReference,
date, date,
dc, dc,
hasSticker, hasStickers,
inlineThumbnailBytes, inlineThumbnailBytes,
small, small,
thumbnail, thumbnail,
@ -2466,7 +2466,7 @@ void Session::photoApplyFields(
const QByteArray &fileReference, const QByteArray &fileReference,
TimeId date, TimeId date,
int32 dc, int32 dc,
bool hasSticker, bool hasStickers,
const QByteArray &inlineThumbnailBytes, const QByteArray &inlineThumbnailBytes,
const ImageWithLocation &small, const ImageWithLocation &small,
const ImageWithLocation &thumbnail, const ImageWithLocation &thumbnail,
@ -2478,7 +2478,7 @@ void Session::photoApplyFields(
} }
photo->setRemoteLocation(dc, access, fileReference); photo->setRemoteLocation(dc, access, fileReference);
photo->date = date; photo->date = date;
photo->hasSticker = hasSticker; photo->setHasAttachedStickers(hasStickers);
photo->updateImages( photo->updateImages(
inlineThumbnailBytes, inlineThumbnailBytes,
small, small,

View file

@ -414,7 +414,7 @@ public:
const QByteArray &fileReference, const QByteArray &fileReference,
TimeId date, TimeId date,
int32 dc, int32 dc,
bool hasSticker, bool hasStickers,
const QByteArray &inlineThumbnailBytes, const QByteArray &inlineThumbnailBytes,
const ImageWithLocation &small, const ImageWithLocation &small,
const ImageWithLocation &thumbnail, const ImageWithLocation &thumbnail,
@ -685,7 +685,7 @@ private:
const QByteArray &fileReference, const QByteArray &fileReference,
TimeId date, TimeId date,
int32 dc, int32 dc,
bool hasSticker, bool hasStickers,
const QByteArray &inlineThumbnailBytes, const QByteArray &inlineThumbnailBytes,
const ImageWithLocation &small, const ImageWithLocation &small,
const ImageWithLocation &thumbnail, const ImageWithLocation &thumbnail,

View file

@ -1589,7 +1589,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(tr::lng_context_copy_image(tr::now), [=] { _menu->addAction(tr::lng_context_copy_image(tr::now), [=] {
copyContextImage(photo); copyContextImage(photo);
}); });
if (photo->hasSticker) { if (photo->hasAttachedStickers()) {
_menu->addAction(tr::lng_context_attached_stickers(tr::now), [=] { _menu->addAction(tr::lng_context_attached_stickers(tr::now), [=] {
session->api().attachedStickers().requestAttachedStickerSets( session->api().attachedStickers().requestAttachedStickerSets(
controller, controller,

View file

@ -773,7 +773,7 @@ void OverlayWidget::updateActions() {
if ((_document && documentContentShown()) || (_photo && _photoMedia->loaded())) { if ((_document && documentContentShown()) || (_photo && _photoMedia->loaded())) {
_actions.push_back({ tr::lng_mediaview_copy(tr::now), SLOT(onCopy()) }); _actions.push_back({ tr::lng_mediaview_copy(tr::now), SLOT(onCopy()) });
} }
if (_photo && _photo->hasSticker) { if (_photo && _photo->hasAttachedStickers()) {
_actions.push_back({ tr::lng_context_attached_stickers(tr::now), SLOT(onAttachedStickers()) }); _actions.push_back({ tr::lng_context_attached_stickers(tr::now), SLOT(onAttachedStickers()) });
} }
if (_canForwardItem) { if (_canForwardItem) {