SL-1932 Hide picker when not focused and update selection button's states

master
andreykproductengine 2019-01-24 16:29:30 +02:00
parent 211ad31dc2
commit e66ccae934
2 changed files with 16 additions and 1 deletions

View File

@ -128,6 +128,7 @@ BOOL LLFloaterSettingsPicker::postBuild()
//todo: this is bad idea
mInventoryPanel->setSelection(mSettingItemID, TAKE_FOCUS_NO);
}
getChild<LLView>(BTN_SELECT)->setEnabled(mSettingItemID.notNull());
}
mNoCopySettingsSelected = FALSE;
@ -289,6 +290,7 @@ void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string)
void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::itemlist_t &items, bool user_action)
{
bool track_picker_enabled = false;
bool is_item = false;
LLUUID asset_id;
if (items.size())
{
@ -307,6 +309,7 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i
setSettingsItemId(bridge_model->getItem()->getUUID(), false);
asset_id = bridge_model->getItem()->getAssetUUID();
mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
is_item = true;
if (user_action)
{
@ -322,6 +325,7 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i
}
}
getChild<LLView>(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled && mSettingAssetID == asset_id);
getChild<LLView>(BTN_SELECT)->setEnabled(is_item && (!track_picker_enabled || mSettingAssetID == asset_id));
if (track_picker_enabled && asset_id.notNull() && mSettingAssetID != asset_id)
{
LLUUID item_id = mSettingItemID;
@ -376,6 +380,8 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr
mSettingAssetID = asset_id;
track_selection->setEnabled(true);
track_selection->selectFirstItem();
getChild<LLView>(BTN_SELECT)->setEnabled(true);
}
void LLFloaterSettingsPicker::onButtonCancel()
@ -459,6 +465,14 @@ BOOL LLFloaterSettingsPicker::handleKeyHere(KEY key, MASK mask)
return LLFloater::handleKeyHere(key, mask);
}
void LLFloaterSettingsPicker::onFocusLost()
{
if (isInVisibleChain())
{
closeFloater();
}
}
//=========================================================================
void LLFloaterSettingsPicker::setActive(bool active)
{

View File

@ -56,7 +56,7 @@ public:
void setActive(bool active);
virtual BOOL postBuild() override;
virtual void onClose(bool app_quitting) override;
virtual void onClose(bool app_quitting) override;
virtual void draw() override;
void setSettingsItemId(const LLUUID &settings_id, bool set_selection = true);
@ -103,6 +103,7 @@ private:
void onButtonSelect();
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
BOOL handleKeyHere(KEY key, MASK mask) override;
void onFocusLost() override;
LLHandle<LLView> mOwnerHandle;