From c2eec5b100a7064f3c737db46f893864a8b29c3a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 22 Apr 2023 18:38:46 +0200 Subject: Don't hardcode UI text plus layout fixes and removing some needless checks --- indra/newview/llfloateremojipicker.cpp | 54 +++++++++------------- .../skins/default/xui/en/floater_emoji_picker.xml | 25 +++++----- 2 files changed, 35 insertions(+), 44 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 5efd2a24c0..ab81b2936f 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -80,7 +80,7 @@ LLFloaterEmojiPicker* LLFloaterEmojiPicker::getInstance() LLFloaterEmojiPicker* LLFloaterEmojiPicker::showInstance(pick_callback_t pick_callback, close_callback_t close_callback) { LLFloaterEmojiPicker* floater = getInstance(); - if (LLFloaterEmojiPicker* floater = getInstance()) + if (floater) floater->show(pick_callback, close_callback); return floater; } @@ -101,41 +101,31 @@ LLFloaterEmojiPicker::LLFloaterEmojiPicker(const LLSD& key) BOOL LLFloaterEmojiPicker::postBuild() { // Should be initialized first - if ((mPreviewEmoji = getChild("PreviewEmoji"))) + mPreviewEmoji = getChild("PreviewEmoji"); + mPreviewEmoji->setClickedCallback(boost::bind(&LLFloaterEmojiPicker::onPreviewEmojiClick, this)); + + mCategory = getChild("Category"); + mCategory->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onCategoryCommit, this)); + const auto& cat2Descrs = LLEmojiDictionary::instance().getCategory2Descrs(); + mCategory->clearRows(); + for (const auto& item : cat2Descrs) { - mPreviewEmoji->setClickedCallback(boost::bind(&LLFloaterEmojiPicker::onPreviewEmojiClick, this)); + std::string value = item.first; + std::string name = value; + LLStringUtil::capitalize(name); + mCategory->add(name, value); } + mCategory->setSelectedByValue(mSelectedCategory, true); - if ((mCategory = getChild("Category"))) - { - mCategory->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onCategoryCommit, this)); - mCategory->setLabel(LLStringExplicit("Choose a category")); - const auto& cat2Descrs = LLEmojiDictionary::instance().getCategory2Descrs(); - mCategory->clearRows(); - for (const auto& item : cat2Descrs) - { - std::string value = item.first; - std::string name = value; - LLStringUtil::capitalize(name); - mCategory->add(name, value); - } - mCategory->setSelectedByValue(mSelectedCategory, true); - } - - if ((mSearch = getChild("Search"))) - { - mSearch->setKeystrokeCallback(boost::bind(&LLFloaterEmojiPicker::onSearchKeystroke, this, _1, _2), NULL); - mSearch->setLabel(LLStringExplicit("Type to search an emoji")); - mSearch->setFont(LLViewerChat::getChatFont()); - mSearch->setText(mSearchPattern); - } + mSearch = getChild("Search"); + mSearch->setKeystrokeCallback(boost::bind(&LLFloaterEmojiPicker::onSearchKeystroke, this, _1, _2), NULL); + mSearch->setFont(LLViewerChat::getChatFont()); + mSearch->setText(mSearchPattern); - if ((mEmojis = getChild("Emojis"))) - { - mEmojis->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiSelect, this)); - mEmojis->setDoubleClickCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiPick, this)); - fillEmojis(); - } + mEmojis = getChild("Emojis"); + mEmojis->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiSelect, this)); + mEmojis->setDoubleClickCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiPick, this)); + fillEmojis(); return TRUE; } diff --git a/indra/newview/skins/default/xui/en/floater_emoji_picker.xml b/indra/newview/skins/default/xui/en/floater_emoji_picker.xml index 831f7b6582..f339c7428f 100644 --- a/indra/newview/skins/default/xui/en/floater_emoji_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_emoji_picker.xml @@ -11,23 +11,23 @@ width="200"> + width="158" />