From 90262889c6f559492a6f245cc389594f868a93ae Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 19 Jun 2014 01:53:27 +0100 Subject: Added list of experiences to group profile floater for ACME-1525 --- indra/newview/llpanelgroupexperiences.cpp | 135 ++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 indra/newview/llpanelgroupexperiences.cpp (limited to 'indra/newview/llpanelgroupexperiences.cpp') diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp new file mode 100644 index 0000000000..140a71a528 --- /dev/null +++ b/indra/newview/llpanelgroupexperiences.cpp @@ -0,0 +1,135 @@ +/** + * @file llpanelgroupexperiences.cpp + * @brief List of experiences owned by a group. + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelgroupexperiences.h" + +#include "lluictrlfactory.h" +#include "roles_constants.h" + +#include "llhttpclient.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llflatlistview.h" +#include "llpanelexperiences.h" +#include "llsd.h" + + +static LLPanelInjector t_panel_group_experiences("panel_group_experiences"); + + +class LLGroupExperienceResponder : public LLHTTPClient::Responder +{ +public: + LLHandle mHandle; + + LLGroupExperienceResponder(LLHandle handle) : mHandle(handle) { } + +protected: + /*virtual*/ void httpSuccess() + { + if (mHandle.isDead()) + { + return; + } + + LLPanelGroupExperiences* panel = mHandle.get(); + if (panel) + { + panel->setExperienceList(getContent().get("experience_ids")); + } + } + + /*virtual*/ void httpFailure() + { + LL_WARNS() << "experience responder failed [status:" << getStatus() << "]: " << getContent() << LL_ENDL; + } +}; + +LLPanelGroupExperiences::LLPanelGroupExperiences() +: LLPanelGroupTab(), mExperiencesList(NULL) +{ +} + +LLPanelGroupExperiences::~LLPanelGroupExperiences() +{ +} + +BOOL LLPanelGroupExperiences::postBuild() +{ + mExperiencesList = getChild("experiences_list"); + if(hasString("no_experiences")) + { + mExperiencesList->setNoItemsCommentText(getString("no_experiences")); + } + + return LLPanelGroupTab::postBuild(); +} + +void LLPanelGroupExperiences::activate() +{ + if (getGroupID() == LLUUID::null) + { + return; + } + + // search for experiences owned by the current group + std::string url = gAgent.getRegion()->getCapability("GroupExperiences"); + if (!url.empty()) + { + url += "?" + getGroupID().asString(); + + LLHTTPClient::get(url, new LLGroupExperienceResponder(getDerivedHandle())); + } +} + +void LLPanelGroupExperiences::setGroupID(const LLUUID& id) +{ + LLPanelGroupTab::setGroupID(id); + + if(id == LLUUID::null) + { + return; + } + + activate(); +} + +void LLPanelGroupExperiences::setExperienceList(const LLSD& experiences) +{ + mExperiencesList->clear(); + + LLSD::array_const_iterator it = experiences.beginArray(); + for ( /**/ ; it != experiences.endArray(); ++it) + { + LLUUID public_key = it->asUUID(); + LLExperienceItem* item = new LLExperienceItem(); + + item->init(public_key); + mExperiencesList->addItem(item, public_key); + } +} -- cgit v1.2.3 From c88b237473a75310722bac8d65a028a33a573215 Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 20 Jun 2014 04:19:45 +0100 Subject: Updated LLExperienceCache::LLExperienceResponder to work with updated LLCurl::Responder interface, to fix ACME-1532 and ACME-1525 --- indra/newview/llpanelgroupexperiences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelgroupexperiences.cpp') diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp index 140a71a528..4f8c5eb94f 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 LLHTTPClient::Responder +class LLGroupExperienceResponder : public LLCurl::Responder { public: LLHandle mHandle; -- cgit v1.2.3 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/newview/llpanelgroupexperiences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelgroupexperiences.cpp') 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; -- cgit v1.2.3 From f804bcadb18488d36a97dc1f3a9ca2e4b1f7f039 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 2 Jul 2014 01:05:52 +0100 Subject: Added 'Loading experiences...' message on experience lists before populating lists for ACME-1543 --- indra/newview/llpanelgroupexperiences.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelgroupexperiences.cpp') diff --git a/indra/newview/llpanelgroupexperiences.cpp b/indra/newview/llpanelgroupexperiences.cpp index 140a71a528..76b68122fb 100644 --- a/indra/newview/llpanelgroupexperiences.cpp +++ b/indra/newview/llpanelgroupexperiences.cpp @@ -82,7 +82,11 @@ LLPanelGroupExperiences::~LLPanelGroupExperiences() BOOL LLPanelGroupExperiences::postBuild() { mExperiencesList = getChild("experiences_list"); - if(hasString("no_experiences")) + if (hasString("loading_experiences")) + { + mExperiencesList->setNoItemsCommentText(getString("loading_experiences")); + } + else if (hasString("no_experiences")) { mExperiencesList->setNoItemsCommentText(getString("no_experiences")); } @@ -121,6 +125,10 @@ void LLPanelGroupExperiences::setGroupID(const LLUUID& id) void LLPanelGroupExperiences::setExperienceList(const LLSD& experiences) { + if (hasString("no_experiences")) + { + mExperiencesList->setNoItemsCommentText(getString("no_experiences")); + } mExperiencesList->clear(); LLSD::array_const_iterator it = experiences.beginArray(); -- cgit v1.2.3