diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 0a798d7607..0d5e4be16e 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -603,6 +603,11 @@ FSFloaterIM::~FSFloaterIM() { mAvatarNameCacheConnection.disconnect(); } + + if (mRecentEmojisUpdatedCallbackConnection.connected()) + { + mRecentEmojisUpdatedCallbackConnection.disconnect(); + } } void FSFloaterIM::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) @@ -970,6 +975,8 @@ BOOL FSFloaterIM::postBuild() mEmojiPickerToggleBtn->setLabel(LLUIString(LLWString(1, 128512))); mEmojiPickerToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerToggleBtnClicked(this); }); + mRecentEmojisUpdatedCallbackConnection = LLFloaterEmojiPicker::setRecentEmojisUpdatedCallback([this](const std::list& recent_emojis_list) { onEmojiRecentPanelOpening(); }); + getChild("send_chat")->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL)); getChild("chat_search_btn")->setCommitCallback(boost::bind(&FSFloaterIM::onChatSearchButtonClicked, this)); diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index ec30f145c8..41393be67d 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -295,6 +295,8 @@ private: bool mApplyRect; FSFloaterIMTimer* mIMFloaterTimer; + + boost::signals2::connection mRecentEmojisUpdatedCallbackConnection{}; }; class FSFloaterIMTimer : public LLEventTimer diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 2de4df2a17..09b3ed96ad 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -104,6 +104,10 @@ FSFloaterNearbyChat::FSFloaterNearbyChat(const LLSD& key) FSFloaterNearbyChat::~FSFloaterNearbyChat() { + if (mRecentEmojisUpdatedCallbackConnection.connected()) + { + mRecentEmojisUpdatedCallbackConnection.disconnect(); + } } void FSFloaterNearbyChat::updateFSUseNearbyChatConsole(const LLSD &data) @@ -160,6 +164,8 @@ BOOL FSFloaterNearbyChat::postBuild() mEmojiPickerToggleBtn->setLabel(LLUIString(LLWString(1, 128512))); mEmojiPickerToggleBtn->setClickedCallback([this](LLUICtrl*, const LLSD&) { onEmojiPickerToggleBtnClicked(this); }); + mRecentEmojisUpdatedCallbackConnection = LLFloaterEmojiPicker::setRecentEmojisUpdatedCallback([this](const std::list& recent_emojis_list) { onEmojiRecentPanelOpening(); }); + getChild("chat_history_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onHistoryButtonClicked, this)); getChild("chat_search_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onSearchButtonClicked, this)); diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 2654887494..6cd1f91036 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -156,6 +156,8 @@ private: std::vector mMessageArchive; BOOL FSUseNearbyChatConsole; + + boost::signals2::connection mRecentEmojisUpdatedCallbackConnection{}; }; #endif // FS_FLOATERNEARBYCHAT_H diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index cae379a56e..727a4a9fd2 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -42,6 +42,8 @@ #include "lltextbox.h" #include "llviewerchat.h" +LLFloaterEmojiPicker::recent_emojis_updated_callback_t LLFloaterEmojiPicker::sRecentEmojisUpdatedCallback{}; // Live-update recently used emojis + namespace { // The following variables and constants are used for storing the floater state // between different lifecycles of the floater and different sissions of the viewer @@ -771,6 +773,9 @@ void LLFloaterEmojiPicker::onEmojiUsed(llwchar emoji) // Append new if not found if (itf == sFrequentlyUsed.end()) sFrequentlyUsed.push_back(std::make_pair(emoji, 1)); + + // Live-update recently used emojis + sRecentEmojisUpdatedCallback(sRecentlyUsed); } // static diff --git a/indra/newview/llfloateremojipicker.h b/indra/newview/llfloateremojipicker.h index decee41721..3a4ddde7c7 100644 --- a/indra/newview/llfloateremojipicker.h +++ b/indra/newview/llfloateremojipicker.h @@ -59,6 +59,14 @@ public: static void loadState(); static void saveState(); + // Live-update recently used emojis + using recent_emojis_updated_callback_t = boost::signals2::signal& recent_emojis_list)>; + static boost::signals2::connection setRecentEmojisUpdatedCallback(const recent_emojis_updated_callback_t::slot_type& cb) + { + return sRecentEmojisUpdatedCallback.connect(cb); + } + // + private: void fillGroups(); void moveGroups(); @@ -96,6 +104,9 @@ private: S32 mRecentGridWidth { 0 }; S32 mRecentMaxIcons { 0 }; LLUICtrl* mHoveredIcon { nullptr }; + + // Live-update recently used emojis + static recent_emojis_updated_callback_t sRecentEmojisUpdatedCallback; }; #endif