From 200788c344f5449f99eacc9167ac15c7e6262b69 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 24 Jun 2014 22:43:23 +0100 Subject: Updated all experience responders for LLCurl::Responder interface changes for ACME-1535 and ACME-1536 --- indra/llmessage/llexperiencecache.cpp | 4 ++-- indra/newview/llcompilequeue.cpp | 6 +++--- indra/newview/llexperienceassociationresponder.cpp | 14 +++++++------- indra/newview/llexperienceassociationresponder.h | 4 ++-- indra/newview/llfloaterexperienceprofile.cpp | 18 +++++++++--------- indra/newview/llfloaterexperiences.cpp | 2 +- indra/newview/llfloaterregioninfo.cpp | 2 +- indra/newview/llpanelexperiencepicker.cpp | 2 +- indra/newview/llpanelgroupexperiences.cpp | 2 +- indra/newview/llpreviewscript.cpp | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 1fb77c4391..52b60a176e 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -257,7 +257,7 @@ namespace LLExperienceCache LLSDSerialize::toPrettyXML(data, ostr); } - class LLExperienceResponder : public LLCurl::Responder + class LLExperienceResponder : public LLHTTPClient::Responder { public: LLExperienceResponder(const ask_queue_t& keys) @@ -266,7 +266,7 @@ namespace LLExperienceCache } - /*virtual*/ void httpSuccess() + /*virtual*/ void httpCompleted() { LLSD experiences = getContent()["experience_keys"]; LLSD::array_const_iterator it = experiences.beginArray(); diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 9e554ba0eb..d9fd4509a5 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -251,11 +251,11 @@ public: LLUUID mParent; - virtual void result(const LLSD& content) + /*virtual*/ void httpSuccess() { - sendResult(content); + sendResult(getContent()); } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void httpFailure() { sendResult(LLSD()); } diff --git a/indra/newview/llexperienceassociationresponder.cpp b/indra/newview/llexperienceassociationresponder.cpp index 33ada4906d..b50c81eedc 100644 --- a/indra/newview/llexperienceassociationresponder.cpp +++ b/indra/newview/llexperienceassociationresponder.cpp @@ -61,19 +61,19 @@ void ExperienceAssociationResponder::fetchAssociatedExperience(LLSD& request, ca } } -void ExperienceAssociationResponder::error( U32 status, const std::string& reason ) +void ExperienceAssociationResponder::httpFailure() { LLSD msg; - msg["error"]=(LLSD::Integer)status; - msg["message"]=reason; - LL_INFOS("ExperienceAssociation") << "Failed to look up associated experience: " << status << ": " << reason << LL_ENDL; + msg["error"]=(LLSD::Integer)getStatus(); + msg["message"]=getReason(); + LL_INFOS("ExperienceAssociation") << "Failed to look up associated experience: " << getStatus() << ": " << getReason() << LL_ENDL; sendResult(msg); } -void ExperienceAssociationResponder::result( const LLSD& content ) +void ExperienceAssociationResponder::httpSuccess() { - if(!content.has("experience")) + if(!getContent().has("experience")) { LLSD msg; @@ -83,7 +83,7 @@ void ExperienceAssociationResponder::result( const LLSD& content ) return; } - LLExperienceCache::get(content["experience"].asUUID(), boost::bind(&ExperienceAssociationResponder::sendResult, this, _1)); + LLExperienceCache::get(getContent()["experience"].asUUID(), boost::bind(&ExperienceAssociationResponder::sendResult, this, _1)); } diff --git a/indra/newview/llexperienceassociationresponder.h b/indra/newview/llexperienceassociationresponder.h index 8ff62a3dbc..2bdc3d251b 100644 --- a/indra/newview/llexperienceassociationresponder.h +++ b/indra/newview/llexperienceassociationresponder.h @@ -41,8 +41,8 @@ public: ExperienceAssociationResponder(callback_t callback); - virtual void result(const LLSD& content); - virtual void error(U32 status, const std::string& reason); + /*virtual*/ void httpSuccess(); + /*virtual*/ void httpFailure(); static void fetchAssociatedExperience(const LLUUID& object_it, const LLUUID& item_id, callback_t callback); diff --git a/indra/newview/llfloaterexperienceprofile.cpp b/indra/newview/llfloaterexperienceprofile.cpp index f80fdd9cfe..764d9088a1 100644 --- a/indra/newview/llfloaterexperienceprofile.cpp +++ b/indra/newview/llfloaterexperienceprofile.cpp @@ -138,9 +138,9 @@ public: HandleResponder(const LLHandle& parent):mParent(parent){} LLHandle mParent; - virtual void error(U32 status, const std::string& reason) + virtual void httpFailure() { - LL_WARNS() << "HandleResponder failed with code: " << status<< ", reason: " << reason << LL_ENDL; + LL_WARNS() << "HandleResponder failed with code: " << getStatus() << ", reason: " << getReason() << LL_ENDL; } }; @@ -151,12 +151,12 @@ public: { } - virtual void result(const LLSD& content) + virtual void httpSuccess() { LLFloaterExperienceProfile* parent=mParent.get(); if(parent) { - parent->onSaveComplete(content); + parent->onSaveComplete(getContent()); } } }; @@ -225,14 +225,14 @@ public: } - virtual void result(const LLSD& content) + virtual void httpSuccess() { if(mId.notNull()) { - post(getPermission(content)); + post(getPermission(getContent())); return; } - LLEventPumps::instance().obtain("experience_permission").post(content); + LLEventPumps::instance().obtain("experience_permission").post(getContent()); } void post( const char* perm ) @@ -257,7 +257,7 @@ public: { } - virtual void result(const LLSD& content) + virtual void httpSuccess() { LLFloaterExperienceProfile* parent = mParent.get(); if(!parent) @@ -275,7 +275,7 @@ public: if(url.empty()) enabled = false; } - if(enabled && content["status"].asBoolean()) + if(enabled && getContent()["status"].asBoolean()) { parent->getChild(PNL_TOP)->setVisible(TRUE); parent->getChild(BTN_EDIT)->setVisible(TRUE); diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index 98b26f5ac9..ac79c9ab43 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -43,7 +43,7 @@ #define SHOW_RECENT_TAB (0) -class LLExperienceListResponder : public LLCurl::Responder +class LLExperienceListResponder : public LLHTTPClient::Responder { public: typedef std::map NameMap; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 487610b797..f70152fc59 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3620,7 +3620,7 @@ void LLPanelRegionExperiences::processResponse( const LLSD& content ) } -class LLRegionExperienceResponder : public LLCurl::Responder +class LLRegionExperienceResponder : public LLHTTPClient::Responder { public: typedef boost::function callback_t; diff --git a/indra/newview/llpanelexperiencepicker.cpp b/indra/newview/llpanelexperiencepicker.cpp index 3a55295d8c..0a572a8a5c 100644 --- a/indra/newview/llpanelexperiencepicker.cpp +++ b/indra/newview/llpanelexperiencepicker.cpp @@ -57,7 +57,7 @@ const static std::string columnSpace = " "; static LLPanelInjector t_panel_status("llpanelexperiencepicker"); -class LLExperienceSearchResponder : public LLCurl::Responder +class LLExperienceSearchResponder : public LLHTTPClient::Responder { public: LLUUID mQueryID; diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp index 4f8c5eb94f..140a71a528 100644 --- a/indra/newview/llpanelgroupexperiences.cpp +++ b/indra/newview/llpanelgroupexperiences.cpp @@ -42,7 +42,7 @@ static LLPanelInjector t_panel_group_experiences("panel_group_experiences"); -class LLGroupExperienceResponder : public LLCurl::Responder +class LLGroupExperienceResponder : public LLHTTPClient::Responder { public: LLHandle mHandle; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 780c41172d..1732d4b3e5 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -123,7 +123,7 @@ static bool have_script_upload_cap(LLUUID& object_id) } -class ExperienceResponder : public LLCurl::Responder +class ExperienceResponder : public LLHTTPClient::Responder { public: ExperienceResponder(const LLHandle& parent):mParent(parent) -- cgit v1.2.3 From 9b6598388a5fa085d89b77b57f0b361d53a680cb Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 25 Jun 2014 22:11:31 +0100 Subject: Disable About Land Experiences tab when parcel is not selected, for ACME-1528 --- indra/newview/llfloaterland.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 8d2d29ace1..4fda1ebb7d 100755 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3012,21 +3012,31 @@ void LLPanelLandExperiences::refreshPanel(LLPanelExperienceListEditor* panel, U3 LLParcel *parcel = mParcel->getParcel(); // Display options - if (parcel == NULL || panel == NULL) + if (panel == NULL) { return; } - - LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type); - LLAccessEntry::map::iterator it = entries.begin(); - LLSD ids = LLSD::emptyArray(); - for (/**/; it != entries.end(); ++it) + if (parcel == NULL) + { + // disable the panel + panel->setEnabled(FALSE); + panel->setExperienceIds(LLSD::emptyArray()); + } + else { - ids.append(it->second.mID); + // enable the panel + panel->setEnabled(TRUE); + LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type); + LLAccessEntry::map::iterator it = entries.begin(); + LLSD ids = LLSD::emptyArray(); + for (/**/; it != entries.end(); ++it) + { + ids.append(it->second.mID); + } + panel->setExperienceIds(ids); + panel->setReadonly(!LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS)); + panel->refreshExperienceCounter(); } - panel->setExperienceIds(ids); - panel->setReadonly(!LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS)); - panel->refreshExperienceCounter(); } void LLPanelLandExperiences::refresh() -- cgit v1.2.3 From f80a41cf36f023aa0b5a7368d81dd237dafc8d4a Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 27 Jun 2014 01:02:44 +0100 Subject: Sort experiences in list alphabetically by name for ACME-1537 --- indra/newview/llpanelexperiences.cpp | 43 ++++++++++++++++++++++++++++++++++-- indra/newview/llpanelexperiences.h | 12 ++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelexperiences.cpp b/indra/newview/llpanelexperiences.cpp index 0d67dbf916..2885ef9305 100644 --- a/indra/newview/llpanelexperiences.cpp +++ b/indra/newview/llpanelexperiences.cpp @@ -38,9 +38,13 @@ #include "lllayoutstack.h" + static LLPanelInjector register_experiences_panel("experiences_panel"); +//comparators +static const LLExperienceItemComparator NAME_COMPARATOR; + LLPanelExperiences::LLPanelExperiences( ) : mExperiencesList(NULL) { @@ -54,6 +58,7 @@ BOOL LLPanelExperiences::postBuild( void ) { mExperiencesList->setNoItemsCommentText(getString("no_experiences")); } + mExperiencesList->setComparator(&NAME_COMPARATOR); return TRUE; } @@ -81,6 +86,8 @@ void LLPanelExperiences::setExperienceList( const LLSD& experiences ) item->init(public_key); mExperiencesList->addItem(item, public_key); } + + mExperiencesList->sort(); } LLPanelExperiences* LLPanelExperiences::create(const std::string& name) @@ -112,6 +119,7 @@ void LLPanelExperiences::addExperience( const LLUUID& id ) item->init(id); mExperiencesList->addItem(item, id); + mExperiencesList->sort(); } } @@ -137,21 +145,32 @@ void LLPanelExperiences::enableButton( bool enable ) LLExperienceItem::LLExperienceItem() + : mName(NULL) { buildFromFile("panel_experience_list_item.xml"); } void LLExperienceItem::init( const LLUUID& id) { - getChild("experience_name")->setValue(LLSLURL("experience", id, "profile").getSLURLString()); + mName = getChild("experience_name"); + mName->setValue(LLSLURL("experience", id, "profile").getSLURLString()); } - LLExperienceItem::~LLExperienceItem() { } +std::string LLExperienceItem::getExperienceName() const +{ + if (mName) + { + return mName->getValue(); + } + + return ""; +} + void LLPanelSearchExperiences::doSearch() { @@ -169,3 +188,23 @@ BOOL LLPanelSearchExperiences::postBuild( void ) childSetAction("search_button", boost::bind(&LLPanelSearchExperiences::doSearch, this)); return TRUE; } + +bool LLExperienceItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const +{ + const LLExperienceItem* experience_item1 = dynamic_cast(item1); + const LLExperienceItem* experience_item2 = dynamic_cast(item2); + + if (!experience_item1 || !experience_item2) + { + LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL; + return true; + } + + std::string name1 = experience_item1->getExperienceName(); + std::string name2 = experience_item2->getExperienceName(); + + LLStringUtil::toUpper(name1); + LLStringUtil::toUpper(name2); + + return name1 < name2; +} diff --git a/indra/newview/llpanelexperiences.h b/indra/newview/llpanelexperiences.h index c525b1f548..0370499583 100644 --- a/indra/newview/llpanelexperiences.h +++ b/indra/newview/llpanelexperiences.h @@ -71,6 +71,16 @@ private: LLFlatListView* mExperiencesList; }; +class LLExperienceItemComparator : public LLFlatListView::ItemComparator +{ + LOG_CLASS(LLExperienceItemComparator); + +public: + LLExperienceItemComparator() {}; + virtual ~LLExperienceItemComparator() {}; + + virtual bool compare(const LLPanel* item1, const LLPanel* item2) const; +}; class LLExperienceItem : public LLPanel @@ -80,6 +90,8 @@ public: ~LLExperienceItem(); void init(const LLUUID& experience_id); + std::string getExperienceName() const; protected: + LLUICtrl* mName; }; #endif // LL_LLPANELEXPERIENCES_H -- cgit v1.2.3