Add emoji dictionary to FS chat input

master
Ansariel 2023-04-22 16:05:34 +02:00
parent d61d800cff
commit f4681346ee
8 changed files with 149 additions and 14 deletions

View File

@ -26294,6 +26294,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSShowEmojiButton</key>
<map>
<key>Comment</key>
<string>Show or hide the emoji selection button in chat/IM windows</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSAnimationPreviewExpanded</key>
<map>
<key>Comment</key>

View File

@ -53,6 +53,7 @@
#include "llconsole.h"
#include "llfloaterabout.h" // for sysinfo button -Zi
#include "llfloateravatarpicker.h"
#include "llfloateremojipicker.h"
#include "llfloaterreg.h"
#include "llfloatersearchreplace.h"
#include "llgroupactions.h"
@ -953,8 +954,10 @@ BOOL FSFloaterIM::postBuild()
mInputEditor->enableSingleLineMode(gSavedSettings.getBOOL("FSUseSingleLineChatEntry"));
mInputEditor->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL));
getChild<LLButton>("send_chat")->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL));
mEmojiButton = getChild<LLButton>("emoji_panel_btn");
mEmojiButton->setClickedCallback(boost::bind(&FSFloaterIM::onEmojiPanelBtnClicked, this));
getChild<LLButton>("send_chat")->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL));
getChild<LLButton>("chat_search_btn")->setCommitCallback(boost::bind(&FSFloaterIM::onChatSearchButtonClicked, this));
bool isFSSupportGroup = FSData::getInstance()->isFirestormGroup(mSessionID);
@ -2501,3 +2504,34 @@ bool FSFloaterIM::applyRectControl()
return res;
}
void FSFloaterIM::onEmojiPanelBtnClicked(FSFloaterIM* self)
{
if (LLFloaterEmojiPicker* picker = LLFloaterEmojiPicker::getInstance())
{
if (!picker->isShown())
{
picker->show(
boost::bind(&FSFloaterIM::onEmojiPicked, self, _1),
boost::bind(&FSFloaterIM::onEmojiPickerClosed, self));
if (LLFloater* root_floater = gFloaterView->getParentFloater(self))
{
root_floater->addDependentFloater(picker, TRUE, TRUE);
}
}
else
{
picker->closeFloater();
}
}
}
void FSFloaterIM::onEmojiPicked(llwchar emoji)
{
mInputEditor->insertEmoji(emoji);
}
void FSFloaterIM::onEmojiPickerClosed()
{
mInputEditor->setFocus(TRUE);
}

View File

@ -173,7 +173,6 @@ protected:
// support sysinfo button -Zi
BOOL enableViewerVersionCallback(const LLSD& notification,const LLSD& response); // <FS:Zi> Viewer version popup
void reshapeFloater(bool collapse);
void reshapeChatLayoutPanel();
private:
// process focus events to set a currently active session
@ -236,10 +235,14 @@ private:
void addSessionParticipants(const uuid_vec_t& uuids);
void addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids);
void onChatOptionsContextMenuItemClicked(const LLSD& userdata);
bool onChatOptionsCheckContextMenuItem(const LLSD& userdata);
bool onChatOptionsVisibleContextMenuItem(const LLSD& userdata);
bool onChatOptionsEnableContextMenuItem(const LLSD& userdata);
void onChatOptionsContextMenuItemClicked(const LLSD& userdata);
bool onChatOptionsCheckContextMenuItem(const LLSD& userdata);
bool onChatOptionsVisibleContextMenuItem(const LLSD& userdata);
bool onChatOptionsEnableContextMenuItem(const LLSD& userdata);
static void onEmojiPanelBtnClicked(FSFloaterIM* self);
void onEmojiPicked(llwchar emoji);
void onEmojiPickerClosed();
FSPanelChatControlPanel* mControlPanel;
LLUUID mSessionID;
@ -254,7 +257,7 @@ private:
LLLayoutStack* mInputPanels;
LLLayoutPanel* mUnreadMessagesNotificationPanel;
LLTextBox* mUnreadMessagesNotificationTextBox;
// bool mPositioned; // dead code -Zi
LLButton* mEmojiButton;
std::string mSavedTitle;
LLUIString mTypingStart;

View File

@ -50,6 +50,7 @@
#include "llcommandhandler.h"
#include "llconsole.h"
#include "lldraghandle.h"
#include "llfloateremojipicker.h"
#include "llfloaterreg.h"
#include "llfloatersearchreplace.h"
#include "llfocusmgr.h"
@ -141,8 +142,10 @@ BOOL FSFloaterNearbyChat::postBuild()
mChatLayoutPanelHeight = mChatLayoutPanel->getRect().getHeight();
mInputEditorPad = mChatLayoutPanelHeight - mInputEditor->getRect().getHeight();
getChild<LLButton>("chat_history_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onHistoryButtonClicked, this));
mEmojiButton = getChild<LLButton>("emoji_panel_btn");
mEmojiButton->setClickedCallback(boost::bind(&FSFloaterNearbyChat::onEmojiPanelBtnClicked, this));
getChild<LLButton>("chat_history_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onHistoryButtonClicked, this));
getChild<LLButton>("chat_search_btn")->setCommitCallback(boost::bind(&FSFloaterNearbyChat::onSearchButtonClicked, this));
// chat type selector and send chat button
@ -942,3 +945,34 @@ void FSFloaterNearbyChat::handleMinimized(bool minimized)
gConsole->addSession(LLUUID::null);
}
}
void FSFloaterNearbyChat::onEmojiPanelBtnClicked(FSFloaterNearbyChat* self)
{
if (LLFloaterEmojiPicker* picker = LLFloaterEmojiPicker::getInstance())
{
if (!picker->isShown())
{
picker->show(
boost::bind(&FSFloaterNearbyChat::onEmojiPicked, self, _1),
boost::bind(&FSFloaterNearbyChat::onEmojiPickerClosed, self));
if (LLFloater* root_floater = gFloaterView->getParentFloater(self))
{
root_floater->addDependentFloater(picker, TRUE, TRUE);
}
}
else
{
picker->closeFloater();
}
}
}
void FSFloaterNearbyChat::onEmojiPicked(llwchar emoji)
{
mInputEditor->insertEmoji(emoji);
}
void FSFloaterNearbyChat::onEmojiPickerClosed()
{
mInputEditor->setFocus(TRUE);
}

View File

@ -93,7 +93,6 @@ public:
virtual BOOL handleKeyHere( KEY key, MASK mask );
static void startChat(const char* line);
static void stopChat();
void updateUnreadMessageNotification(S32 unread_messages, bool muted_history);
@ -111,22 +110,26 @@ protected:
void onChatBoxCommit();
void onChatTypeChanged();
void reshapeFloater(bool collapse);
void reshapeChatLayoutPanel();
static S32 sLastSpecialChatChannel;
private:
void onChatOptionsContextMenuItemClicked(const LLSD& userdata);
bool onChatOptionsCheckContextMenuItem(const LLSD& userdata);
bool onChatOptionsVisibleContextMenuItem(const LLSD& userdata);
bool onChatOptionsEnableContextMenuItem(const LLSD& userdata);
void onChatOptionsContextMenuItemClicked(const LLSD& userdata);
bool onChatOptionsCheckContextMenuItem(const LLSD& userdata);
bool onChatOptionsVisibleContextMenuItem(const LLSD& userdata);
bool onChatOptionsEnableContextMenuItem(const LLSD& userdata);
static void onEmojiPanelBtnClicked(FSFloaterNearbyChat* self);
void onEmojiPicked(llwchar emoji);
void onEmojiPickerClosed();
FSChatHistory* mChatHistory;
FSChatHistory* mChatHistoryMuted;
LLChatEntry* mInputEditor;
// chat type selector and send chat buttons
LLButton* mEmojiButton;
LLButton* mSendChatButton;
LLComboBox* mChatTypeCombo;

View File

@ -650,6 +650,27 @@
right="-3"
wrap="true" />
</layout_panel>
<layout_panel
visibility_control="FSShowEmojiButton"
auto_resize="false"
user_resize="false"
name="emoji_button_layout_panel"
width="25"
top="0"
bottom="-1">
<button
follows="right|bottom"
bottom="23"
height="22"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Emoji_Picker_Icon"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
right="-1"
name="emoji_panel_btn"
tool_tip="Show/hide emoji panel"
width="24"/>
</layout_panel>
<layout_panel
visibility_control="FSShowIMSendButton"
auto_resize="false"

View File

@ -271,6 +271,25 @@
right="-1"
wrap="true" />
</layout_panel>
<layout_panel
visibility_control="FSShowEmojiButton"
auto_resize="false"
user_resize="false"
name="emoji_button_layout_panel"
width="25">
<button
follows="right|bottom"
bottom="-1"
height="22"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Emoji_Picker_Icon"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
right="-1"
name="emoji_panel_btn"
tool_tip="Show/hide emoji panel"
width="24"/>
</layout_panel>
<layout_panel
visibility_control="FSShowChatChannel"
auto_resize="false"

View File

@ -154,6 +154,16 @@
function="ChatOptions.Enable"
parameter="show_channel_selection"/>
</menu_item_check>
<menu_item_check
label="Show emoji button"
name="show_emoji_button">
<menu_item_check.on_check
function="CheckControl"
parameter="FSShowEmojiButton"/>
<menu_item_check.on_click
function="ToggleControl"
parameter="FSShowEmojiButton"/>
</menu_item_check>
<menu_item_check
label="Show chat type / send button"
name="show_send_button">