diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llsettingspicker.cpp | 96 | ||||
-rw-r--r-- | indra/newview/llsettingspicker.h | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_settings_picker.xml | 40 |
6 files changed, 124 insertions, 34 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 601b964410..d6c104547d 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1823,7 +1823,7 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ if (!picker) { picker = new LLFloaterSettingsPicker(this, - LLUUID::null, "SELECT SETTINGS"); + LLUUID::null); mInventoryFloater = picker->getHandle(); @@ -1834,6 +1834,7 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ picker->setSettingsItemId(curritem); picker->openFloater(); picker->setFocus(TRUE); + picker->setTrackWater(mCurrentTrack == LLSettingsDay::TRACK_WATER); } void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 98cec04898..ce231973c7 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -239,7 +239,7 @@ LLFloaterSettingsPicker * LLFloaterFixedEnvironment::getSettingsPicker() if (!picker) { picker = new LLFloaterSettingsPicker(this, - LLUUID::null, "SELECT SETTINGS"); + LLUUID::null); mInventoryFloater = picker->getHandle(); diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index ec6352c88d..000c7050ab 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -334,7 +334,7 @@ LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) if (!picker && create) { picker = new LLFloaterSettingsPicker(this, - LLUUID::null, "SELECT SETTINGS"); + LLUUID::null); mSettingsFloater = picker->getHandle(); diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index d2824e04a9..a155906415 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -37,6 +37,7 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" +#include "llsettingsvo.h" #include "lldraghandle.h" #include "llviewercontrol.h" @@ -57,16 +58,25 @@ namespace const F32 CONTEXT_CONE_IN_ALPHA(0.0f); const F32 CONTEXT_CONE_OUT_ALPHA(1.0f); const F32 CONTEXT_FADE_TIME(0.08f); + + // strings in xml + + const std::string STR_TITLE_PREFIX = "pick title"; + const std::string STR_TITLE_TRACK = "pick_track"; + const std::string STR_TITLE_SETTINGS = "pick_settings"; + const std::string STR_TRACK_WATER = "track_water"; + const std::string STR_TRACK_GROUND = "track_ground"; + const std::string STR_TRACK_SKY = "track_sky"; } //========================================================================= -LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_item_id, const std::string &label, const LLSD ¶ms): +LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_item_id, const LLSD ¶ms): LLFloater(params), mOwnerHandle(), - mLabel(label), mActive(true), mContextConeOpacity(0.0f), mSettingItemID(initial_item_id), + mTrackWater(true), mImmediateFilterPermMask(PERM_NONE) { mOwnerHandle = owner->getHandle(); @@ -87,12 +97,9 @@ BOOL LLFloaterSettingsPicker::postBuild() if (!LLFloater::postBuild()) return FALSE; - if (!mLabel.empty()) - { - std::string pick = getString("pick title"); - - setTitle(pick + mLabel); - } + std::string prefix = getString(STR_TITLE_PREFIX); + std::string label = getString(STR_TITLE_SETTINGS); + setTitle(prefix + " " + label); mFilterEdit = getChild<LLFilterEditor>(FLT_INVENTORY_SEARCH); mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param){ onFilterEdit(param.asString()); }); @@ -165,7 +172,20 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) filter = static_cast<S64>(0x1) << static_cast<S64>(type); } - getChild<LLPanel>(PNL_COMBO)->setVisible(type != LLSettingsType::ST_WATER && type != LLSettingsType::ST_SKY); + bool day_cycle = (type != LLSettingsType::ST_WATER) && (type != LLSettingsType::ST_SKY); + getChild<LLPanel>(PNL_COMBO)->setVisible(day_cycle); + std::string prefix = getString(STR_TITLE_PREFIX); + std::string label; + if (day_cycle) + { + + label = getString(STR_TITLE_TRACK); + } + else + { + label = getString(STR_TITLE_SETTINGS); + } + setTitle(prefix + " " + label); mInventoryPanel->setFilterSettingsTypes(filter); } @@ -269,6 +289,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; + LLUUID asset_id; if (items.size()) { LLFolderViewItem* first_item = items.front(); @@ -284,6 +305,7 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i mNoCopySettingsSelected = true; } setSettingsItemId(bridge_model->getItem()->getUUID(), false); + asset_id = bridge_model->getItem()->getAssetUUID(); mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? if (user_action) @@ -299,7 +321,61 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i } } } - getChild<LLView>(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled); + getChild<LLView>(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled && mSettingAssetID == asset_id); + if (track_picker_enabled && asset_id.notNull() && mSettingAssetID != asset_id) + { + LLUUID item_id = mSettingItemID; + LLHandle<LLFloater> handle = getHandle(); + LLSettingsVOBase::getSettingsAsset(asset_id, + [item_id, handle](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { LLFloaterSettingsPicker::onAssetLoadedCb(handle, item_id, asset_id, settings, status); }); + } +} + +void LLFloaterSettingsPicker::onAssetLoadedCb(LLHandle<LLFloater> handle, LLUUID item_id, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) +{ + if (handle.isDead() || status) + { + return; + } + + LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(handle.get()); + + if (picker->mSettingItemID != item_id) + { + return; + } + + picker->onAssetLoaded(asset_id, settings); +} + +void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings) +{ + LLComboBox* track_selection = getChild<LLComboBox>(CMB_TRACK_SELECTION); + track_selection->clear(); + track_selection->removeall(); + LLSettingsDay::ptr_t pday = std::dynamic_pointer_cast<LLSettingsDay>(settings); + + if (mTrackWater) + { + track_selection->add(getString(STR_TRACK_WATER), LLSD::Integer(LLSettingsDay::TRACK_WATER), ADD_TOP, true); + } + else + { + // track 1 always present + track_selection->add(getString(STR_TRACK_GROUND), LLSD::Integer(LLSettingsDay::TRACK_GROUND_LEVEL), ADD_TOP, true); + LLUIString formatted_label = getString(STR_TRACK_SKY); + for (int i = 2; i < LLSettingsDay::TRACK_MAX; i++) + { + if (!pday->isTrackEmpty(i)) + { + formatted_label.setArg("[NUM]", llformat("%d", i)); + track_selection->add(formatted_label.getString(), LLSD::Integer(i), ADD_TOP, true); + } + } + } + + mSettingAssetID = asset_id; + track_selection->setEnabled(true); } void LLFloaterSettingsPicker::onButtonCancel() diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 5acc562fe5..13ee90f0fe 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -33,6 +33,7 @@ #include "llpermissionsflags.h" #include "llfolderview.h" #include "llinventory.h" +#include "llsettingsdaycycle.h" #include <boost/signals2.hpp> @@ -48,7 +49,7 @@ public: typedef std::function<void()> close_callback_t; typedef std::function<void(const LLUUID& item_id)> id_changed_callback_t; - LLFloaterSettingsPicker(LLView * owner, LLUUID setting_item_id, const std::string &label, const LLSD ¶ms = LLSD()); + LLFloaterSettingsPicker(LLView * owner, LLUUID setting_item_id, const LLSD ¶ms = LLSD()); virtual ~LLFloaterSettingsPicker() override; @@ -64,6 +65,10 @@ public: void setSettingsFilter(LLSettingsType::type_e type); LLSettingsType::type_e getSettingsFilter() const { return mSettingsType; } + // Only for day cycle + void setTrackWater(bool use_water) { mTrackWater = use_water; } + void setTrackSky(bool use_sky) { mTrackWater = !use_sky; } + // Takes a UUID, wraps get/setImageAssetID virtual void setValue(const LLSD& value) override; virtual LLSD getValue() const override; @@ -86,11 +91,14 @@ public: static LLInventoryItem * findItem(const LLUUID& asset_id, bool copyable_only, bool ignore_library); + private: typedef std::deque<LLFolderViewItem *> itemlist_t; void onFilterEdit(const std::string& search_string); void onSelectionChange(const itemlist_t &items, bool user_action); + static void onAssetLoadedCb(LLHandle<LLFloater> handle, LLUUID item_id, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); + void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings); void onButtonCancel(); void onButtonSelect(); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; @@ -98,8 +106,9 @@ private: LLHandle<LLView> mOwnerHandle; - std::string mLabel; - LLUUID mSettingItemID; + LLUUID mSettingItemID; + LLUUID mSettingAssetID; + bool mTrackWater; LLFilterEditor * mFilterEdit; LLInventoryPanel * mInventoryPanel; diff --git a/indra/newview/skins/default/xui/en/floater_settings_picker.xml b/indra/newview/skins/default/xui/en/floater_settings_picker.xml index 9ea949088f..55a1b540b4 100644 --- a/indra/newview/skins/default/xui/en/floater_settings_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_settings_picker.xml @@ -17,6 +17,27 @@ name="pick title"> Pick: </floater.string> + <floater.string + name="pick_track"> + SELECT TRACK + </floater.string> + <floater.string + name="pick_settings"> + SELECT SETTINGS + </floater.string> + + <floater.string + name="track_water"> + Water + </floater.string> + <floater.string + name="track_ground"> + Ground + </floater.string> + <floater.string + name="track_sky"> + Sky[NUM] + </floater.string> <layout_stack name="test_stack" follows="all" @@ -85,24 +106,7 @@ mouse_opaque="true" name="track_selection" top="1" - width="190"> - <combo_box.item - label="Sky4" - name="Sky4" - value="4" /> - <combo_box.item - label="Sky3" - name="Sky3" - value="3" /> - <combo_box.item - label="Sky2" - name="Sky2" - value="2" /> - <combo_box.item - label="Ground" - name="Ground" - value="1" /> - </combo_box> + width="190"/> </layout_panel> <layout_panel name="temp" border="false" |