mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Allow removing sets from emoji set preview box.
This commit is contained in:
parent
af54721f07
commit
73fc478a2d
1 changed files with 31 additions and 8 deletions
|
@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lottie/lottie_multi_player.h"
|
#include "lottie/lottie_multi_player.h"
|
||||||
#include "lottie/lottie_animation.h"
|
#include "lottie/lottie_animation.h"
|
||||||
#include "chat_helpers/stickers_lottie.h"
|
#include "chat_helpers/stickers_lottie.h"
|
||||||
|
#include "chat_helpers/stickers_list_widget.h"
|
||||||
#include "media/clip/media_clip_reader.h"
|
#include "media/clip/media_clip_reader.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
|
@ -127,6 +128,7 @@ public:
|
||||||
[[nodiscard]] rpl::producer<TextWithEntities> title() const;
|
[[nodiscard]] rpl::producer<TextWithEntities> title() const;
|
||||||
[[nodiscard]] QString shortName() const;
|
[[nodiscard]] QString shortName() const;
|
||||||
[[nodiscard]] bool isEmojiSet() const;
|
[[nodiscard]] bool isEmojiSet() const;
|
||||||
|
[[nodiscard]] uint64 setId() const;
|
||||||
|
|
||||||
void install();
|
void install();
|
||||||
[[nodiscard]] rpl::producer<uint64> setInstalled() const;
|
[[nodiscard]] rpl::producer<uint64> setInstalled() const;
|
||||||
|
@ -471,24 +473,41 @@ void StickerSetBox::updateButtons() {
|
||||||
addButton(std::move(shareText), std::move(share));
|
addButton(std::move(shareText), std::move(share));
|
||||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||||
|
|
||||||
if (!_inner->shortName().isEmpty()
|
if (!_inner->shortName().isEmpty()) {
|
||||||
&& !_inner->isEmojiSet()) {
|
|
||||||
const auto top = addTopButton(st::infoTopBarMenu);
|
const auto top = addTopButton(st::infoTopBarMenu);
|
||||||
const auto archive = [=] {
|
const auto archive = [=] {
|
||||||
_inner->archiveStickers();
|
_inner->archiveStickers();
|
||||||
};
|
};
|
||||||
|
const auto remove = [=] {
|
||||||
|
const auto session = &_controller->session();
|
||||||
|
auto box = ChatHelpers::MakeConfirmRemoveSetBox(
|
||||||
|
session,
|
||||||
|
_inner->setId());
|
||||||
|
if (box) {
|
||||||
|
_controller->show(
|
||||||
|
std::move(box),
|
||||||
|
Ui::LayerOption::KeepOther);
|
||||||
|
}
|
||||||
|
};
|
||||||
const auto menu =
|
const auto menu =
|
||||||
std::make_shared<base::unique_qptr<Ui::PopupMenu>>();
|
std::make_shared<base::unique_qptr<Ui::PopupMenu>>();
|
||||||
top->setClickedCallback([=] {
|
top->setClickedCallback([=] {
|
||||||
*menu = base::make_unique_q<Ui::PopupMenu>(
|
*menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
top,
|
top,
|
||||||
st::popupMenuWithIcons);
|
st::popupMenuWithIcons);
|
||||||
(*menu)->addAction(
|
if (type == Data::StickersType::Emoji) {
|
||||||
(type == Data::StickersType::Masks)
|
(*menu)->addAction(
|
||||||
? tr::lng_masks_archive_pack(tr::now)
|
tr::lng_custom_emoji_remove_pack_button(tr::now),
|
||||||
: tr::lng_stickers_archive_pack(tr::now),
|
remove,
|
||||||
archive,
|
&st::menuIconRemove);
|
||||||
&st::menuIconArchive);
|
} else {
|
||||||
|
(*menu)->addAction(
|
||||||
|
(type == Data::StickersType::Masks
|
||||||
|
? tr::lng_masks_archive_pack(tr::now)
|
||||||
|
: tr::lng_stickers_archive_pack(tr::now)),
|
||||||
|
archive,
|
||||||
|
&st::menuIconArchive);
|
||||||
|
}
|
||||||
(*menu)->popup(QCursor::pos());
|
(*menu)->popup(QCursor::pos());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -984,6 +1003,10 @@ bool StickerSetBox::Inner::isEmojiSet() const {
|
||||||
return (_setFlags & Data::StickersSetFlag::Emoji);
|
return (_setFlags & Data::StickersSetFlag::Emoji);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64 StickerSetBox::Inner::setId() const {
|
||||||
|
return _setId;
|
||||||
|
}
|
||||||
|
|
||||||
QSize StickerSetBox::Inner::boundingBoxSize() const {
|
QSize StickerSetBox::Inner::boundingBoxSize() const {
|
||||||
if (isEmojiSet()) {
|
if (isEmojiSet()) {
|
||||||
const auto factor = style::DevicePixelRatio();
|
const auto factor = style::DevicePixelRatio();
|
||||||
|
|
Loading…
Add table
Reference in a new issue