diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-09-22 01:19:42 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-09-22 01:29:32 +0200 |
commit | c40f63911c1fad5ea5a18894f530892ddb87c8ea (patch) | |
tree | 092952ce3ac9019a0671babd4c122c64377450e0 | |
parent | 9de22c0eb325e1bf1fd17020a9c6d61e5a162b3a (diff) |
SL-20294 The row of recent emojis displays the recently sent emoji only after clicking the collapsing smiley button
-rw-r--r-- | indra/newview/llfloateremojipicker.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llfloateremojipicker.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterimsessiontab.cpp | 82 | ||||
-rw-r--r-- | indra/newview/llfloaterimsessiontab.h | 2 |
4 files changed, 64 insertions, 33 deletions
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 1608a4f19c..10013c907d 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -772,6 +772,18 @@ void LLFloaterEmojiPicker::onEmojiUsed(llwchar emoji) } // static +void LLFloaterEmojiPicker::onRecentlyUsedChanged() +{ + if (sSelectedGroupIndex) + return; + + if (LLFloaterEmojiPicker* picker = getInstance()) + { + picker->fillEmojis(); + } +} + +// static void LLFloaterEmojiPicker::loadState() { if (!sStateFileName.empty()) diff --git a/indra/newview/llfloateremojipicker.h b/indra/newview/llfloateremojipicker.h index cfb3da3acc..b8e3190bf3 100644 --- a/indra/newview/llfloateremojipicker.h +++ b/indra/newview/llfloateremojipicker.h @@ -56,6 +56,7 @@ public: static std::list<llwchar>& getRecentlyUsed(); static void onEmojiUsed(llwchar emoji); + static void onRecentlyUsedChanged(); static void loadState(); static void saveState(); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index d46780fa81..7a0de78ac5 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -456,7 +456,7 @@ void LLFloaterIMSessionTab::onEmojiRecentPanelToggleBtnClicked(LLFloaterIMSessio BOOL show = !self->mEmojiRecentPanel->getVisible(); if (show) { - self->onEmojiRecentPanelOpening(); + self->initEmojiRecentPanel(true); } self->mEmojiRecentPanel->setVisible(show); } @@ -482,27 +482,33 @@ void LLFloaterIMSessionTab::onEmojiPickerToggleBtnClicked(LLFloaterIMSessionTab* } } -void LLFloaterIMSessionTab::onEmojiRecentPanelOpening() -{ - std::list<llwchar>& recentlyUsed = LLFloaterEmojiPicker::getRecentlyUsed(); - if (recentlyUsed.empty()) - { - mEmojiRecentEmptyText->setVisible(true); - mEmojiRecentIconsCtrl->setVisible(false); - mEmojiPickerToggleBtn->setFocus(true); - } - else - { - LLWString emojis; - for (llwchar emoji : recentlyUsed) - { - emojis += emoji; - } - mEmojiRecentIconsCtrl->setEmojis(emojis); - mEmojiRecentEmptyText->setVisible(false); - mEmojiRecentIconsCtrl->setVisible(true); - mEmojiRecentIconsCtrl->setFocus(true); - } +void LLFloaterIMSessionTab::initEmojiRecentPanel(bool moveFocus) +{ + std::list<llwchar>& recentlyUsed = LLFloaterEmojiPicker::getRecentlyUsed(); + if (recentlyUsed.empty()) + { + mEmojiRecentEmptyText->setVisible(true); + mEmojiRecentIconsCtrl->setVisible(false); + if (moveFocus) + { + mEmojiPickerToggleBtn->setFocus(true); + } + } + else + { + LLWString emojis; + for (llwchar emoji : recentlyUsed) + { + emojis += emoji; + } + mEmojiRecentIconsCtrl->setEmojis(emojis); + mEmojiRecentEmptyText->setVisible(false); + mEmojiRecentIconsCtrl->setVisible(true); + if (moveFocus) + { + mEmojiRecentIconsCtrl->setFocus(true); + } + } } void LLFloaterIMSessionTab::onRecentEmojiPicked(const LLSD& value) @@ -514,7 +520,7 @@ void LLFloaterIMSessionTab::onRecentEmojiPicked(const LLSD& value) if (wstr.size()) { llwchar emoji = wstr[0]; - onEmojiPicked(emoji); + mInputEditor->insertEmoji(emoji); } } } @@ -579,16 +585,28 @@ void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD& args) void LLFloaterIMSessionTab::updateUsedEmojis(LLWString text) { - LLEmojiDictionary* dictionary = LLEmojiDictionary::getInstance(); - llassert_always(dictionary); + LLEmojiDictionary* dictionary = LLEmojiDictionary::getInstance(); + llassert_always(dictionary); - for (llwchar& c : text) - { - if (dictionary->isEmoji(c)) - { - LLFloaterEmojiPicker::onEmojiUsed(c); - } - } + bool emojiSent = false; + for (llwchar& c : text) + { + if (dictionary->isEmoji(c)) + { + LLFloaterEmojiPicker::onEmojiUsed(c); + emojiSent = true; + } + } + + if (!emojiSent) + return; + + LLFloaterEmojiPicker::onRecentlyUsedChanged(); + + if (mEmojiRecentPanel->getVisible()) + { + initEmojiRecentPanel(false); + } } static LLTrace::BlockTimerStatHandle FTM_BUILD_CONVERSATION_VIEW_PARTICIPANT("Build Conversation View"); diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index d21f611172..0ff3d0b38c 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -217,7 +217,7 @@ private: static void onEmojiRecentPanelToggleBtnClicked(LLFloaterIMSessionTab* self); static void onEmojiPickerToggleBtnClicked(LLFloaterIMSessionTab* self); - void onEmojiRecentPanelOpening(); + void initEmojiRecentPanel(bool moveFocus); void onRecentEmojiPicked(const LLSD& value); void onEmojiPicked(llwchar emoji); void onEmojiPickerClosed(); |