Update recently used emojis on the fly

meow-7.2.2
Ansariel 2023-09-04 23:33:45 +02:00
parent 33763103d3
commit ade7d26061
6 changed files with 33 additions and 0 deletions

View File

@ -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<llwchar>& recent_emojis_list) { onEmojiRecentPanelOpening(); });
getChild<LLButton>("send_chat")->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL));
getChild<LLButton>("chat_search_btn")->setCommitCallback(boost::bind(&FSFloaterIM::onChatSearchButtonClicked, this));

View File

@ -295,6 +295,8 @@ private:
bool mApplyRect;
FSFloaterIMTimer* mIMFloaterTimer;
boost::signals2::connection mRecentEmojisUpdatedCallbackConnection{};
};
class FSFloaterIMTimer : public LLEventTimer

View File

@ -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<llwchar>& recent_emojis_list) { onEmojiRecentPanelOpening(); });
getChild<LLButton>("chat_history_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onHistoryButtonClicked, this));
getChild<LLButton>("chat_search_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onSearchButtonClicked, this));

View File

@ -156,6 +156,8 @@ private:
std::vector<LLChat> mMessageArchive;
BOOL FSUseNearbyChatConsole;
boost::signals2::connection mRecentEmojisUpdatedCallbackConnection{};
};
#endif // FS_FLOATERNEARBYCHAT_H

View File

@ -42,6 +42,8 @@
#include "lltextbox.h"
#include "llviewerchat.h"
LLFloaterEmojiPicker::recent_emojis_updated_callback_t LLFloaterEmojiPicker::sRecentEmojisUpdatedCallback{}; // <FS:Ansariel> 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));
// <FS:Ansariel> Live-update recently used emojis
sRecentEmojisUpdatedCallback(sRecentlyUsed);
}
// static

View File

@ -59,6 +59,14 @@ public:
static void loadState();
static void saveState();
// <FS:Ansariel> Live-update recently used emojis
using recent_emojis_updated_callback_t = boost::signals2::signal<void(const std::list<llwchar>& recent_emojis_list)>;
static boost::signals2::connection setRecentEmojisUpdatedCallback(const recent_emojis_updated_callback_t::slot_type& cb)
{
return sRecentEmojisUpdatedCallback.connect(cb);
}
// </FS:Ansariel>
private:
void fillGroups();
void moveGroups();
@ -96,6 +104,9 @@ private:
S32 mRecentGridWidth { 0 };
S32 mRecentMaxIcons { 0 };
LLUICtrl* mHoveredIcon { nullptr };
// <FS:Ansariel> Live-update recently used emojis
static recent_emojis_updated_callback_t sRecentEmojisUpdatedCallback;
};
#endif