MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / updateButtons

Method updateButtons

Telegram/SourceFiles/boxes/sticker_set_box.cpp:758–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

756}
757
758void StickerSetBox::updateButtons() {
759 clearButtons();
760 if (_inner->reorderState()) {
761 addButton(tr::lng_box_done(), [=] {
762 _inner->setReorderState(false);
763 updateButtons();
764 });
765 } else if (_inner->loaded()) {
766 const auto type = _inner->setType();
767 const auto share = [=] {
768 copyStickersLink();
769 showToast(type == Data::StickersType::Emoji
770 ? tr::lng_stickers_copied_emoji(tr::now)
771 : tr::lng_stickers_copied(tr::now));
772 };
773 const auto fillSetCreatorMenu = [&] {
774 using Filler = Fn<void(not_null<Ui::PopupMenu*>)>;
775 if (!_inner->amSetCreator()) {
776 return Filler(nullptr);
777 }
778 const auto data = &_session->data();
779 return Filler([=, show = _show, set = _set](
780 not_null<Ui::PopupMenu*> menu) {
781 const auto done = [inner = _inner](const TLStickerSet &set) {
782 if (const auto raw = inner.data()) {
783 raw->applySet(set);
784 }
785 };
786 menu->addAction(
787 tr::lng_stickers_context_edit_name(tr::now),
788 [=] {
789 show->showBox(Box(ChangeSetNameBox, data, set, done));
790 },
791 &st::menuIconEdit);
792 menu->addAction(
793 tr::lng_stickers_context_reorder(tr::now),
794 [=] {
795 _inner->setReorderState(true);
796 updateButtons();
797 },
798 &st::menuIconReorder);
799 });
800 }();
801 const auto author = [=] {
802 auto ownerId = _inner->setId() >> 32;
803 if ((_inner->setId() >> 16 & 0xff) == 0x3f) {
804 ownerId |= 0x80000000;
805 }
806 if (_inner->setId() >> 24 & 0xff) {
807 ownerId += 0x100000000;
808 }
809 const auto peer = _session->data().peerLoaded(static_cast<PeerId>(ownerId));
810 if (peer != nullptr) {
811 if (const auto window = _session->tryResolveWindow()) {
812 window->showPeerInfo(peer);
813 }
814 } else {
815 QGuiApplication::clipboard()->setText(QString::number(ownerId));

Callers

nothing calls this directly

Calls 15

FillerClass · 0.85
DeleteStickerSetFunction · 0.85
MakeConfirmRemoveSetBoxFunction · 0.85
CreateUnlockButtonFunction · 0.85
ShowPremiumFunction · 0.85
reorderStateMethod · 0.80
setReorderStateMethod · 0.80
amSetCreatorMethod · 0.80
tryResolveWindowMethod · 0.80
showPeerInfoMethod · 0.80
menuMethod · 0.80
notInstalledMethod · 0.80

Tested by

no test coverage detected