From e66ccae9349cf0aef1656bac4af11766a224bd79 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 24 Jan 2019 16:29:30 +0200 Subject: SL-1932 Hide picker when not focused and update selection button's states --- indra/newview/llsettingspicker.cpp | 14 ++++++++++++++ indra/newview/llsettingspicker.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index a155906415..7aa9cf0ae8 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -128,6 +128,7 @@ BOOL LLFloaterSettingsPicker::postBuild() //todo: this is bad idea mInventoryPanel->setSelection(mSettingItemID, TAKE_FOCUS_NO); } + getChild(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(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled && mSettingAssetID == asset_id); + getChild(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(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) { diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 13ee90f0fe..941fe752b0 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -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 mOwnerHandle; -- cgit v1.2.3