BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain()
{
	LLUUID region_id;

	LLFloaterLand* instance = LLFloaterLand::getInstance();
	if(!instance)
	{
		getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));
		//might have to do parent post build here
		//if not logic below could use early outs
		return FALSE;
	}
	LLParcel* parcel = instance->getCurrentSelectedParcel();
	LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();

	LLUUID current_region_id = gAgent.getRegion()->getRegionID();

	// <alchemy> Fall back to the parcel we're on if none is selected.
	// Fixes parcel script info intermittently working and broken in toolbar button.
	if (!parcel)
	{
		parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
		region = gAgent.getRegion();
	}
	// </alchemy>

	if ((region) && (parcel))
	{
		LLVector3 parcel_center = parcel->getCenterpoint();

		region_id = region->getRegionID();

		if(region_id != current_region_id)
		{
			std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion");
			getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region));
			return FALSE;
		}

		LLVector3d pos_global = region->getCenterGlobal();

		LLSD body;
		std::string url = region->getCapability("RemoteParcelRequest");
		if (!url.empty())
		{
			body["location"] = ll_sd_from_vector3(parcel_center);
			if (!region_id.isNull())
			{
				body["region_id"] = region_id;
			}
			if (!pos_global.isExactlyZero())
			{
				U64 region_handle = to_region_handle(pos_global);
				body["region_handle"] = ll_sd_from_U64(region_handle);
			}
			LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle()));
		}
		else
		{
			LL_WARNS() << "Can't get parcel info for script information request" << region_id
					<< ". Region: "	<< region->getName()
					<< " does not support RemoteParcelRequest" << LL_ENDL;

			std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError");
			getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
		}
	}
	else
	{
		std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected");
		getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
	}

	return LLPanelScriptLimitsInfo::postBuild();
}
Esempio n. 2
0
LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) : 
	LLFloater(LLSD()),
	mVarType(var_type), mVarData(var), mAnimate(FALSE)
{
	setRect(LLRect(10,160,400,10));
	
	LLSliderCtrl::Params slider_p;
	slider_p.label(title);
	slider_p.label_width(70);
	slider_p.text_width(40);
	slider_p.can_edit_text(true);
	slider_p.show_text(true);

	mSlider1 = NULL;
	mSlider2 = NULL;
	mSlider3 = NULL;

	switch(var_type)
	{
	case VAR_TYPE_F32:
		slider_p.name("slider 1");
		slider_p.rect(LLRect(20,130,190,110));
		slider_p.initial_value(*((F32*)var));
		slider_p.min_value(-100.f);
		slider_p.max_value(100.f);
		slider_p.increment(0.1f);
		slider_p.decimal_digits(3);
		mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
		addChild(mSlider1);
		break;
	case VAR_TYPE_S32:
		slider_p.name("slider 1");
		slider_p.rect(LLRect(20,100,190,80));
		slider_p.initial_value((F32)*((S32*)var));
		slider_p.min_value(-255.f);
		slider_p.max_value(255.f);
		slider_p.increment(1.f);
		slider_p.decimal_digits(0);
		mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);
		addChild(mSlider1);
		break;
	case VAR_TYPE_VEC3:
		slider_p.name("slider 1");
		slider_p.label("x: ");
		slider_p.rect(LLRect(20,130,190,110));
		slider_p.initial_value(((LLVector3*)var)->mV[VX]);
		slider_p.min_value(-100.f);
		slider_p.max_value(100.f);
		slider_p.increment(0.1f);
		slider_p.decimal_digits(3);
		mSlider1 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);

		slider_p.name("slider 2");
		slider_p.label("y: ");
		slider_p.rect(LLRect(20,100,190,80));
		slider_p.initial_value(((LLVector3*)var)->mV[VY]);
		mSlider2 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);

		slider_p.name("slider 3");
		slider_p.label("z: ");
		slider_p.rect(LLRect(20,70,190,50));
		slider_p.initial_value(((LLVector3*)var)->mV[VZ]);
		mSlider2 = LLUICtrlFactory::create<LLSliderCtrl>(slider_p);

		addChild(mSlider1);
		addChild(mSlider2);
		addChild(mSlider3);
		break;
	default:
		llwarns << "Unhandled var type " << var_type << llendl;
		break;
	}

	LLButton::Params p;
	p.name(std::string("Animate"));
	p.label(std::string("Animate"));
	p.rect(LLRect(20, 45, 180, 25));
	p.click_callback.function(boost::bind(&LLDebugVarMessageBox::onAnimateClicked, this, _2));
	mAnimateButton = LLUICtrlFactory::create<LLButton>(p);
	addChild(mAnimateButton);

	LLTextBox::Params params;
	params.name("value");
	params.initial_value(params.name());
	params.rect(LLRect(20,20,190,0));
	mText = LLUICtrlFactory::create<LLTextBox> (params);
	addChild(mText);

	//disable hitting enter closes dialog
	setDefaultBtn();
}
Esempio n. 3
0
#define DECL_LLCC(T, V) static LLCachedControl<T> mySetting_##T("TestCachedControl"#T, V)
DECL_LLCC(U32, (U32)666);
DECL_LLCC(S32, (S32)-666);
DECL_LLCC(F32, (F32)-666.666);
DECL_LLCC(bool, true);
DECL_LLCC(BOOL, FALSE);
static LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value");
DECL_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
DECL_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
DECL_LLCC(LLRect, LLRect(0, 0, 100, 500));
DECL_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f));
DECL_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f));
DECL_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255));

LLSD test_llsd = LLSD()["testing1"] = LLSD()["testing2"];
DECL_LLCC(LLSD, test_llsd);

static LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hahahahahha", "Not the real comment");

void test_cached_control()
{
#define TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl
	TEST_LLCC(U32, 666);
	TEST_LLCC(S32, (S32)-666);
	TEST_LLCC(F32, (F32)-666.666);
	TEST_LLCC(bool, true);
	TEST_LLCC(BOOL, FALSE);
	if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl;
	TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f));
	TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f));
void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
{
	LLPanelGroupTab::setGroupID(id);
	// <FS> Get group key display and copy URI/name button pointers
	LLTextEditor* groupKeyEditor = getChild<LLTextEditor>("group_key");
	LLButton* copyURIButton = getChild<LLButton>("copy_uri");
	LLButton* copyNameButton = getChild<LLButton>("copy_name");
	// happens when a new group is created
	// </FS>
	if(id == LLUUID::null)
	{
		// <FS>
		if (groupKeyEditor)
			groupKeyEditor->setValue(LLSD());

		if (copyURIButton)
			copyURIButton->setEnabled(FALSE);

		if (copyNameButton)
			copyNameButton->setEnabled(FALSE);
		// </FS>

		reset();
		return;
	}
	// <FS>
	// fill in group key
	if (groupKeyEditor)
		groupKeyEditor->setValue(id.asString());

	// activate copy URI button
	if (copyURIButton)
		copyURIButton->setEnabled(TRUE);
	// </FS>

	BOOL accept_notices = FALSE;
	BOOL list_in_profile = FALSE;
	LLGroupData data;
	if(gAgent.getGroupData(mGroupID,data))
	{
		accept_notices = data.mAcceptNotices;
		list_in_profile = data.mListInProfile;
	}
	mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices");
	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->set(accept_notices);
		mCtrlReceiveNotices->setEnabled(data.mID.notNull());
	}
	
	mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile");
	if (mCtrlListGroup)
	{
		mCtrlListGroup->set(list_in_profile);
		mCtrlListGroup->setEnabled(data.mID.notNull());
	}

	// <exodus>
	mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat");
	if (mCtrlReceiveGroupChat)
	{
		if(data.mID.notNull())
		{
			mCtrlReceiveGroupChat->set(!exoGroupMuteList::instance().isMuted(data.mID));
		}
		mCtrlReceiveGroupChat->setEnabled(data.mID.notNull());
	}
	// </exodus>

	mCtrlShowInGroupList->setEnabled(data.mID.notNull());

	mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
	
	mComboActiveTitle = getChild<LLComboBox>("active_title");

	mFounderName->setVisible(true);

	mInsignia->setImageAssetID(LLUUID::null);

	resetDirty();

	activate();
}
Esempio n. 5
0
// static
LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
{
	// in case we know the last floater that got focus, return this immediately.
	if (sActiveInventoryPanel)
		return sActiveInventoryPanel;

	S32 z_min = S32_MAX;
	LLInventoryPanel* res = NULL;
	LLFloater* active_inv_floaterp = NULL;

	// A. If the inventory side panel is open, use that preferably.
	if (is_inventorysp_active())
	{
		LLSidepanelInventory *inventorySP = dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
		if (inventorySP)
		{
			return inventorySP->getActivePanel();
		}
	}
	// or if it is in floater undocked from sidetray get it and remember z order of floater to later compare it
	// with other inventory floaters order.
	else if (!LLSideTray::getInstance()->isTabAttached("sidebar_inventory"))
	{
		LLSidepanelInventory *inventorySP =
			dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
		LLFloater* inv_floater = LLFloaterReg::findInstance("side_bar_tab", LLSD("sidebar_inventory"));
		if (inventorySP && inv_floater)
		{
			res = inventorySP->getActivePanel();
			z_min = gFloaterView->getZOrder(inv_floater);
			active_inv_floaterp = inv_floater;
		}
		else
		{
			llwarns << "Inventory tab is detached from sidetray, but  either panel or floater were not found!" << llendl;
		}
	}
	
	// B. Iterate through the inventory floaters and return whichever is on top.
	LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
	for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
	{
		LLFloaterInventory* iv = dynamic_cast<LLFloaterInventory*>(*iter);
		if (iv && iv->getVisible())
		{
			S32 z_order = gFloaterView->getZOrder(iv);
			if (z_order < z_min)
			{
				res = iv->getPanel();
				z_min = z_order;
				active_inv_floaterp = iv;
			}
		}
	}

	if (res)
	{
		// Make sure the floater is not minimized (STORM-438).
		if (active_inv_floaterp && active_inv_floaterp->isMinimized())
			active_inv_floaterp->setMinimized(FALSE);

		return res;
	}
		
	// C. If no panels are open and we don't want to force open a panel, then just abort out.
	if (!auto_open) return NULL;
	
	// D. Open the inventory side panel and use that.
    LLSD key;
	LLSidepanelInventory *sidepanel_inventory =
		dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->showPanel("sidepanel_inventory", key));
	if (sidepanel_inventory)
	{
		return sidepanel_inventory->getActivePanel();
	}

	return NULL;
}
LLFloaterChatterBox* LLIMMgr::getFloater()
{ 
	return LLFloaterChatterBox::getInstance(LLSD()); 
}
BOOL LLIMMgr::getFloaterOpen()
{
	return LLFloaterChatterBox::instanceVisible(LLSD());
}
Esempio n. 8
0
bool LLFlatListView::removeItemByUUID(const LLUUID& uuid, bool rearrange)
{
	return removeItemByValue(LLSD(uuid), rearrange);
}
Esempio n. 9
0
bool LLFlatListView::selectItemByUUID(const LLUUID& uuid, bool select /* = true*/)
{
	return selectItemByValue(LLSD(uuid), select);
}
Esempio n. 10
0
 * 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 "linden_common.h"

