diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 116 | ||||
-rwxr-xr-x | indra/newview/llfloaterregioninfo.h | 10 | ||||
-rw-r--r-- | indra/newview/llpanelexperiencelisteditor.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llpanelexperiencelisteditor.h | 14 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_experience_info.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_experiences.xml | 12 |
6 files changed, 125 insertions, 53 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 027815c593..0bacb0710f 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -131,6 +131,18 @@ public: const sparam_t& strings); }; +class LLDispatchSetEstateExperience : public LLDispatchHandler +{ +public: + virtual bool operator()( + const LLDispatcher* dispatcher, + const std::string& key, + const LLUUID& invoice, + const sparam_t& strings); + + LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count ); +}; + /* void unpack_request_params( @@ -457,6 +469,16 @@ LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() return panel; } +LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences() +{ + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info"); + if (!floater) return NULL; + LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels"); + return (LLPanelRegionExperiences*)tab->getChild<LLPanel>("Experiences"); +} + + + void LLFloaterRegionInfo::onTabSelected(const LLSD& param) { LLPanel* active_panel = getChild<LLPanel>(param.asString()); @@ -1376,6 +1398,11 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) static LLDispatchSetEstateAccess set_access; dispatch.addHandler(name, &set_access); + + name.assign("setexperiences"); + static LLDispatchSetEstateExperience set_experience; + dispatch.addHandler(name, &set_experience); + estate_dispatch_initialized = true; } @@ -2886,6 +2913,56 @@ bool LLDispatchSetEstateAccess::operator()( return true; } +LLSD LLDispatchSetEstateExperience::getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count ) +{ + LLSD idList = LLSD::emptyArray(); + LLUUID id; + while(count--> 0) + { + memcpy(id.mData, (*(++it)).data(), UUID_BYTES); + idList.append(id); + } + return idList; +} + +// key = "setexperience" +// strings[0] = str(estate_id) +// strings[1] = str(send_to_agent_only) +// strings[2] = str(num blocked) +// strings[3] = str(num trusted) +// strings[4] = str(num allowed) +// strings[8] = bin(uuid) ... +// ... +bool LLDispatchSetEstateExperience::operator()( + const LLDispatcher* dispatcher, + const std::string& key, + const LLUUID& invoice, + const sparam_t& strings) +{ + LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences(); + if (!panel) return true; + + sparam_t::const_iterator it = strings.begin(); + ++it; // U32 estate_id = strtol((*it).c_str(), NULL, 10); + ++it; // U32 send_to_agent_only = strtoul((*(++it)).c_str(), NULL, 10); + + LLUUID id; + S32 num_blocked = strtol((*(++it)).c_str(), NULL, 10); + S32 num_trusted = strtol((*(++it)).c_str(), NULL, 10); + S32 num_allowed = strtol((*(++it)).c_str(), NULL, 10); + + LLSD ids = LLSD::emptyMap() + .with("blocked", getIDs(it, strings.end(), num_blocked)) + .with("trusted", getIDs(it, strings.end(), num_trusted)) + .with("allowed", getIDs(it, strings.end(), num_allowed)); + + panel->processResponse(ids); + + return true; +} + + + LLPanelEnvironmentInfo::LLPanelEnvironmentInfo() : mEnableEditing(false), mRegionSettingsRadioGroup(NULL), @@ -3483,6 +3560,14 @@ BOOL LLPanelRegionExperiences::postBuild() mAllowed = setupList("panel_allowed"); mTrusted = setupList("panel_trusted"); mBlocked = setupList("panel_blocked"); + + mAllowed->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_ALLOWED_ADD, _1)); + mAllowed->setRemovedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_ALLOWED_REMOVE, _1)); + mBlocked->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_BLOCKED_ADD, _1)); + mBlocked->setRemovedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_BLOCKED_REMOVE, _1)); + mTrusted->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_TRUSTED_ADD, _1)); + mTrusted->setRemovedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_TRUSTED_REMOVE, _1)); + return LLPanelRegionInfo::postBuild(); } @@ -3498,27 +3583,11 @@ LLPanelExperienceListEditor* LLPanelRegionExperiences::setupList( const char* co } - - -boost::signals2::connection LLPanelRegionExperiences::processResponse( LLPanelExperienceListEditor* panel, boost::signals2::connection& conn, const LLSD& content ) -{ - if(conn.connected()) - { - conn.disconnect(); - } - panel->setExperienceIds(content); - - return panel->setChangedCallback(boost::bind(&LLPanelRegionExperiences::listChanged, this)); -} - - - void LLPanelRegionExperiences::processResponse( const LLSD& content ) { - mAllowedConnection=processResponse(mAllowed, mAllowedConnection, content["allowed"]); - mBlockedConnection=processResponse(mBlocked, mBlockedConnection, content["blocked"]); - mTrustedConnection=processResponse(mTrusted, mTrustedConnection, content["trusted"]); - disableButton("apply_btn"); + mAllowed->setExperienceIds(content["allowed"]); + mBlocked->setExperienceIds(content["blocked"]); + mTrusted->setExperienceIds(content["trusted"]); } @@ -3629,7 +3698,14 @@ BOOL LLPanelRegionExperiences::sendUpdate() return TRUE; } -void LLPanelRegionExperiences::listChanged() +void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id ) { + strings_t str(3, std::string()); + gAgent.getID().toString(str[0]); + str[1].swap(llformat("%u", event_type)); + id.toString(str[2]); + + why does this happen twice + sendEstateOwnerMessage(gMessageSystem, "estateexperiencedelta", LLFloaterRegionInfo::getLastInvoice(), str); onChangeAnything(); } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index d2bbcbea61..365ca9ec65 100755 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -62,6 +62,7 @@ class LLPanelEstateInfo; class LLPanelEstateCovenant; class LLPanelExperienceListEditor; class LLPanelExperiences; +class LLPanelRegionExperiences; class LLEventTimer; class LLEnvironmentSettings; @@ -92,6 +93,7 @@ public: static LLPanelEstateInfo* getPanelEstate(); static LLPanelEstateCovenant* getPanelCovenant(); static LLPanelRegionTerrainInfo* getPanelRegionTerrain(); + static LLPanelRegionExperiences* getPanelExperiences(); // from LLPanel virtual void refresh(); @@ -462,25 +464,21 @@ public: virtual BOOL sendUpdate(); static void infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content); - void listChanged(); bool refreshFromRegion(LLViewerRegion* region); void sendPurchaseRequest()const; -private: void processResponse( const LLSD& content ); - boost::signals2::connection processResponse( LLPanelExperienceListEditor* panel, boost::signals2::connection& connection, const LLSD& content); +private: void refreshRegionExperiences(); LLPanelExperienceListEditor* setupList(const char* control_name); static LLSD addIds( LLPanelExperienceListEditor* panel ); bool FilterExisting(const LLSD& experience ); + void itemChanged(U32 event_type, const LLUUID& id); LLPanelExperienceListEditor* mTrusted; - boost::signals2::connection mTrustedConnection; LLPanelExperienceListEditor* mAllowed; - boost::signals2::connection mAllowedConnection; LLPanelExperienceListEditor* mBlocked; - boost::signals2::connection mBlockedConnection; }; #endif diff --git a/indra/newview/llpanelexperiencelisteditor.cpp b/indra/newview/llpanelexperiencelisteditor.cpp index 37394936ee..a4ceb3830c 100644 --- a/indra/newview/llpanelexperiencelisteditor.cpp +++ b/indra/newview/llpanelexperiencelisteditor.cpp @@ -45,7 +45,6 @@ LLPanelExperienceListEditor::LLPanelExperienceListEditor() :mItems(NULL) ,mProfile(NULL) ,mRemove(NULL) - ,mChangedCallback(NULL) ,mReadonly(false) { } @@ -76,6 +75,13 @@ void LLPanelExperienceListEditor::addExperienceIds( const uuid_vec_t& experience { mExperienceIds.insert(experience_ids.begin(), experience_ids.end()); onItems(); + if(!mAddedCallback.empty()) + { + for(uuid_vec_t::const_iterator it = experience_ids.begin(); it != experience_ids.end(); ++it) + { + mAddedCallback(*it); + } + } } @@ -118,6 +124,7 @@ void LLPanelExperienceListEditor::onRemove() if((*it) != NULL) { mExperienceIds.erase((*it)->getValue()); + mRemovedCallback((*it)->getValue()); } } onItems(); @@ -167,10 +174,6 @@ void LLPanelExperienceListEditor::onItems() checkButtonsEnabled(); - if(mChangedCallback) - { - (*mChangedCallback)(); - } } void LLPanelExperienceListEditor::experienceDetailsCallback( LLHandle<LLPanelExperienceListEditor> panel, const LLSD& experience ) @@ -196,7 +199,6 @@ LLPanelExperienceListEditor::~LLPanelExperienceListEditor() { mPicker.get()->closeFloater(); } - delete mChangedCallback; } void LLPanelExperienceListEditor::loading() @@ -211,3 +213,13 @@ void LLPanelExperienceListEditor::setReadonly( bool val ) setCtrlsEnabled(!mReadonly); checkButtonsEnabled(); } + +boost::signals2::connection LLPanelExperienceListEditor::setAddedCallback( list_changed_signal_t::slot_type cb ) +{ + return mAddedCallback.connect(cb); +} + +boost::signals2::connection LLPanelExperienceListEditor::setRemovedCallback( list_changed_signal_t::slot_type cb ) +{ + return mRemovedCallback.connect(cb); +} diff --git a/indra/newview/llpanelexperiencelisteditor.h b/indra/newview/llpanelexperiencelisteditor.h index 4135f399ce..765db9acbc 100644 --- a/indra/newview/llpanelexperiencelisteditor.h +++ b/indra/newview/llpanelexperiencelisteditor.h @@ -39,7 +39,7 @@ class LLPanelExperienceListEditor : public LLPanel { public: - typedef boost::signals2::signal<void () > list_changed_signal_t; + typedef boost::signals2::signal<void (const LLUUID&) > list_changed_signal_t; // filter function for experiences, return true if the experience should be hidden. typedef boost::function<bool (const LLSD&)> filter_function; typedef std::vector<filter_function> filter_list; @@ -55,12 +55,9 @@ public: void addExperienceIds(const uuid_vec_t& experience_ids); void addExperience(const LLUUID& id); - - boost::signals2::connection setChangedCallback(list_changed_signal_t::slot_type cb ) - { - if (!mChangedCallback) mChangedCallback = new list_changed_signal_t(); - return mChangedCallback->connect(cb); - } + + boost::signals2::connection setAddedCallback(list_changed_signal_t::slot_type cb ); + boost::signals2::connection setRemovedCallback(list_changed_signal_t::slot_type cb ); bool getReadonly() const { return mReadonly; } void setReadonly(bool val); @@ -87,7 +84,8 @@ private: LLButton* mRemove; LLButton* mProfile; PickerHandle mPicker; - list_changed_signal_t* mChangedCallback; + list_changed_signal_t mAddedCallback; + list_changed_signal_t mRemovedCallback; LLUUID mKey; bool mReadonly; diff --git a/indra/newview/skins/default/xui/en/panel_experience_info.xml b/indra/newview/skins/default/xui/en/panel_experience_info.xml index 268e7462c1..70d8a4fc64 100644 --- a/indra/newview/skins/default/xui/en/panel_experience_info.xml +++ b/indra/newview/skins/default/xui/en/panel_experience_info.xml @@ -111,7 +111,7 @@ left="7" name="experience_description" top="0" - value="It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. " + value="" width="293"/> </layout_panel> <layout_panel diff --git a/indra/newview/skins/default/xui/en/panel_region_experiences.xml b/indra/newview/skins/default/xui/en/panel_region_experiences.xml index b7602f8fd3..57c87d197f 100644 --- a/indra/newview/skins/default/xui/en/panel_region_experiences.xml +++ b/indra/newview/skins/default/xui/en/panel_region_experiences.xml @@ -63,17 +63,5 @@ class="panel_experience_list_editor" filename="panel_experience_list_editor.xml"/> </layout_panel> - <layout_panel - height="30" - min_height="30" - max_height="30" - width="530"> - <button - layout="topleft" - width="85" - left="3" - label="Apply" - name="apply_btn"/> - </layout_panel> </layout_stack> </panel> |