diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-01-24 16:29:30 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-01-24 16:29:30 +0200 |
commit | e66ccae9349cf0aef1656bac4af11766a224bd79 (patch) | |
tree | 03187ecc2eddcb037339103e26ef0c3b54f4fd6d | |
parent | 211ad31dc236f868686339a9da19226b18724f20 (diff) |
SL-1932 Hide picker when not focused and update selection button's states
-rw-r--r-- | indra/newview/llsettingspicker.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llsettingspicker.h | 3 |
2 files changed, 16 insertions, 1 deletions
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<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) { 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<LLView> mOwnerHandle; |