#include "llpanel.h"
#include "lltextbox.h"

#include "llflatlistview.h"

static const LLDefaultChildRegistry::Register<LLFlatListView> flat_list_view("flat_list_view");

const LLSD SELECTED_EVENT	= LLSD().with("selected", true);
const LLSD UNSELECTED_EVENT	= LLSD().with("selected", false);

//forward declaration
bool llsds_are_equal(const LLSD& llsd_1, const LLSD& llsd_2);

LLFlatListView::Params::Params()
:	item_pad("item_pad"),
	allow_select("allow_select"),
	multi_select("multi_select"),
	keep_one_selected("keep_one_selected"),
	keep_selection_visible_on_reshape("keep_selection_visible_on_reshape",false),
	no_items_text("no_items_text")
{};

void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
Esempio n. 11
0
void LLFlatListView::detachItems(std::vector<LLPanel*>& detached_items)
{
	LLSD action;
	action.with("detach", LLSD());
	// Clear detached_items list
	detached_items.clear();
	// Go through items and detach valid items, remove them from items panel
	// and add to detached_items.
	for (pairs_iterator_t
			 iter = mItemPairs.begin(),
			 iter_end = mItemPairs.end();
		 iter != iter_end; ++iter)
	{
		LLPanel* pItem = (*iter)->first;
		if (1 == pItem->notify(action))
		{
			selectItemPair((*iter), false);
			mItemsPanel->removeChild(pItem);
			detached_items.push_back(pItem);
		}
	}
	if (!detached_items.empty())
	{
		// Some items were detached, clean ourself from unusable memory
		if (detached_items.size() == mItemPairs.size())
		{
			// This way will be faster if all items were disconnected
			for (pairs_iterator_t
					 iter = mItemPairs.begin(),
					 iter_end = mItemPairs.end();
				 iter != iter_end; ++iter)
			{
				(*iter)->first = NULL;
				delete *iter;
			}
			mItemPairs.clear();
			// Also set items panel height to zero.
			// Reshape it to allow reshaping of non-item children.
			LLRect rc = mItemsPanel->getRect();
			rc.mBottom = rc.mTop;
			mItemsPanel->reshape(rc.getWidth(), rc.getHeight());
			mItemsPanel->setRect(rc);
			setNoItemsCommentVisible(true);
		}
		else
		{
			for (std::vector<LLPanel*>::const_iterator
					 detached_iter = detached_items.begin(),
					 detached_iter_end = detached_items.end();
				 detached_iter != detached_iter_end; ++detached_iter)
			{
				LLPanel* pDetachedItem = *detached_iter;
				for (pairs_iterator_t
						 iter = mItemPairs.begin(),
						 iter_end = mItemPairs.end();
					 iter != iter_end; ++iter)
				{
					item_pair_t* item_pair = *iter;
					if (item_pair->first == pDetachedItem)
					{
						mItemPairs.erase(iter);
						item_pair->first = NULL;
						delete item_pair;
						break;
					}
				}
			}
			rearrangeItems();
		}
		notifyParentItemsRectChanged();
	}
}
Esempio n. 12
0
void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param)
{
	std::string item = param.asString();
	if (item == "landmark")
	{
		LLSD key;
		key["type"] = CREATE_LANDMARK_INFO_TYPE;
		key["x"] = mPosGlobal.mdV[VX];
		key["y"] = mPosGlobal.mdV[VY];
		key["z"] = mPosGlobal.mdV[VZ];
		onOpen(key);
	}
	else if (item == "copy")
	{
		LLLandmarkActions::getSLURLfromPosGlobal(mPosGlobal, boost::bind(&onSLURLBuilt, _1));
	}
	else if (item == "delete")
	{
		gInventory.removeItem(mItem->getUUID());

		onBackButtonClicked();
	}
	else if (item == "pick")
	{
		if (mPickPanel == NULL)
		{
			mPickPanel = LLPanelPickEdit::create();
			addChild(mPickPanel);

			mPickPanel->setExitCallback(boost::bind(&LLPanelPlaces::togglePickPanel, this, FALSE));
			mPickPanel->setCancelCallback(boost::bind(&LLPanelPlaces::togglePickPanel, this, FALSE));
			mPickPanel->setSaveCallback(boost::bind(&LLPanelPlaces::togglePickPanel, this, FALSE));
		}

		togglePickPanel(TRUE);
		mPickPanel->onOpen(LLSD());

		LLPanelPlaceInfo* panel = getCurrentInfoPanel();
		if (panel)
		{
			panel->createPick(mPosGlobal, mPickPanel);
		}

		LLRect rect = getRect();
		mPickPanel->reshape(rect.getWidth(), rect.getHeight());
		mPickPanel->setRect(rect);
	}
	else if (item == "add_to_favbar")
	{
		if ( mItem.notNull() )
		{
			const LLUUID& favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
			if ( favorites_id.notNull() )
			{
				copy_inventory_item(gAgent.getID(),
									mItem->getPermissions().getOwner(),
									mItem->getUUID(),
									favorites_id,
									std::string(),
									LLPointer<LLInventoryCallback>(NULL));
				llinfos << "Copied inventory item #" << mItem->getUUID() << " to favorites." << llendl;
			}
		}
	}
}
Esempio n. 13
0
void LLPanelLogin::updateSavedLoginsCombo()
{
	if (!sInstance) 
	{
		return;	
	}
	// We add all of the possible values, sorted, and then add a bar and the current value at the top
	LLComboBox* saved_logins_combo = sInstance->getChild<LLComboBox>("username_combo");	
	saved_logins_combo->removeall();
	
	std::string current_creds=credential_name();
	if(current_creds.find("@")<1) current_creds=gSavedSettings.getString("UserLoginInfo"); 

	std::vector<std::string> logins = gSecAPIHandler->listCredentials();
	LLUUID selectid;
	LLStringUtil::trim(current_creds);

	for (std::vector<std::string>::iterator login_choice = logins.begin();
		 login_choice != logins.end();
		 login_choice++)
	{
			std::string name=*login_choice;
			LLStringUtil::trim(name);

			std::string credname=name;
			std::string gridname=name;
			U32 arobase = gridname.find("@");
			if (arobase != -1 && arobase +1 < gridname.length() && arobase>1){
				gridname = gridname.substr(arobase+1, gridname.length() - arobase - 1);
				name = name.substr(0,arobase);

// <FS:AW optional opensim support>
				const std::string grid_label = LLGridManager::getInstance()->getGridLabel(gridname);

				bool add_grid = false;
				if (SECOND_LIFE_MAIN_LABEL == grid_label)
				{
					add_grid= true;
				}
#ifdef HAS_OPENSIM_SUPPORT
				else if (!grid_label.empty())
				{
					name.append(" @ " + grid_label);
					add_grid= true;
				}
#else  // HAS_OPENSIM_SUPPORT 
				else if (SECOND_LIFE_BETA_LABEL == grid_label)
				{
					name.append(" @ " + grid_label);
					add_grid= true;
				}
#endif // HAS_OPENSIM_SUPPORT 
				if (add_grid)
				{
					saved_logins_combo->add(name,LLSD(credname));
				}
// </FS:AW optional opensim support>
			}
	}

	saved_logins_combo->sortByName();	
	saved_logins_combo->selectByValue(LLSD(current_creds));
	//saved_logins_combo->setCurrentByID(selectid;
	/*std::string gridname=current_creds;
	U32 arobase = gridname.find("@");
	if (arobase != -1 && arobase +1 < gridname.length() && arobase>1){
		current_creds = current_creds.substr(0,arobase);
		saved_logins_combo->addSeparator(ADD_TOP);
		saved_logins_combo->add(current_creds,credential_name(),ADD_TOP);
	}
	saved_logins_combo->selectFirstItem();*/
}
void LLFloaterBuyLandUI::refreshUI()
{
	// section zero: title area
	{
		LLTextureCtrl* snapshot = getChild<LLTextureCtrl>("info_image");
		if (snapshot)
		{
			snapshot->setImageAssetID(
				mParcelValid ? mParcelSnapshot : LLUUID::null);
		}
		
		if (mParcelValid)
		{
			getChild<LLUICtrl>("info_parcel")->setValue(mParcelLocation);

			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mParcelActualArea);
			string_args["[AMOUNT2]"] = llformat("%d", mParcelSupportedObjects);
			string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
		
			getChild<LLUICtrl>("info_size")->setValue(getString("meters_supports_object", string_args));

			F32 cost_per_sqm = 0.0f;
			if (mParcelActualArea > 0)
			{
				cost_per_sqm = (F32)mParcelPrice / (F32)mParcelActualArea;
			}

			string_args["[PRICE]"] = llformat("%d", mParcelPrice);
			string_args["[PRICE_PER_SQM]"] = llformat("%.1f", cost_per_sqm);
			if (mParcelSoldWithObjects)
			{
				string_args["[SOLD_WITH_OBJECTS]"] = getString("sold_with_objects");
			}
			else
			{
				string_args["[SOLD_WITH_OBJECTS]"] = getString("sold_without_objects");
			}
			childSetText("info_price", getString("info_price_string", string_args));
			childSetVisible("info_price", mParcelIsForSale);
		}
		else
		{
			childSetText("info_parcel", getString("no_parcel_selected"));
			childSetText("info_size", LLStringUtil::null);
			childSetText("info_price", LLStringUtil::null);
		}
		
		childSetText("info_action",
			mCanBuy
				?
					mIsForGroup
						? getString("buying_for_group")//"Buying land for group:"
						: getString("buying_will")//"Buying this land will:"
				: 
					mCannotBuyIsError
						? getString("cannot_buy_now")//"Cannot buy now:"
						: getString("not_for_sale")//"Not for sale:"

			);
	}
	
	bool showingError = !mCanBuy || !mSiteValid;
	
	// error section
	if (showingError)
	{
		mChildren.setBadge(std::string("step_error"),
			mCannotBuyIsError
				? LLViewChildren::BADGE_ERROR
				: LLViewChildren::BADGE_WARN);
		
		LLTextBox* message = getChild<LLTextBox>("error_message");
		if (message)
		{
			message->setVisible(true);
			message->setWrappedText(
				!mCanBuy ? mCannotBuyReason : "(waiting for data)"
				);
		}

		childSetVisible("error_web", 
				mCannotBuyIsError && !mCannotBuyURI.empty());
	}
	else
	{
		childHide("step_error");
		childHide("error_message");
		childHide("error_web");
	}
	
	
	// section one: account
	if (!showingError)
	{
		mChildren.setBadge(std::string("step_1"),
			mSiteMembershipUpgrade
				? LLViewChildren::BADGE_NOTE
				: LLViewChildren::BADGE_OK);
		childSetText("account_action", mSiteMembershipAction);
		childSetText("account_reason", 
			mSiteMembershipUpgrade
				?	getString("must_upgrade")
				:	getString("cant_own_land")
			);
		
		LLComboBox* levels = getChild<LLComboBox>( "account_level");
		if (levels)
		{
			levels->setVisible(mSiteMembershipUpgrade);
			
			levels->removeall();
			for(std::vector<std::string>::const_iterator i
					= mSiteMembershipPlanNames.begin();
				i != mSiteMembershipPlanNames.end();
				++i)
			{
				levels->add(*i);
			}
			
			levels->setCurrentByIndex(mUserPlanChoice);
		}

		childShow("step_1");
		childShow("account_action");
		childShow("account_reason");
	}
	else
	{
		childHide("step_1");
		childHide("account_action");
		childHide("account_reason");
		childHide("account_level");
	}
	
	// section two: land use fees
	if (!showingError)
	{
		mChildren.setBadge(std::string("step_2"),
			mSiteLandUseUpgrade
				? LLViewChildren::BADGE_NOTE
				: LLViewChildren::BADGE_OK);
		childSetText("land_use_action", mSiteLandUseAction);
		
		std::string message;
		
		if (mIsForGroup)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[GROUP]"] = std::string(gAgent.getGroupName());

			message += getString("insufficient_land_credits", string_args);
				
		}
		else
		{
			LLStringUtil::format_map_t string_args;
			string_args["[BUYER]"] = llformat("%d", mAgentCommittedTier);
			message += getString("land_holdings", string_args);
		}
		
		if (!mParcelValid)
		{
			message += "(no parcel selected)";
		}
		else if (mParcelBillableArea == mParcelActualArea)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d ", mParcelActualArea);
			message += getString("parcel_meters", string_args);
		}
		else
		{

			if (mParcelBillableArea > mParcelActualArea)
			{	
				LLStringUtil::format_map_t string_args;
				string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
				message += getString("premium_land", string_args);
			}
			else
			{
				LLStringUtil::format_map_t string_args;
				string_args["[AMOUNT]"] = llformat("%d ", mParcelBillableArea);
				message += getString("discounted_land", string_args);
			}
		}

		childSetWrappedText("land_use_reason", message);

		childShow("step_2");
		childShow("land_use_action");
		childShow("land_use_reason");
	}
	else
	{
		childHide("step_2");
		childHide("land_use_action");
		childHide("land_use_reason");
	}
	
	// section three: purchase & currency
	S32 finalBalance = mAgentCashBalance + mCurrency.getAmount() - mParcelPrice;
	bool willHaveEnough = finalBalance >= 0;
	bool haveEnough = mAgentCashBalance >= mParcelPrice;
	S32 minContribution = llceil((F32)mParcelBillableArea / GROUP_LAND_BONUS_FACTOR);
	bool groupContributionEnough = mParcelGroupContribution >= minContribution;
	
	mCurrency.updateUI(!showingError  &&  !haveEnough);

	if (!showingError)
	{
		mChildren.setBadge(std::string("step_3"),
			!willHaveEnough
				? LLViewChildren::BADGE_WARN
				: mCurrency.getAmount() > 0
					? LLViewChildren::BADGE_NOTE
					: LLViewChildren::BADGE_OK);
			
		childSetText("purchase_action",
			llformat(
				"Pay %s %d to %s for this land",
				gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(),
				mParcelPrice,
				mParcelSellerName.c_str()
				));
		childSetVisible("purchase_action", mParcelValid);
		
		std::string reasonString;

		if (haveEnough)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
			string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();

			childSetText("currency_reason", getString("have_enough_lindens", string_args));
		}
		else
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mAgentCashBalance);
			string_args["[AMOUNT2]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
			string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
			
			childSetText("currency_reason", getString("not_enough_lindens", string_args));

			childSetTextArg("currency_est", "[AMOUNT2]", llformat("%#.2f", mCurrency.getEstimate() / 100.0));
		}
		
		if (willHaveEnough)
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", finalBalance);
			string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();

			childSetText("currency_balance", getString("balance_left", string_args));

		}
		else
		{
			LLStringUtil::format_map_t string_args;
			string_args["[AMOUNT]"] = llformat("%d", mParcelPrice - mAgentCashBalance);
			string_args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
	
			childSetText("currency_balance", getString("balance_needed", string_args));
			
		}

		childSetValue("remove_contribution", LLSD(groupContributionEnough));
		childSetEnabled("remove_contribution", groupContributionEnough);
		bool showRemoveContribution = mParcelIsGroupLand
							&& (mParcelGroupContribution > 0);
		childSetLabelArg("remove_contribution", "[AMOUNT]",
							llformat("%d", minContribution));
		childSetVisible("remove_contribution", showRemoveContribution);

		childShow("step_3");
		childShow("purchase_action");
		childShow("currency_reason");
		childShow("currency_balance");
	}
	else
	{
		childHide("step_3");
		childHide("purchase_action");
		childHide("currency_reason");
		childHide("currency_balance");
		childHide("remove_group_donation");
	}


	bool agrees_to_covenant = false;
	LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
	if (check)
	{
	    agrees_to_covenant = check->get();
	}

	childSetEnabled("buy_btn",
		mCanBuy && mSiteValid && willHaveEnough && !mResponder && agrees_to_covenant);
}
void filter_object::test<2>()
{
    set_test_name("LLEventTimeout::actionAfter()");
    LLEventPump& driver(pumps.obtain("driver"));
    TestEventTimeout filter(driver);
    listener0.reset(0);
    LLTempBoundListener temp1(
        listener0.listenTo(filter));
    // Use listener1.call() as the Action for actionAfter(), since it
    // already provides a way to sense the call
    listener1.reset(0);
    // driver --> filter --> listener0
    filter.actionAfter(20,
                       boost::bind(&Listener::call, boost::ref(listener1), LLSD("timeout")));
    // Okay, (fake) timer is ticking. 'filter' can only sense the timer
    // when we pump mainloop. Do that right now to take the logic path
    // before either the anticipated event arrives or the timer expires.
    mainloop.post(17);
    check_listener("no timeout 1", listener1, LLSD(0));
    // Expected event arrives...
    driver.post(1);
    check_listener("event passed thru", listener0, LLSD(1));
    // Should have canceled the timer. Verify that by asserting that the
    // time has expired, then pumping mainloop again.
    filter.forceTimeout();
    mainloop.post(17);
    check_listener("no timeout 2", listener1, LLSD(0));
    // Verify chained actionAfter() calls, that is, that a second
    // actionAfter() resets the timer established by the first
    // actionAfter().
    filter.actionAfter(20,
                       boost::bind(&Listener::call, boost::ref(listener1), LLSD("timeout")));
    // Since our TestEventTimeout class isn't actually manipulating time
    // (quantities of seconds), only a bool "elapsed" flag, sense that by
    // forcing the flag between actionAfter() calls.
    filter.forceTimeout();
    // Pumping mainloop here would result in a timeout (as we'll verify
    // below). This state simulates a ticking timer that has not yet timed
    // out. But now, before a mainloop event lets 'filter' recognize
    // timeout on the previous actionAfter() call, pretend we're pushing
    // that timeout farther into the future.
    filter.actionAfter(20,
                       boost::bind(&Listener::call, boost::ref(listener1), LLSD("timeout")));
    // Look ma, no timeout!
    mainloop.post(17);
    check_listener("no timeout 3", listener1, LLSD(0));
    // Now let the updated actionAfter() timer expire.
    filter.forceTimeout();
    // Notice the timeout.
    mainloop.post(17);
    check_listener("timeout", listener1, LLSD("timeout"));
    // Timing out cancels the timer. Verify that.
    listener1.reset(0);
    filter.forceTimeout();
    mainloop.post(17);
    check_listener("no timeout 4", listener1, LLSD(0));
    // Reset the timer and then cancel() it.
    filter.actionAfter(20,
                       boost::bind(&Listener::call, boost::ref(listener1), LLSD("timeout")));
    // neither expired nor satisified
    mainloop.post(17);
    check_listener("no timeout 5", listener1, LLSD(0));
    // cancel
    filter.cancel();
    // timeout!
    filter.forceTimeout();
    mainloop.post(17);
    check_listener("no timeout 6", listener1, LLSD(0));
}
Esempio n. 16
0
BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
{
	BOOL reset_selection = (mask != MASK_SHIFT);
	BOOL handled = FALSE;
	switch (key)
	{
		case KEY_RETURN:
		{
			if (mSelectedItemPairs.size() && mask == MASK_NONE)
			{
				mOnReturnSignal(this, getValue());
				handled = TRUE;
			}
			break;
		}
		case KEY_UP:
		{
			if ( !selectNextItemPair(true, reset_selection) && reset_selection)
			{
				// If case we are in accordion tab notify parent to go to the previous accordion
				if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed
					resetSelection();
			}
			break;
		}
		case KEY_DOWN:
		{
			if ( !selectNextItemPair(false, reset_selection) && reset_selection)
			{
				// If case we are in accordion tab notify parent to go to the next accordion
				if( notifyParent(LLSD().with("action","select_next")) > 0 ) //message was processed
					resetSelection();
			}
			break;
		}
		case KEY_ESCAPE:
		{
			if (mask == MASK_NONE)
			{
				setFocus(FALSE); // pass focus to the game area (EXT-8357)
			}
			break;
		}
		default:
			break;
	}

	if ( ( key == KEY_UP || key == KEY_DOWN ) && mSelectedItemPairs.size() )
	{
		ensureSelectedVisible();
		/*
		LLRect visible_rc = getVisibleContentRect();
		LLRect selected_rc = getLastSelectedItemRect();

		if ( !visible_rc.contains (selected_rc) )
		{
			// But scroll in Items panel coordinates
			scrollToShowRect(selected_rc);
		}

		// In case we are in accordion tab notify parent to show selected rectangle
		LLRect screen_rc;
		localRectToScreen(selected_rc, &screen_rc);
		notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));*/

		handled = TRUE;
	}

	return handled ? handled : LLScrollContainer::handleKeyHere(key, mask);
}
Esempio n. 17
0
//---------------------------------------------------------------------------
LLNotifyBox::LLNotifyBox(LLNotificationPtr notification,
						 BOOL layout_script_dialog)
	:	LLPanel(notification->getName(), LLRect(), BORDER_NO),
		LLEventTimer(notification->getExpiration() == LLDate() 
			? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) 
			: notification->getExpiration()),
		LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()),
	  mNotification(notification),
	  mIsTip(notification->getType() == "notifytip"),
	  mAnimating(TRUE),
	  mNextBtn(NULL),
	  mNumOptions(0),
	  mNumButtons(0),
	  mAddedDefaultBtn(FALSE),
	  mLayoutScriptDialog(layout_script_dialog)
{
	// clicking on a button does not steal current focus
	setIsChrome(TRUE);

	// class init
	if (!sFont)
	{
		sFont = LLFontGL::getFontSansSerif();
		sFontSmall = LLFontGL::getFontSansSerifSmall();
	}

	// setup paramaters
	mMessage = notification->getMessage();

	// initialize
	setFocusRoot(!mIsTip);

	// caution flag can be set explicitly by specifying it in the
	// notification payload, or it can be set implicitly if the
	// notify xml template specifies that it is a caution
	//
	// tip-style notification handle 'caution' differently -
	// they display the tip in a different color
	mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;

	// Only animate first window
	if( gNotifyBoxView->getChildCount() > 0 )
		mAnimating = FALSE;
	else
		mAnimating = TRUE;

	LLNotificationFormPtr form(notification->getForm());

	mNumOptions = form->getNumElements();
		  
	LLRect rect = mIsTip ? getNotifyTipRect(mMessage)
		   		  		 : getNotifyRect(mNumOptions, layout_script_dialog, mIsCaution);
	setRect(rect);
	setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT));
	setBackgroundVisible(FALSE);
	setBackgroundOpaque(TRUE);

	LLIconCtrl* icon;
	LLTextEditor* text;

	const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32);
	const S32 BOTTOM = (S32)sFont->getLineHeight();
	S32 x = HPAD + HPAD;
	S32 y = TOP;

	if (mIsTip)
	{
		// use the tip notification icon
		icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_tip_icon.tga"));
	}
	else if (mIsCaution)
	{
		// use the caution notification icon
		icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_caution_icon.tga"));
	}
	else
	{
		// use the default notification icon
		icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_box_icon.tga"));
	}

	icon->setMouseOpaque(FALSE);
	addChild(icon);

	x += HPAD + HPAD + 32;

	// add a caution textbox at the top of a caution notification
	LLTextBox* caution_box = NULL;
	if (mIsCaution && !mIsTip)
	{
		S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD;
		caution_box = new LLTextBox(
			std::string("caution_box"), 
			LLRect(x, y, getRect().getWidth() - 2, caution_height), 
			LLStringUtil::null, 
			sFont, 
			FALSE);

		caution_box->setFontStyle(LLFontGL::BOLD);
		caution_box->setColor(gColors.getColor("NotifyCautionWarnColor"));
		caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor"));
		caution_box->setBorderVisible(FALSE);
		caution_box->setWrappedText(notification->getMessage());
		
		addChild(caution_box);

		// adjust the vertical position of the next control so that 
		// it appears below the caution textbox
		y = y - caution_height;
	}
	else
	{

		const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD);

		// Tokenization on \n is handled by LLTextBox

		const S32 MAX_LENGTH = 512 + 20 + 
			DB_FIRST_NAME_BUF_SIZE + 
			DB_LAST_NAME_BUF_SIZE +
			DB_INV_ITEM_NAME_BUF_SIZE;  // For script dialogs: add space for title.

		text = new LLTextEditor(std::string("box"),
								LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16),
								MAX_LENGTH,
								mMessage,
								sFont,
								FALSE);
		text->setWordWrap(TRUE);
		text->setTabStop(FALSE);
		text->setMouseOpaque(FALSE);
		text->setBorderVisible(FALSE);
		text->setTakesNonScrollClicks(FALSE);
		text->setHideScrollbarForShortDocs(TRUE);
		text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually 
															// rendered under the text box, therefore we want 
															// the actual text box to be transparent
		text->setReadOnlyFgColor ( gColors.getColor("NotifyTextColor") );
		text->setEnabled(FALSE); // makes it read-only
		text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard)
		addChild(text);
	}

	if (mIsTip)
	{
		// TODO: Make a separate archive for these.
		LLChat chat(mMessage);
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		LLFloaterChat::getInstance(LLSD())->addChatHistory(chat);
	}
	else
	{
		LLButton* btn;
		btn = new LLButton(std::string("next"),
						   LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD),
						   std::string("notify_next.png"),
						   std::string("notify_next.png"),
						   LLStringUtil::null,
						   onClickNext,
						   this,
						   sFont);
		btn->setScaleImage(TRUE);
		btn->setToolTip(std::string("Next")); // *TODO: Translate
		addChild(btn);
		mNextBtn = btn;

		for (S32 i = 0; i < mNumOptions; i++)
		{

			LLSD form_element = form->getElement(i);
			if (form_element["type"].asString() != "button") 
			{
				continue;
			}

			addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean());
		}

		if (mNumButtons == 0)
		{
			addButton("OK", "OK", FALSE, TRUE);
			mAddedDefaultBtn = TRUE;
		}
		
		sNotifyBoxCount++;

		if (sNotifyBoxCount <= 0)
		{
			llwarns << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << llendl;
		}
		
		// If this is the only notify box, don't show the next button
		if (sNotifyBoxCount == 1
			&& mNextBtn)
		{
			mNextBtn->setVisible(FALSE);
		}
	}
}
void LLPanelDirBrowser::processDirPeopleReply(LLMessageSystem *msg, void**)
{
	LLUUID query_id;
	std::string   first_name;
	std::string   last_name;
	LLUUID agent_id;

	msg->getUUIDFast(_PREHASH_QueryData,_PREHASH_QueryID, query_id);

	LLPanelDirBrowser* self;
	self = gDirBrowserInstances.getIfThere(query_id);
	if (!self) 
	{
		// data from an old query
		return;
	}

	self->mHaveSearchResults = TRUE;

	LLCtrlListInterface *list = self->childGetListInterface("results");
	if (!list) return;

	if (!list->getCanSelect())
	{
		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
		self->mResultsContents = LLSD();
	}

	S32 rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies);
	self->mResultsReceived += rows;

	rows = self->showNextButton(rows);

	for (S32 i = 0; i < rows; i++)
	{			
		msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_FirstName, first_name, i);
		msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_LastName,	last_name, i);
		msg->getUUIDFast(  _PREHASH_QueryReplies,_PREHASH_AgentID, agent_id, i);
		// msg->getU8Fast(    _PREHASH_QueryReplies,_PREHASH_Online, online, i);
		// unused
		// msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_Group, group, i);
		// msg->getS32Fast(   _PREHASH_QueryReplies,_PREHASH_Reputation, reputation, i);

		if (agent_id.isNull())
		{
			continue;
		}

		LLSD content;

		LLSD row;
		row["id"] = agent_id;

		// We don't show online status in the finder anymore,
		// so just use the 'offline' icon as the generic 'person' icon
		row["columns"][0]["column"] = "icon";
		row["columns"][0]["type"] = "icon";
		row["columns"][0]["value"] = "icon_avatar_offline.tga";

		content["type"] = AVATAR_CODE;

		std::string fullname = first_name + " " + last_name;
		row["columns"][1]["column"] = "name";
		row["columns"][1]["value"] = fullname;
		row["columns"][1]["font"] = "SANSSERIF";

		content["name"] = fullname;

		list->addElement(row);
		self->mResultsContents[agent_id.asString()] = content;
	}

	list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
	self->updateResultCount();

	// Poke the result received timer
	self->mLastResultTimer.reset();
	self->mDidAutoSelect = FALSE;
}
void LLIMMgr::inviteToSession(
	const LLUUID& session_id, 
	const std::string& session_name, 
	const LLUUID& caller_id, 
	const std::string& caller_name,
	EInstantMessage type,
	EInvitationType inv_type,
	const std::string& session_handle,
	const std::string& session_uri)
{
	//ignore invites from muted residents
	if (LLMuteList::getInstance()->isMuted(caller_id))
	{
		return;
	}

	std::string notify_box_type;

	BOOL ad_hoc_invite = FALSE;
	if(type == IM_SESSION_P2P_INVITE)
	{
		//P2P is different...they only have voice invitations
		notify_box_type = "VoiceInviteP2P";
	}
	else if ( gAgent.isInGroup(session_id) )
	{
		//only really old school groups have voice invitations
		notify_box_type = "VoiceInviteGroup";
	}
	else if ( inv_type == INVITATION_TYPE_VOICE )
	{
		//else it's an ad-hoc
		//and a voice ad-hoc
		notify_box_type = "VoiceInviteAdHoc";
		ad_hoc_invite = TRUE;
	}
	else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
	{
		notify_box_type = "InviteAdHoc";
		ad_hoc_invite = TRUE;
	}

	LLSD payload;
	payload["session_id"] = session_id;
	payload["session_name"] = session_name;
	payload["caller_id"] = caller_id;
	payload["caller_name"] = caller_name;
	payload["type"] = type;
	payload["inv_type"] = inv_type;
	payload["session_handle"] = session_handle;
	payload["session_uri"] = session_uri;
	payload["notify_box_type"] = notify_box_type;

	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
	if (channelp && channelp->callStarted())
	{
		// you have already started a call to the other user, so just accept the invite
		LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 0);
		return;
	}

	if (type == IM_SESSION_P2P_INVITE || ad_hoc_invite)
	{
		if	(	// we're rejecting non-friend voice calls and this isn't a friend
				(gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL))
			)
		{
			// silently decline the call
			LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1);
			return;
		}
	}

	if ( !mPendingInvitations.has(session_id.asString()) )
	{
		if (caller_name.empty())
		{
			gCacheName->get(caller_id, true,  // voice
				boost::bind(&LLIMMgr::onInviteNameLookup, _1, _2, _3, payload));
		}
		else
		{
			LLSD args;
			args["NAME"] = caller_name;
			args["GROUP"] = session_name;

			LLNotifications::instance().add(notify_box_type, 
					     args, 
						 payload,
						 &inviteUserResponse);

		}
		mPendingInvitations[session_id.asString()] = LLSD();
	}
}
void LLPanelDirBrowser::processDirPlacesReply(LLMessageSystem* msg, void**)
{
	LLUUID	agent_id;
	LLUUID	query_id;
	LLUUID	parcel_id;
	std::string	name;
	BOOL	is_for_sale;
	BOOL	is_auction;
	F32		dwell;
	
	msg->getUUID("AgentData", "AgentID", agent_id);
	msg->getUUID("QueryData", "QueryID", query_id );

	if (msg->getNumberOfBlocks("StatusData"))
	{
		U32 status;
		msg->getU32("StatusData", "Status", status);
		if (status & STATUS_SEARCH_PLACES_BANNEDWORD)
		{
			LLNotificationsUtil::add("SearchWordBanned");
		}
	}

	LLPanelDirBrowser* self;
	self = gDirBrowserInstances.getIfThere(query_id);
	if (!self) 
	{
		// data from an old query
		return;
	}

	self->mHaveSearchResults = TRUE;

	LLCtrlListInterface *list = self->childGetListInterface("results");
	if (!list) return;

	if (!list->getCanSelect())
	{
		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
		self->mResultsContents = LLSD();
	}

	S32 count = msg->getNumberOfBlocks("QueryReplies");
	self->mResultsReceived += count;

	count = self->showNextButton(count);

	for (S32 i = 0; i < count ; i++)
	{
		msg->getUUID("QueryReplies", "ParcelID", parcel_id, i);
		msg->getString("QueryReplies", "Name", name, i);
		msg->getBOOL("QueryReplies", "ForSale", is_for_sale, i);
		msg->getBOOL("QueryReplies", "Auction", is_auction, i);
		msg->getF32("QueryReplies", "Dwell", dwell, i);
		
		if (parcel_id.isNull())
		{
			continue;
		}

		LLSD content;
		S32 type;

		LLSD row = self->createLandSale(parcel_id, is_auction, is_for_sale, name, &type);

		content["type"] = type;
		content["name"] = name;

		std::string buffer = llformat("%.0f", (F64)dwell);
		row["columns"][3]["column"] = "dwell";
		row["columns"][3]["value"] = buffer;
		row["columns"][3]["font"] = "SANSSERIFSMALL";

		list->addElement(row);
		self->mResultsContents[parcel_id.asString()] = content;
	}

	list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
	self->updateResultCount();

	// Poke the result received timer
	self->mLastResultTimer.reset();
	self->mDidAutoSelect = FALSE;
}
bool LLPanelGroupGeneral::apply(std::string& mesg)
{
	if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty())
	{
		LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID());
		update(GC_TITLES);
		mComboActiveTitle->resetDirty();
	}

	BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);

	if (has_power_in_group || mGroupID.isNull())
	{
		llinfos << "LLPanelGroupGeneral::apply" << llendl;

		// Check to make sure mature has been set
		if(mComboMature &&
		   mComboMature->getCurrentIndex() == DECLINE_TO_STATE)
		{
			LLNotificationsUtil::add("SetGroupMature", LLSD(), LLSD(), 
											boost::bind(&LLPanelGroupGeneral::confirmMatureApply, this, _1, _2));
			return false;
		}

		if (mGroupID.isNull())
		{
			// Validate the group name length.
			S32 group_name_len = mGroupNameEditor->getText().size();
			if ( group_name_len < DB_GROUP_NAME_MIN_LEN 
				|| group_name_len > DB_GROUP_NAME_STR_LEN)
			{
				std::ostringstream temp_error;
				temp_error << "A group name must be between " << DB_GROUP_NAME_MIN_LEN
					<< " and " << DB_GROUP_NAME_STR_LEN << " characters.";
				mesg = temp_error.str();
				return false;
			}

			// <FS:AW> FIRE-7091 group creation cost inaccurate on opensim>
			//LLNotificationsUtil::add("CreateGroupCost",  LLSD(), LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2));
			LLSD args;
			S32 cost =  LLGlobalEconomy::Singleton::getInstance()->getPriceGroupCreate();
			args["[COST]"] = llformat("%d", cost);
			LLNotificationsUtil::add("CreateGroupCost",  args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2));
			// </FS:AW> FIRE-7091 group creation cost inaccurate on opensim>

			return false;
		}

		LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
		if (!gdatap)
		{
			mesg = LLTrans::getString("NoGroupDataFound");
			mesg.append(mGroupID.asString());
			return false;
		}
		bool can_change_ident = false;
		bool can_change_member_opts = false;
		can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
		can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);

		if (can_change_ident)
		{
			if (mEditCharter) gdatap->mCharter = mEditCharter->getText();
			if (mInsignia) gdatap->mInsigniaID = mInsignia->getImageAssetID();
			if (mComboMature)
			{
				if (!gAgent.isTeen())
				{
					gdatap->mMaturePublish = 
						mComboMature->getCurrentIndex() == MATURE_CONTENT;
				}
				else
				{
					gdatap->mMaturePublish = FALSE;
				}
			}
			if (mCtrlShowInGroupList) gdatap->mShowInList = mCtrlShowInGroupList->get();
		}

		if (can_change_member_opts)
		{
			if (mCtrlOpenEnrollment) gdatap->mOpenEnrollment = mCtrlOpenEnrollment->get();
			if (mCtrlEnrollmentFee && mSpinEnrollmentFee)
			{
				gdatap->mMembershipFee = (mCtrlEnrollmentFee->get()) ? 
					(S32) mSpinEnrollmentFee->get() : 0;
				// Set to the used value, and reset initial value used for isdirty check
				mSpinEnrollmentFee->set( (F32)gdatap->mMembershipFee );
			}
		}

		if (can_change_ident || can_change_member_opts)
		{
			LLGroupMgr::getInstance()->sendUpdateGroupInfo(mGroupID);
		}
	}

	BOOL receive_notices = false;
	BOOL list_in_profile = false;
	if (mCtrlReceiveNotices)
		receive_notices = mCtrlReceiveNotices->get();
	if (mCtrlListGroup) 
		list_in_profile = mCtrlListGroup->get();

	gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);

	// <exodus>
	if(mCtrlReceiveGroupChat)
	{
		if(mCtrlReceiveGroupChat->get())
		{
			exoGroupMuteList::instance().remove(mGroupID);
		}
		else
		{
			exoGroupMuteList::instance().add(mGroupID);
		}
	}
	// </exodus>

	resetDirty();

	mChanged = FALSE;

	return true;
}
void LLPanelDirBrowser::processDirEventsReply(LLMessageSystem* msg, void**)
{
	LLUUID	agent_id;
	LLUUID	query_id;
	LLUUID	owner_id;
	std::string	name;
	std::string	date;
	BOOL	show_pg = gSavedSettings.getBOOL("ShowPGEvents");
	BOOL	show_mature = gSavedSettings.getBOOL("ShowMatureEvents");
	BOOL	show_adult = gSavedSettings.getBOOL("ShowAdultEvents");

	msg->getUUID("AgentData", "AgentID", agent_id);
	msg->getUUID("QueryData", "QueryID", query_id );

	LLPanelDirBrowser* self;
	self = gDirBrowserInstances.getIfThere(query_id);
	if (!self)
	{
		return;
	}

	if (msg->getNumberOfBlocks("StatusData"))
	{
		U32 status;
		msg->getU32("StatusData", "Status", status);
		if (status & STATUS_SEARCH_EVENTS_BANNEDWORD)
		{
			LLNotificationsUtil::add("SearchWordBanned");
		}
	}

	self->mHaveSearchResults = TRUE;

	LLCtrlListInterface *list = self->childGetListInterface("results");
	if (!list) return;

	if (!list->getCanSelect())
	{
		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
		self->mResultsContents = LLSD();
	}

	S32 rows = msg->getNumberOfBlocks("QueryReplies");
	self->mResultsReceived += rows;

	rows = self->showNextButton(rows);

	for (S32 i = 0; i < rows; i++)
	{
		U32 event_id;
		U32 unix_time;
		U32 event_flags;

		msg->getUUID("QueryReplies", "OwnerID", owner_id, i);
		msg->getString("QueryReplies", "Name", name, i);
		msg->getU32("QueryReplies", "EventID", event_id, i);
//		msg->getString("QueryReplies", "Date", date, i);
		msg->getU32("QueryReplies", "UnixTime", unix_time, i);
		msg->getU32("QueryReplies", "EventFlags", event_flags, i);
	
		// Skip empty events
		if (owner_id.isNull())
		{
			//RN: should this check event_id instead?
			llwarns << "skipped event due to owner_id null, event_id " << event_id << llendl;
			continue;
		}

		// skip events that don't match the flags
		// there's no PG flag, so we make sure neither adult nor mature is set
		if (((event_flags & (EVENT_FLAG_ADULT | EVENT_FLAG_MATURE)) == EVENT_FLAG_NONE) && !show_pg)
		{
			//llwarns << "Skipped pg event because we're not showing pg, event_id " << event_id << llendl;
			continue;
		}
		
		if ((event_flags & EVENT_FLAG_MATURE) && !show_mature)
		{
			//llwarns << "Skipped mature event because we're not showing mature, event_id " << event_id << llendl;
			continue;
		}
		
		if ((event_flags & EVENT_FLAG_ADULT) && !show_adult)
		{
			//llwarns << "Skipped adult event because we're not showing adult, event_id " << event_id << llendl;
			continue;
		}
		
		LLSD content;

		content["type"] = EVENT_CODE;
		content["name"] = name;
		content["event_id"] = (S32)event_id;

		LLSD row;
		row["id"] = llformat("%u", event_id);

		// Column 0 - event icon
		LLUUID image_id;
		if (event_flags == EVENT_FLAG_ADULT)
		{
			row["columns"][0]["column"] = "icon";
			row["columns"][0]["type"] = "icon";
			row["columns"][0]["value"] = "icon_event_adult.tga";
		}
		else if (event_flags == EVENT_FLAG_MATURE)
		{
			row["columns"][0]["column"] = "icon";
			row["columns"][0]["type"] = "icon";
			row["columns"][0]["value"] = "icon_event_mature.tga";
		}
		else
		{
			row["columns"][0]["column"] = "icon";
			row["columns"][0]["type"] = "icon";
			row["columns"][0]["value"] = "icon_event.tga";
		}

		row["columns"][1]["column"] = "name";
		row["columns"][1]["value"] = name;
		row["columns"][1]["font"] = "SANSSERIF";

		struct tm* t = utc_to_pacific_time(unix_time, gPacificDaylightTime);
		std::string format = "%m-%d ";
		format += gSavedSettings.getString("ShortTimeFormat");
		timeStructToFormattedString(t, format, date);

		row["columns"][2]["column"] = "date";
		row["columns"][2]["value"] = date;
		row["columns"][2]["font"] = "SANSSERIFSMALL";

		row["columns"][3]["column"] = "time";
		row["columns"][3]["value"] = llformat("%u", unix_time);
		row["columns"][3]["font"] = "SANSSERIFSMALL";

		list->addElement(row, ADD_SORTED);

		std::string id_str = llformat("%u", event_id);
		self->mResultsContents[id_str] = content;
	}

	list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
	self->updateResultCount();

	// Poke the result received timer
	self->mLastResultTimer.reset();
	self->mDidAutoSelect = FALSE;
}
Esempio n. 23
0
void LLFloaterWater::onNewPreset()
{
	LLNotificationsUtil::add("NewWaterPreset", LLSD(),  LLSD(), boost::bind(&LLFloaterWater::newPromptCallback, this, _1, _2));
}
// static
void LLPanelDirBrowser::processDirGroupsReply(LLMessageSystem* msg, void**)
{
	S32		i;
	
	LLUUID	query_id;
	LLUUID	group_id;
	std::string	group_name;
	S32     members;
	F32     search_order;

	msg->getUUIDFast(_PREHASH_QueryData,_PREHASH_QueryID, query_id );

	LLPanelDirBrowser* self;
	self = gDirBrowserInstances.getIfThere(query_id);
	if (!self)
	{
		return;
	}

	self->mHaveSearchResults = TRUE;

	LLCtrlListInterface *list = self->childGetListInterface("results");
	if (!list) return;

	if (!list->getCanSelect())
	{
		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
		self->mResultsContents = LLSD();
	}

	S32 rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies);
	self->mResultsReceived += rows;

	rows = self->showNextButton(rows);

	for (i = 0; i < rows; i++)
	{
		msg->getUUIDFast(_PREHASH_QueryReplies, _PREHASH_GroupID,		group_id, i );
		msg->getStringFast(_PREHASH_QueryReplies, _PREHASH_GroupName,	group_name,		i);
		msg->getS32Fast(_PREHASH_QueryReplies, _PREHASH_Members,		members, i );
		msg->getF32Fast(_PREHASH_QueryReplies, _PREHASH_SearchOrder,	search_order, i );
		
		if (group_id.isNull())
		{
			continue;
		}

		LLSD content;
		content["type"] = GROUP_CODE;
		content["name"] = group_name;

		LLSD row;
		row["id"] = group_id;

		LLUUID image_id;
		row["columns"][0]["column"] = "icon";
		row["columns"][0]["type"] = "icon";
		row["columns"][0]["value"] = "icon_group.tga";

		row["columns"][1]["column"] = "name";
		row["columns"][1]["value"] = group_name;
		row["columns"][1]["font"] = "SANSSERIF";

		row["columns"][2]["column"] = "members";
		row["columns"][2]["value"] = members;
		row["columns"][2]["font"] = "SANSSERIFSMALL";

		row["columns"][3]["column"] = "score";
		row["columns"][3]["value"] = search_order;

		list->addElement(row);
		self->mResultsContents[group_id.asString()] = content;
	}
	list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
	self->updateResultCount();

	// Poke the result received timer
	self->mLastResultTimer.reset();
	self->mDidAutoSelect = FALSE;
}
Esempio n. 25
0
LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type, const std::string& data_id) { return LLSD(); }
// static
void LLPanelDirBrowser::processDirClassifiedReply(LLMessageSystem* msg, void**)
{
	S32		i;
	S32		num_new_rows;

	LLUUID	agent_id;
	LLUUID	query_id;

	msg->getUUID("AgentData", "AgentID", agent_id);
	if (agent_id != gAgent.getID())
	{
		llwarns << "Message for wrong agent " << agent_id
			<< " in processDirClassifiedReply" << llendl;
		return;
	}

	msg->getUUID("QueryData", "QueryID", query_id);
	LLPanelDirBrowser* self = gDirBrowserInstances.getIfThere(query_id);
	if (!self)
	{
		return;
	}
	
	if (msg->getNumberOfBlocks("StatusData"))
	{
		U32 status;
		msg->getU32("StatusData", "Status", status);
		if (status & STATUS_SEARCH_CLASSIFIEDS_BANNEDWORD)
		{
			LLNotificationsUtil::add("SearchWordBanned");
		}
	}

	self->mHaveSearchResults = TRUE;

	LLCtrlListInterface *list = self->childGetListInterface("results");
	if (!list) return;

	if (!list->getCanSelect())
	{
		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
		self->mResultsContents = LLSD();
	}

	num_new_rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies);
	self->mResultsReceived += num_new_rows;

	num_new_rows = self->showNextButton(num_new_rows);
	for (i = 0; i < num_new_rows; i++)
	{
		LLUUID classified_id;
		std::string name;
		U32 creation_date = 0;	// unix timestamp
		U32 expiration_date = 0;	// future use
		S32 price_for_listing = 0;
		msg->getUUID("QueryReplies", "ClassifiedID", classified_id, i);
		msg->getString("QueryReplies", "Name", name, i);
		msg->getU32("QueryReplies","CreationDate",creation_date,i);
		msg->getU32("QueryReplies","ExpirationDate",expiration_date,i);
		msg->getS32("QueryReplies","PriceForListing",price_for_listing,i);

		if ( classified_id.notNull() )
		{
			self->addClassified(list, classified_id, name, creation_date, price_for_listing);

			LLSD content;
			content["type"] = CLASSIFIED_CODE;
			content["name"] = name;
			self->mResultsContents[classified_id.asString()] = content;
		}
	}
	// The server does the initial sort, by price paid per listing and date. JC
	self->updateResultCount();

	// Poke the result received timer
	self->mLastResultTimer.reset();
	self->mDidAutoSelect = FALSE;
}
LLAgentListener::LLAgentListener(LLAgent &agent)
  : LLEventAPI("LLAgent",
               "LLAgent listener to (e.g.) teleport, sit, stand, etc."),
    mAgent(agent)
{
    add("requestTeleport",
        "Teleport: [\"regionname\"], [\"x\"], [\"y\"], [\"z\"]\n"
        "If [\"skip_confirmation\"] is true, use LLURLDispatcher rather than LLCommandDispatcher.",
        &LLAgentListener::requestTeleport);
    add("requestSit",
		"[\"obj_uuid\"]: id of object to sit on, use this or [\"position\"] to indicate the sit target"
		"[\"position\"]: region position {x, y, z} where to find closest object to sit on",
        &LLAgentListener::requestSit);
    add("requestStand",
        "Ask to stand up",
        &LLAgentListener::requestStand);
    add("requestTouch",
		"[\"obj_uuid\"]: id of object to touch, use this or [\"position\"] to indicate the object to touch"
		"[\"position\"]: region position {x, y, z} where to find closest object to touch"
		"[\"face\"]: optional object face number to touch[Default: 0]",
        &LLAgentListener::requestTouch);
    add("resetAxes",
        "Set the agent to a fixed orientation (optionally specify [\"lookat\"] = array of [x, y, z])",
        &LLAgentListener::resetAxes);
    add("getAxes",
        "Obsolete - use getPosition instead\n"
        "Send information about the agent's orientation on [\"reply\"]:\n"
        "[\"euler\"]: map of {roll, pitch, yaw}\n"
        "[\"quat\"]:  array of [x, y, z, w] quaternion values",
        &LLAgentListener::getAxes,
        LLSDMap("reply", LLSD()));
    add("getPosition",
        "Send information about the agent's position and orientation on [\"reply\"]:\n"
        "[\"region\"]: array of region {x, y, z} position\n"
        "[\"global\"]: array of global {x, y, z} position\n"
        "[\"euler\"]: map of {roll, pitch, yaw}\n"
        "[\"quat\"]:  array of [x, y, z, w] quaternion values",
        &LLAgentListener::getPosition,
        LLSDMap("reply", LLSD()));
    add("startAutoPilot",
        "Start the autopilot system using the following parameters:\n"
        "[\"target_global\"]: array of target global {x, y, z} position\n"
        "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]\n"
        "[\"target_rotation\"]: array of [x, y, z, w] quaternion values [default: no target]\n"
        "[\"rotation_threshold\"]: target maximum angle from target facing rotation [default: 0.03 radians]\n"
        "[\"behavior_name\"]: name of the autopilot behavior [default: \"\"]"
        "[\"allow_flying\"]: allow flying during autopilot [default: True]",
        //"[\"callback_pump\"]: pump to send success/failure and callback data to [default: none]\n"
        //"[\"callback_data\"]: data to send back during a callback [default: none]",
        &LLAgentListener::startAutoPilot);
    add("getAutoPilot",
        "Send information about current state of the autopilot system to [\"reply\"]:\n"
        "[\"enabled\"]: boolean indicating whether or not autopilot is enabled\n"
        "[\"target_global\"]: array of target global {x, y, z} position\n"
        "[\"leader_id\"]: uuid of target autopilot is following\n"
        "[\"stop_distance\"]: target maximum distance from target\n"
        "[\"target_distance\"]: last known distance from target\n"
        "[\"use_rotation\"]: boolean indicating if autopilot has a target facing rotation\n"
        "[\"target_facing\"]: array of {x, y} target direction to face\n"
        "[\"rotation_threshold\"]: target maximum angle from target facing rotation\n"
        "[\"behavior_name\"]: name of the autopilot behavior",
        &LLAgentListener::getAutoPilot,
        LLSDMap("reply", LLSD()));
    add("startFollowPilot",
		"[\"leader_id\"]: uuid of target to follow using the autopilot system (optional with avatar_name)\n"
		"[\"avatar_name\"]: avatar name to follow using the autopilot system (optional with leader_id)\n"
        "[\"allow_flying\"]: allow flying during autopilot [default: True]\n"
        "[\"stop_distance\"]: target maxiumum distance from target [default: autopilot guess]",
        &LLAgentListener::startFollowPilot);
    add("setAutoPilotTarget",
        "Update target for currently running autopilot:\n"
        "[\"target_global\"]: array of target global {x, y, z} position",
        &LLAgentListener::setAutoPilotTarget);
    add("stopAutoPilot",
        "Stop the autopilot system:\n"
        "[\"user_cancel\"] indicates whether or not to act as though user canceled autopilot [default: false]",
        &LLAgentListener::stopAutoPilot);
    add("lookAt",
		"[\"type\"]: number to indicate the lookAt type, 0 to clear\n"
		"[\"obj_uuid\"]: id of object to look at, use this or [\"position\"] to indicate the target\n"
		"[\"position\"]: region position {x, y, z} where to find closest object or avatar to look at",
        &LLAgentListener::lookAt);
}
void LLPanelDirBrowser::processDirLandReply(LLMessageSystem *msg, void**)
{
	LLUUID	agent_id;
	LLUUID	query_id;
	LLUUID	parcel_id;
	std::string	name;
	std::string land_sku;
	std::string land_type;
	BOOL	auction;
	BOOL	for_sale;
	S32		sale_price;
	S32		actual_area;

	msg->getUUID("AgentData", "AgentID", agent_id);
	msg->getUUID("QueryData", "QueryID", query_id );

	LLPanelDirBrowser* browser;
	browser = gDirBrowserInstances.getIfThere(query_id);
	if (!browser) 
	{
		// data from an old query
		return;
	}

	// Only handled by LLPanelDirLand
	LLPanelDirLand* self = (LLPanelDirLand*)browser;

	self->mHaveSearchResults = TRUE;

	LLCtrlListInterface *list = self->childGetListInterface("results");
	if (!list) return;

	if (!list->getCanSelect())
	{
		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
		self->mResultsContents = LLSD();
	}

	BOOL use_price = gSavedSettings.getBOOL("FindLandPrice");
	S32 limit_price = self->childGetValue("priceedit").asInteger();

	BOOL use_area = gSavedSettings.getBOOL("FindLandArea");
	S32 limit_area = self->childGetValue("areaedit").asInteger();

	S32 i;
	S32 count = msg->getNumberOfBlocks("QueryReplies");
	self->mResultsReceived += count;
	
	S32 non_auction_count = 0;
	for (i = 0; i < count; i++)
	{
		msg->getUUID(	"QueryReplies", "ParcelID", parcel_id, i);
		msg->getString(	"QueryReplies", "Name", name, i);
		msg->getBOOL(	"QueryReplies", "Auction", auction, i);
		msg->getBOOL(	"QueryReplies", "ForSale", for_sale, i);
		msg->getS32(	"QueryReplies", "SalePrice", sale_price, i);
		msg->getS32(	"QueryReplies", "ActualArea", actual_area, i);

		if ( msg->getSizeFast(_PREHASH_QueryReplies, i, _PREHASH_ProductSKU) > 0 )
		{
			msg->getStringFast(	_PREHASH_QueryReplies, _PREHASH_ProductSKU, land_sku, i);
			llinfos << "Land sku: " << land_sku << llendl;
			land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
		}
		else
		{
			land_sku.clear();
			land_type = LLTrans::getString("land_type_unknown");
		}

		if (parcel_id.isNull()) continue;

		if (use_price && (sale_price > limit_price)) continue;

		if (use_area && (actual_area < limit_area)) continue;

		LLSD content;
		S32 type;

		LLSD row = self->createLandSale(parcel_id, auction, for_sale,  name, &type);

		content["type"] = type;
		content["name"] = name;
		content["landtype"] = land_type;

		std::string buffer = "Auction";
		if (!auction)
		{
			buffer = llformat("%d", sale_price);
			non_auction_count++;
		}
		row["columns"][3]["column"] = "price";
		row["columns"][3]["value"] = buffer;
		row["columns"][3]["font"] = "SANSSERIFSMALL";

		buffer = llformat("%d", actual_area);
		row["columns"][4]["column"] = "area";
		row["columns"][4]["value"] = buffer;
		row["columns"][4]["font"] = "SANSSERIFSMALL";

		if (!auction)
		{
			F32 price_per_meter;
			if (actual_area > 0)
			{
				price_per_meter = (F32)sale_price / (F32)actual_area;
			}
			else
			{
				price_per_meter = 0.f;
			}
			// Prices are usually L$1 - L$10 / meter
			buffer = llformat("%.1f", price_per_meter);
			row["columns"][5]["column"] = "per_meter";
			row["columns"][5]["value"] = buffer;
			row["columns"][5]["font"] = "SANSSERIFSMALL";
		}
		else
		{
			// Auctions start at L$1 per meter
			row["columns"][5]["column"] = "per_meter";
			row["columns"][5]["value"] = "1.0";
			row["columns"][5]["font"] = "SANSSERIFSMALL";
		}

		row["columns"][6]["column"] = "landtype";
		row["columns"][6]["value"] = land_type;
		row["columns"][6]["font"] = "SANSSERIFSMALL";

		list->addElement(row);
		self->mResultsContents[parcel_id.asString()] = content;
	}

	// All auction results are shown on the first page
	// But they don't count towards the 100 / page limit
	// So figure out the next button here, when we know how many aren't auctions
	count = self->showNextButton(non_auction_count);

	self->updateResultCount();

	// Poke the result received timer
	self->mLastResultTimer.reset();
	self->mDidAutoSelect = FALSE;
}
Esempio n. 29
0
BOOL LLControlGroup::declareF32(const std::string& name, const F32 initial_val, const std::string& comment, BOOL persist)
{
	return declareControl(name, TYPE_F32, initial_val, comment, SANITY_TYPE_NONE, LLSD(), std::string(""), persist);
}
void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content)
{
	if(content["summary"]["used"][0]["type"].asString() == std::string("memory"))
	{
		mParcelMemoryUsed = content["summary"]["used"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
		mParcelMemoryMax = content["summary"]["available"][0]["amount"].asInteger() / SIZE_OF_ONE_KB;
		mGotParcelMemoryUsed = true;
	}
	else if(content["summary"]["used"][1]["type"].asString() == std::string("memory"))
	{
		mParcelMemoryUsed = content["summary"]["used"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
		mParcelMemoryMax = content["summary"]["available"][1]["amount"].asInteger() / SIZE_OF_ONE_KB;
		mGotParcelMemoryUsed = true;
	}
	else
	{
		LL_WARNS() << "summary doesn't contain memory info" << LL_ENDL;
		return;
	}

	if(content["summary"]["used"][0]["type"].asString() == std::string("urls"))
	{
		mParcelURLsUsed = content["summary"]["used"][0]["amount"].asInteger();
		mParcelURLsMax = content["summary"]["available"][0]["amount"].asInteger();
		mGotParcelURLsUsed = true;
	}
	else if(content["summary"]["used"][1]["type"].asString() == std::string("urls"))
	{
		mParcelURLsUsed = content["summary"]["used"][1]["amount"].asInteger();
		mParcelURLsMax = content["summary"]["available"][1]["amount"].asInteger();
		mGotParcelURLsUsed = true;
	}
	else
	{
		LL_WARNS() << "summary doesn't contain urls info" << LL_ENDL;
		return;
	}

	if((mParcelMemoryUsed >= 0) && (mParcelMemoryMax >= 0))
	{
		S32 parcel_memory_available = mParcelMemoryMax - mParcelMemoryUsed;

		LLStringUtil::format_map_t args_parcel_memory;
		args_parcel_memory["[COUNT]"] = llformat ("%d", mParcelMemoryUsed);
		args_parcel_memory["[MAX]"] = llformat ("%d", mParcelMemoryMax);
		args_parcel_memory["[AVAILABLE]"] = llformat ("%d", parcel_memory_available);
		std::string msg_parcel_memory = LLTrans::getString("ScriptLimitsMemoryUsed", args_parcel_memory);
		getChild<LLUICtrl>("memory_used")->setValue(LLSD(msg_parcel_memory));
	}

	if((mParcelURLsUsed >= 0) && (mParcelURLsMax >= 0))
	{
		S32 parcel_urls_available = mParcelURLsMax - mParcelURLsUsed;

		LLStringUtil::format_map_t args_parcel_urls;
		args_parcel_urls["[COUNT]"] = llformat ("%d", mParcelURLsUsed);
		args_parcel_urls["[MAX]"] = llformat ("%d", mParcelURLsMax);
		args_parcel_urls["[AVAILABLE]"] = llformat ("%d", parcel_urls_available);
		std::string msg_parcel_urls = LLTrans::getString("ScriptLimitsURLsUsed", args_parcel_urls);
		getChild<LLUICtrl>("urls_used")->setValue(LLSD(msg_parcel_urls));
	}
}