mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show custom emoji in private chat reactions.
This commit is contained in:
parent
09124f6424
commit
1e2e007d38
15 changed files with 54 additions and 14 deletions
|
@ -488,6 +488,8 @@ PRIVATE
|
||||||
data/data_media_types.h
|
data/data_media_types.h
|
||||||
# data/data_messages.cpp
|
# data/data_messages.cpp
|
||||||
# data/data_messages.h
|
# data/data_messages.h
|
||||||
|
data/data_message_reaction_id.cpp
|
||||||
|
data/data_message_reaction_id.h
|
||||||
data/data_message_reactions.cpp
|
data/data_message_reactions.cpp
|
||||||
data/data_message_reactions.h
|
data/data_message_reactions.h
|
||||||
data/data_msg_id.h
|
data/data_msg_id.h
|
||||||
|
@ -697,6 +699,8 @@ PRIVATE
|
||||||
history/view/history_view_react_animation.h
|
history/view/history_view_react_animation.h
|
||||||
history/view/history_view_react_button.cpp
|
history/view/history_view_react_button.cpp
|
||||||
history/view/history_view_react_button.h
|
history/view/history_view_react_button.h
|
||||||
|
history/view/history_view_react_selector.cpp
|
||||||
|
history/view/history_view_react_selector.h
|
||||||
history/view/history_view_reactions.cpp
|
history/view/history_view_reactions.cpp
|
||||||
history/view/history_view_reactions.h
|
history/view/history_view_reactions.h
|
||||||
history/view/history_view_replies_section.cpp
|
history/view/history_view_replies_section.cpp
|
||||||
|
|
|
@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_media_types.h"
|
#include "data/data_media_types.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
#include "main/main_app_config.h"
|
#include "main/main_app_config.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
|
|
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_document_media.h"
|
#include "data/data_document_media.h"
|
||||||
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "lottie/lottie_icon.h"
|
#include "lottie/lottie_icon.h"
|
||||||
#include "storage/localimageloader.h"
|
#include "storage/localimageloader.h"
|
||||||
#include "ui/image/image_location_factory.h"
|
#include "ui/image/image_location_factory.h"
|
||||||
|
@ -203,6 +204,16 @@ QImage Reactions::resolveImageFor(
|
||||||
Unexpected("ImageSize in Reactions::resolveImageFor.");
|
Unexpected("ImageSize in Reactions::resolveImageFor.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Ui::Text::CustomEmoji> Reactions::resolveCustomFor(
|
||||||
|
const ReactionId &emoji,
|
||||||
|
ImageSize size) {
|
||||||
|
const auto custom = std::get_if<DocumentId>(&emoji.data);
|
||||||
|
if (!custom) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return _owner->customEmojiManager().create(*custom, [] {});
|
||||||
|
}
|
||||||
|
|
||||||
void Reactions::resolveImages() {
|
void Reactions::resolveImages() {
|
||||||
for (auto &[id, set] : _images) {
|
for (auto &[id, set] : _images) {
|
||||||
if (!set.bottomInfo.isNull() || set.icon || set.media) {
|
if (!set.bottomInfo.isNull() || set.icon || set.media) {
|
||||||
|
|
|
@ -10,6 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "data/data_message_reaction_id.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
|
|
||||||
|
namespace Ui::Text {
|
||||||
|
class CustomEmoji;
|
||||||
|
} // namespace Ui::Text
|
||||||
|
|
||||||
namespace Lottie {
|
namespace Lottie {
|
||||||
class Icon;
|
class Icon;
|
||||||
} // namespace Lottie
|
} // namespace Lottie
|
||||||
|
@ -62,6 +66,9 @@ public:
|
||||||
[[nodiscard]] QImage resolveImageFor(
|
[[nodiscard]] QImage resolveImageFor(
|
||||||
const ReactionId &emoji,
|
const ReactionId &emoji,
|
||||||
ImageSize size);
|
ImageSize size);
|
||||||
|
[[nodiscard]] std::unique_ptr<Ui::Text::CustomEmoji> resolveCustomFor(
|
||||||
|
const ReactionId &emoji,
|
||||||
|
ImageSize size);
|
||||||
|
|
||||||
void send(not_null<HistoryItem*> item, const ReactionId &chosen);
|
void send(not_null<HistoryItem*> item, const ReactionId &chosen);
|
||||||
[[nodiscard]] bool sending(not_null<HistoryItem*> item) const;
|
[[nodiscard]] bool sending(not_null<HistoryItem*> item) const;
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
#include "ui/text/text_options.h"
|
#include "ui/text/text_options.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
|
#include "ui/text/text_block.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/history_message.h"
|
#include "history/history_message.h"
|
||||||
|
@ -355,7 +356,12 @@ void BottomInfo::paintReactions(
|
||||||
y += st::msgDateFont->height;
|
y += st::msgDateFont->height;
|
||||||
widthLeft = availableWidth;
|
widthLeft = availableWidth;
|
||||||
}
|
}
|
||||||
if (reaction.image.isNull()) {
|
if (!reaction.custom && reaction.image.isNull()) {
|
||||||
|
reaction.custom = _reactionsOwner->resolveCustomFor(
|
||||||
|
reaction.id,
|
||||||
|
::Data::Reactions::ImageSize::BottomInfo);
|
||||||
|
}
|
||||||
|
if (!reaction.custom && reaction.image.isNull()) {
|
||||||
reaction.image = _reactionsOwner->resolveImageFor(
|
reaction.image = _reactionsOwner->resolveImageFor(
|
||||||
reaction.id,
|
reaction.id,
|
||||||
::Data::Reactions::ImageSize::BottomInfo);
|
::Data::Reactions::ImageSize::BottomInfo);
|
||||||
|
@ -369,6 +375,9 @@ void BottomInfo::paintReactions(
|
||||||
&& (reaction.count < 2 || !reaction.animation->flying());
|
&& (reaction.count < 2 || !reaction.animation->flying());
|
||||||
if (!reaction.image.isNull() && !skipImage) {
|
if (!reaction.image.isNull() && !skipImage) {
|
||||||
p.drawImage(image.topLeft(), reaction.image);
|
p.drawImage(image.topLeft(), reaction.image);
|
||||||
|
} else if (reaction.custom && !skipImage) {
|
||||||
|
const auto size = Ui::Text::AdjustCustomEmojiSize(st::emojiSize);
|
||||||
|
reaction.custom->paint(p, x + (st::reactionInfoSize - size) / 2, y + (st::msgDateFont->height - size) / 2, crl::now(), Qt::white, false);
|
||||||
}
|
}
|
||||||
if (animating) {
|
if (animating) {
|
||||||
animations.push_back({
|
animations.push_back({
|
||||||
|
|
|
@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "history/view/history_view_object.h"
|
#include "history/view/history_view_object.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
#include "ui/text/text.h"
|
#include "ui/text/text.h"
|
||||||
#include "base/flags.h"
|
#include "base/flags.h"
|
||||||
|
|
||||||
|
@ -16,6 +16,18 @@ namespace Ui {
|
||||||
struct ChatPaintContext;
|
struct ChatPaintContext;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Ui::Text {
|
||||||
|
class CustomEmoji;
|
||||||
|
} // namespace Ui::Text
|
||||||
|
|
||||||
|
namespace Data {
|
||||||
|
class Reactions;
|
||||||
|
} // namespace Data
|
||||||
|
|
||||||
|
namespace Lottie {
|
||||||
|
class Icon;
|
||||||
|
} // namespace Lottie
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
namespace Reactions {
|
namespace Reactions {
|
||||||
class Animation;
|
class Animation;
|
||||||
|
@ -93,6 +105,7 @@ private:
|
||||||
struct Reaction {
|
struct Reaction {
|
||||||
mutable std::unique_ptr<Reactions::Animation> animation;
|
mutable std::unique_ptr<Reactions::Animation> animation;
|
||||||
mutable QImage image;
|
mutable QImage image;
|
||||||
|
mutable std::unique_ptr<Ui::Text::CustomEmoji> custom;
|
||||||
ReactionId id;
|
ReactionId id;
|
||||||
QString countText;
|
QString countText;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
|
@ -34,10 +34,6 @@ struct ChatPaintContext;
|
||||||
class ChatStyle;
|
class ChatStyle;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Lottie {
|
|
||||||
class Icon;
|
|
||||||
} // namespace Lottie
|
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
|
|
||||||
enum class PointState : char;
|
enum class PointState : char;
|
||||||
|
|
|
@ -556,7 +556,6 @@ void Manager::updateButton(ButtonParameters parameters) {
|
||||||
if (_button) {
|
if (_button) {
|
||||||
_button->applyState(ButtonState::Hidden);
|
_button->applyState(ButtonState::Hidden);
|
||||||
_buttonHiding.push_back(std::move(_button));
|
_buttonHiding.push_back(std::move(_button));
|
||||||
_expandSelectorRequests.fire({ .expanded = false });
|
|
||||||
}
|
}
|
||||||
_buttonShowTimer.cancel();
|
_buttonShowTimer.cancel();
|
||||||
_scheduledParameters = std::nullopt;
|
_scheduledParameters = std::nullopt;
|
||||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/view/history_view_react_animation.h"
|
#include "history/view/history_view_react_animation.h"
|
||||||
#include "history/view/history_view_group_call_bar.h"
|
#include "history/view/history_view_group_call_bar.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
|
#include "data/data_message_reactions.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "lang/lang_tag.h"
|
#include "lang/lang_tag.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
|
|
|
@ -8,10 +8,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "history/view/history_view_object.h"
|
#include "history/view/history_view_object.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
class CloudImageView;
|
class CloudImageView;
|
||||||
|
class Reactions;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
|
@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "api/api_who_reacted.h"
|
#include "api/api_who_reacted.h"
|
||||||
#include "ui/controls/who_reacted_context_action.h"
|
#include "ui/controls/who_reacted_context_action.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
|
|
|
@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "ui/abstract_button.h"
|
#include "ui/abstract_button.h"
|
||||||
#include "ui/controls/who_reacted_context_action.h"
|
#include "ui/controls/who_reacted_context_action.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
#include "styles/style_chat.h"
|
#include "styles/style_chat.h"
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "data/notify/data_notify_settings.h"
|
#include "data/notify/data_notify_settings.h"
|
||||||
#include "data/stickers/data_custom_emoji.h"
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "data/data_message_reactions.h"
|
|
||||||
#include "data/data_document_media.h"
|
#include "data/data_document_media.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reaction_id.h"
|
||||||
#include "base/observer.h"
|
#include "base/observer.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue