Merge branch 'DRTVWR-489' of https://github.com/secondlife/viewer
# Conflicts: # indra/llui/llemojidictionary.cpp # indra/newview/llfloateremojipicker.cpp # indra/newview/skins/default/xui/en/floater_emoji_picker.xmlmaster
commit
ca3b0c59ed
|
|
@ -239,6 +239,7 @@ Ansariel Hiller
|
|||
SL-15227
|
||||
SL-15398
|
||||
SL-18432
|
||||
SL-19575
|
||||
SL-19623
|
||||
Aralara Rajal
|
||||
Arare Chantilly
|
||||
|
|
|
|||
|
|
@ -141,8 +141,6 @@ void LLEmojiDictionary::initClass()
|
|||
|
||||
LLSD data;
|
||||
|
||||
// <FS:Ansariel> Load correct localized file
|
||||
//const std::string filename = gDirUtilp->findSkinnedFilenames(LLDir::XUI, SKINNED_EMOJI_FILENAME, LLDir::CURRENT_SKIN).front();
|
||||
auto filenames = gDirUtilp->findSkinnedFilenames(LLDir::XUI, SKINNED_EMOJI_FILENAME, LLDir::CURRENT_SKIN);
|
||||
if (filenames.empty())
|
||||
{
|
||||
|
|
@ -150,7 +148,6 @@ void LLEmojiDictionary::initClass()
|
|||
return;
|
||||
}
|
||||
const std::string filename = filenames.back();
|
||||
// </FS:Ansariel>
|
||||
llifstream file(filename.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,8 +57,11 @@ class LLEmojiDictionary : public LLParamSingleton<LLEmojiDictionary>, public LLI
|
|||
|
||||
public:
|
||||
typedef std::map<llwchar, const LLEmojiDescriptor*> emoji2descr_map_t;
|
||||
typedef std::pair<llwchar, const LLEmojiDescriptor*> emoji2descr_item_t;
|
||||
typedef std::map<std::string, const LLEmojiDescriptor*> code2descr_map_t;
|
||||
typedef std::pair<std::string, const LLEmojiDescriptor*> code2descr_item_t;
|
||||
typedef std::map<std::string, std::vector<const LLEmojiDescriptor*>> cat2descrs_map_t;
|
||||
typedef std::pair<std::string, std::vector<const LLEmojiDescriptor*>> cat2descrs_item_t;
|
||||
|
||||
static void initClass();
|
||||
LLWString findMatchingEmojis(const std::string& needle) const;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public:
|
|||
Alternative<std::string> string;
|
||||
Alternative<U32> flags;
|
||||
|
||||
Follows();
|
||||
Follows();
|
||||
};
|
||||
|
||||
struct Params : public LLInitParam::Block<Params>
|
||||
|
|
@ -670,8 +670,8 @@ public:
|
|||
// Draw debug rectangles around widgets to help with alignment and spacing
|
||||
static bool sDebugRects;
|
||||
|
||||
static bool sIsRectDirty;
|
||||
static LLRect sDirtyRect;
|
||||
static bool sIsRectDirty;
|
||||
static LLRect sDirtyRect;
|
||||
|
||||
// Draw widget names and sizes when drawing debug rectangles, turning this
|
||||
// off is useful to make the rectangles themselves easier to see.
|
||||
|
|
@ -714,19 +714,15 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
|
|||
if (!result)
|
||||
{
|
||||
result = LLUICtrlFactory::getDefaultWidget<T>(name);
|
||||
if (!result)
|
||||
{
|
||||
LL_ERRS() << "Failed to create dummy " << typeid(T).name() << LL_ENDL;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
// *NOTE: You cannot call mFoo = getChild<LLFoo>("bar")
|
||||
// in a floater or panel constructor. The widgets will not
|
||||
// be ready. Instead, put it in postBuild().
|
||||
LL_WARNS() << "Making dummy " << typeid(T).name() << " named \"" << name << "\" in " << getName() << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Failed to create dummy " << typeid(T).name() << LL_ENDL;
|
||||
return NULL;
|
||||
}
|
||||
// *NOTE: You cannot call mFoo = getChild<LLFoo>("bar")
|
||||
// in a floater or panel constructor. The widgets will not
|
||||
// be ready. Instead, put it in postBuild().
|
||||
LL_WARNS() << "Making dummy " << typeid(T).name() << " named \"" << name << "\" in " << getName() << LL_ENDL;
|
||||
|
||||
getDefaultWidgetContainer().addChild(result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,15 +73,14 @@ LLFloaterEmojiPicker* LLFloaterEmojiPicker::getInstance()
|
|||
{
|
||||
LLFloaterEmojiPicker* floater = LLFloaterReg::getTypedInstance<LLFloaterEmojiPicker>("emoji_picker");
|
||||
if (!floater)
|
||||
LL_WARNS() << "Cannot instantiate emoji picker" << LL_ENDL;
|
||||
LL_ERRS() << "Cannot instantiate emoji picker" << LL_ENDL;
|
||||
return floater;
|
||||
}
|
||||
|
||||
LLFloaterEmojiPicker* LLFloaterEmojiPicker::showInstance(pick_callback_t pick_callback, close_callback_t close_callback)
|
||||
{
|
||||
LLFloaterEmojiPicker* floater = getInstance();
|
||||
if (LLFloaterEmojiPicker* floater = getInstance())
|
||||
floater->show(pick_callback, close_callback);
|
||||
floater->show(pick_callback, close_callback);
|
||||
return floater;
|
||||
}
|
||||
|
||||
|
|
@ -101,41 +100,31 @@ LLFloaterEmojiPicker::LLFloaterEmojiPicker(const LLSD& key)
|
|||
BOOL LLFloaterEmojiPicker::postBuild()
|
||||
{
|
||||
// Should be initialized first
|
||||
if ((mPreviewEmoji = getChild<LLButton>("PreviewEmoji")))
|
||||
{
|
||||
mPreviewEmoji->setClickedCallback(boost::bind(&LLFloaterEmojiPicker::onPreviewEmojiClick, this));
|
||||
}
|
||||
mPreviewEmoji = getChild<LLButton>("PreviewEmoji");
|
||||
mPreviewEmoji->setClickedCallback(boost::bind(&LLFloaterEmojiPicker::onPreviewEmojiClick, this));
|
||||
|
||||
if ((mCategory = getChild<LLComboBox>("Category")))
|
||||
mCategory = getChild<LLComboBox>("Category");
|
||||
mCategory->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onCategoryCommit, this));
|
||||
const LLEmojiDictionary::cat2descrs_map_t& cat2Descrs = LLEmojiDictionary::instance().getCategory2Descrs();
|
||||
mCategory->clearRows();
|
||||
for (const LLEmojiDictionary::cat2descrs_item_t& item : cat2Descrs)
|
||||
{
|
||||
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);
|
||||
std::string value = item.first;
|
||||
std::string name = value;
|
||||
LLStringUtil::capitalize(name);
|
||||
mCategory->add(name, value);
|
||||
}
|
||||
mCategory->setSelectedByValue(mSelectedCategory, true);
|
||||
|
||||
if ((mSearch = getChild<LLLineEditor>("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<LLLineEditor>("Search");
|
||||
mSearch->setKeystrokeCallback(boost::bind(&LLFloaterEmojiPicker::onSearchKeystroke, this, _1, _2), NULL);
|
||||
mSearch->setFont(LLViewerChat::getChatFont());
|
||||
mSearch->setText(mSearchPattern);
|
||||
|
||||
if ((mEmojis = getChild<LLScrollListCtrl>("Emojis")))
|
||||
{
|
||||
mEmojis->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiSelect, this));
|
||||
mEmojis->setDoubleClickCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiPick, this));
|
||||
fillEmojis();
|
||||
}
|
||||
mEmojis = getChild<LLScrollListCtrl>("Emojis");
|
||||
mEmojis->setCommitCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiSelect, this));
|
||||
mEmojis->setDoubleClickCallback(boost::bind(&LLFloaterEmojiPicker::onEmojiPick, this));
|
||||
fillEmojis();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -149,8 +138,8 @@ void LLFloaterEmojiPicker::fillEmojis()
|
|||
{
|
||||
mEmojis->clearRows();
|
||||
|
||||
const auto& emoji2Descr = LLEmojiDictionary::instance().getEmoji2Descr();
|
||||
for (const std::pair<const llwchar, const LLEmojiDescriptor*>& it : emoji2Descr)
|
||||
const LLEmojiDictionary::emoji2descr_map_t& emoji2Descr = LLEmojiDictionary::instance().getEmoji2Descr();
|
||||
for (const LLEmojiDictionary::emoji2descr_item_t& it : emoji2Descr)
|
||||
{
|
||||
const LLEmojiDescriptor* descr = it.second;
|
||||
|
||||
|
|
@ -189,10 +178,10 @@ bool LLFloaterEmojiPicker::matchesPattern(const LLEmojiDescriptor* descr)
|
|||
{
|
||||
if (descr->Name.find(mSearchPattern) != std::string::npos)
|
||||
return true;
|
||||
for (auto shortCode : descr->ShortCodes)
|
||||
for (const std::string& shortCode : descr->ShortCodes)
|
||||
if (shortCode.find(mSearchPattern) != std::string::npos)
|
||||
return true;
|
||||
for (auto category : descr->Categories)
|
||||
for (const std::string& category : descr->Categories)
|
||||
if (category.find(mSearchPattern) != std::string::npos)
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -214,7 +203,7 @@ void LLFloaterEmojiPicker::onSearchKeystroke(LLLineEditor* caller, void* user_da
|
|||
|
||||
void LLFloaterEmojiPicker::onPreviewEmojiClick()
|
||||
{
|
||||
if (mEmojis && mEmojiPickCallback)
|
||||
if (mEmojiPickCallback)
|
||||
{
|
||||
if (LLEmojiScrollListItem* item = dynamic_cast<LLEmojiScrollListItem*>(mEmojis->getFirstSelected()))
|
||||
{
|
||||
|
|
@ -231,8 +220,7 @@ void LLFloaterEmojiPicker::onEmojiSelect()
|
|||
mSelectedEmojiIndex = mEmojis->getFirstSelectedIndex();
|
||||
LLUIString text;
|
||||
text.insert(0, LLWString(1, item->getEmoji()));
|
||||
if (mPreviewEmoji)
|
||||
mPreviewEmoji->setLabel(text);
|
||||
mPreviewEmoji->setLabel(text);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -242,13 +230,12 @@ void LLFloaterEmojiPicker::onEmojiSelect()
|
|||
void LLFloaterEmojiPicker::onEmojiEmpty()
|
||||
{
|
||||
mSelectedEmojiIndex = 0;
|
||||
if (mPreviewEmoji)
|
||||
mPreviewEmoji->setLabel(LLUIString());
|
||||
mPreviewEmoji->setLabel(LLUIString());
|
||||
}
|
||||
|
||||
void LLFloaterEmojiPicker::onEmojiPick()
|
||||
{
|
||||
if (mEmojis && mEmojiPickCallback)
|
||||
if (mEmojiPickCallback)
|
||||
{
|
||||
if (LLEmojiScrollListItem* item = dynamic_cast<LLEmojiScrollListItem*>(mEmojis->getFirstSelected()))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<floater name="emojipicker" title="Emoji auswählen">
|
||||
<line_editor name="Search" label="Nach Emoji suchen"/>
|
||||
<scroll_list name="Emojis">
|
||||
<columns label="Emoji" name="look" />
|
||||
<columns label="@" name="look" />
|
||||
<columns label="Name" name="name" />
|
||||
</scroll_list>
|
||||
<combo_box name="Category" label="Kategorie auswählen"/>
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@
|
|||
height="338"
|
||||
width="192">
|
||||
<columns
|
||||
label="Look"
|
||||
label="@"
|
||||
name="look"
|
||||
width="50" />
|
||||
width="30" />
|
||||
<columns
|
||||
label="Name"
|
||||
name="name" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue