mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added toast to topic icon in profile top bar.
This commit is contained in:
@@ -1592,6 +1592,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
"lng_profile_administrators#one" = "{count} administrator";
|
"lng_profile_administrators#one" = "{count} administrator";
|
||||||
"lng_profile_administrators#other" = "{count} administrators";
|
"lng_profile_administrators#other" = "{count} administrators";
|
||||||
"lng_profile_manage" = "Channel settings";
|
"lng_profile_manage" = "Channel settings";
|
||||||
|
"lng_profile_topic_toast" = "This topic contains {name}";
|
||||||
|
|
||||||
"lng_invite_upgrade_title" = "Upgrade to Premium";
|
"lng_invite_upgrade_title" = "Upgrade to Premium";
|
||||||
"lng_invite_upgrade_group_invite#one" = "{users} only accepts invitations to groups from Contacts and **Premium** users.";
|
"lng_invite_upgrade_group_invite#one" = "{users} only accepts invitations to groups from Contacts and **Premium** users.";
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
|
#include "ui/text/text_utilities.h"
|
||||||
|
#include "ui/toast/toast.h"
|
||||||
|
#include "boxes/sticker_set_box.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_chat_helpers.h"
|
#include "styles/style_chat_helpers.h"
|
||||||
#include "styles/style_chat.h"
|
#include "styles/style_chat.h"
|
||||||
@@ -1230,7 +1233,39 @@ void TopBar::setupUserpicButton(
|
|||||||
|
|
||||||
(*menu)->popup(QCursor::pos());
|
(*menu)->popup(QCursor::pos());
|
||||||
} else if (button == Qt::LeftButton) {
|
} else if (button == Qt::LeftButton) {
|
||||||
if (_hasStories) {
|
if (_topicIconView && _topic && _topic->iconId()) {
|
||||||
|
const auto document = _peer->owner().document(
|
||||||
|
_topic->iconId());
|
||||||
|
if (const auto sticker = document->sticker()) {
|
||||||
|
const auto packName
|
||||||
|
= _peer->owner().customEmojiManager().lookupSetName(
|
||||||
|
sticker->set.id);
|
||||||
|
if (!packName.isEmpty()) {
|
||||||
|
const auto text = tr::lng_profile_topic_toast(
|
||||||
|
tr::now,
|
||||||
|
lt_name,
|
||||||
|
Ui::Text::Link(packName, u"internal:"_q),
|
||||||
|
Ui::Text::WithEntities);
|
||||||
|
const auto weak = base::make_weak(controller);
|
||||||
|
controller->showToast(Ui::Toast::Config{
|
||||||
|
.text = text,
|
||||||
|
.filter = [=, set = sticker->set](
|
||||||
|
const ClickHandlerPtr &handler,
|
||||||
|
Qt::MouseButton) {
|
||||||
|
if (const auto strong = weak.get()) {
|
||||||
|
strong->show(
|
||||||
|
Box<StickerSetBox>(
|
||||||
|
strong->uiShow(),
|
||||||
|
set,
|
||||||
|
Data::StickersType::Emoji));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
.duration = crl::time(3000),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (_hasStories) {
|
||||||
controller->openPeerStories(_peer->id);
|
controller->openPeerStories(_peer->id);
|
||||||
} else {
|
} else {
|
||||||
openPhoto();
|
openPhoto();
|
||||||
|
|||||||
Reference in New Issue
Block a user