Esempio n. 1
0
	void sd_object::test<12>()
	{
		std::string expected("mytest\\");
		std::stringstream str;
		str << "'" << LLSDNotationFormatter::escapeString(expected) << "'";
		LLSD sd;
		S32 count = LLSDSerialize::fromNotation(sd, str);
		ensure_equals("parse count", count, 1);
		ensure_equals("string value", sd.asString(), expected);
	}
Esempio n. 2
0
std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, const std::string& control_name)
{
	if (type == TYPE_STRING)
		return sd.asString();
	else
	{
		CONTROL_ERRS << "Invalid string value for " << control_name << ": " << sd << llendl;
		return LLStringUtil::null;
	}
}
bool LLMainLoopRepeater::onMessage(LLSD const & event)
{
    try {
        mQueue->pushFront(event);
    } catch(LLThreadSafeQueueError & e) {
        LL_WARNS() << "could not repeat message (" << e.what() << ")" <<
                   event.asString() << LL_ENDL;
    }
    return false;
}
void JCFloaterAreaSearch::onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type)
{
	std::string text = value.asString();
	LLStringUtil::toLower(text);
	caller->setValue(text);
 	mFilterStrings[type] = text;
	//llinfos << "loaded " << name << " with "<< text << llendl;
	checkRegion();
	results();
}
// virtual
void LLFloaterWorldMap::onOpen(const LLSD& key)
{
//MK
	if (gRRenabled && (
		gAgent.mRRInterface.mContainsShowworldmap
		|| gAgent.mRRInterface.mContainsShowloc))
	{
//		return;
	}
//mk
	bool center_on_target = (key.asString() == "center");
	
	mIsClosing = FALSE;
	
	LLWorldMapView* map_panel;
	map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
	map_panel->clearLastClick();
	
	{
		// reset pan on show, so it centers on you again
		if (!center_on_target)
		{
			LLWorldMapView::setPan(0, 0, TRUE);
		}
		map_panel->updateVisibleBlocks();
		
		// Reload items as they may have changed
		LLWorldMap::getInstance()->reloadItems();
		
		// We may already have a bounding box for the regions of the world,
		// so use that to adjust the view.
		adjustZoomSliderBounds();
		
		// Could be first show
		//LLFirstUse::useMap();
		
		// Start speculative download of landmarks
		const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
		LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id);
		
		getChild<LLUICtrl>("location")->setFocus( TRUE);
		gFocusMgr.triggerFocusFlash();
		
		buildAvatarIDList();
		buildLandmarkIDLists();
		
		// If nothing is being tracked, set flag so the user position will be found
		mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
	}
	
	if (center_on_target)
	{
		centerOnTarget(FALSE);
	}
}
Esempio n. 6
0
void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
{
	LLFolderViewModelItemInventory* view_model = getCurSelectedViewModelItem();
	LLFolderViewItem* item = getCurSelectedItem();

	std::string command_name = userdata.asString();
	if("add_landmark" == command_name)
	{
		LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
		if(landmark)
		{
			LLNotificationsUtil::add("LandmarkAlreadyExists");
		}
		else
		{
			LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark"));
		}
	} 
	else if ("category" == command_name)
	{
		if (item && mCurrentSelectedList == mLandmarksInventoryPanel)
		{
			LLFolderViewModelItem* folder_bridge = NULL;

			if (view_model->getInventoryType()
					== LLInventoryType::IT_LANDMARK)
			{
				// for a landmark get parent folder bridge
				folder_bridge = item->getParentFolder()->getViewModelItem();
			}
			else if (view_model->getInventoryType()
					== LLInventoryType::IT_CATEGORY)
			{
				// for a folder get its own bridge
				folder_bridge = view_model;
			}

			menu_create_inventory_item(mCurrentSelectedList,
					dynamic_cast<LLFolderBridge*> (folder_bridge), LLSD(
							"category"), gInventory.findCategoryUUIDForType(
							LLFolderType::FT_LANDMARK));
		}
		else
		{
			//in case My Landmarks tab is completely empty (thus cannot be determined as being selected)
			menu_create_inventory_item(mLandmarksInventoryPanel, NULL,  LLSD("category"), 
				gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));

			if (mMyLandmarksAccordionTab)
			{
				mMyLandmarksAccordionTab->changeOpenClose(false);
			}
		}
	}
}
Esempio n. 7
0
// virtual
void LLIconCtrl::setValue(const LLSD& value )
{
	if (value.isUUID())
	{
		setImage(value.asUUID());
	}
	else
	{
		setImage(value.asString());
	}
}
bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
{
	LLUUID selected_group_id = getSelectedUUID();
	bool real_group_selected = selected_group_id.notNull(); // a "real" (not "none") group is selected

	// each group including "none" can be activated
//	if (userdata.asString() == "activate")
//		return gAgent.getGroupID() != selected_group_id;
// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f
	if (userdata.asString() == "activate")
		return (gAgent.getGroupID() != selected_group_id) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP));
	else if (userdata.asString() == "leave")
		return (real_group_selected) && ((gAgent.getGroupID() != selected_group_id) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP)));
// [/RLVa:KB]

	if (userdata.asString() == "call")
	  return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();

	return real_group_selected;
}
Esempio n. 9
0
	void onCreate(const LLSD& data)
	{
		LLWearableType::EType type = LLWearableType::typeNameToType(data.asString());
		if (type == LLWearableType::WT_NONE)
		{
			llwarns << "Invalid wearable type" << llendl;
			return;
		}

		LLAgentWearables::createWearable(type, true);
	}
Esempio n. 10
0
bool LLPanelPicks::isActionEnabled(const LLSD& userdata) const
{
	std::string command_name = userdata.asString();

	if (command_name == "new_pick" && LLAgentPicksInfo::getInstance()->isPickLimitReached())
	{
		return false;
	}

	return true;
}
Esempio n. 11
0
// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value )
{
	LLSD tvalue(value);
	if (value.isString() && LLUUID::validate(value.asString()))
	{
		//RN: support UUIDs masquerading as strings
		tvalue = LLSD(LLUUID(value.asString()));
	}
	LLUICtrl::setValue(tvalue);
	if (tvalue.isUUID())
	{
		mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority);
	}
	else
	{
		mImagep = LLUI::getUIImage(tvalue.asString(), mPriority);
	}

	setIconImageDrawSize();
}
// called when the Delete Entry button is pressed
void LLFloaterAutoReplaceSettings::onDeleteEntry()
{
	LLSD selectedRow = mReplacementsList->getSelectedValue();
	if (selectedRow.isDefined())
	{	
		std::string keyword = selectedRow.asString();
		mReplacementsList->deleteSelectedItems(); // delete from the control
		mSettings.removeEntryFromList(keyword, mSelectedListName); // delete from the local settings copy
		disableReplacementEntry(); // no selection active, so turn off the buttons
	}
}
void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
{
	std::string filter = data.asString();
	rebuildLocationHistory(filter);

	//Let's add landmarks to the top of the list if any
	if(!filter.empty() )
	{
		LLInventoryModel::item_array_t landmark_items = LLLandmarkActions::fetchLandmarksByName(filter, TRUE);

		for(U32 i=0; i < landmark_items.size(); i++)
		{
			LLSD value;
			//TODO:: DO we need tooltip for Landmark??
			
			value["item_type"] = LANDMARK;
			value["AssetUUID"] =  landmark_items[i]->getAssetUUID(); 
			add(landmark_items[i]->getName(), value);
			
		}
	//Let's add teleport history items
		LLTeleportHistory* th = LLTeleportHistory::getInstance();
		LLTeleportHistory::slurl_list_t th_items = th->getItems();

		std::set<std::string> new_item_titles;// duplicate control
		LLTeleportHistory::slurl_list_t::iterator result = std::find_if(
				th_items.begin(), th_items.end(), boost::bind(
						&LLLocationInputCtrl::findTeleportItemsByTitle, this,
						_1, filter));

		while (result != th_items.end())
		{
			//mTitile format - region_name[, parcel_name]
			//mFullTitile format - region_name[, parcel_name] (local_x,local_y, local_z)
			if (new_item_titles.insert(result->mFullTitle).second)
			{
				LLSD value;
				value["item_type"] = TELEPORT_HISTORY;
				value["global_pos"] = result->mGlobalPos.getValue();
				std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
				//TODO*: add Surl to teleportitem or parse region name from title
				value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name,
						result->mGlobalPos,	false);
				add(result->getTitle(), value); 
			}
			result = std::find_if(result + 1, th_items.end(), boost::bind(
									&LLLocationInputCtrl::findTeleportItemsByTitle, this,
									_1, filter));
		}
	}
	sortByName();
	
	mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item.
}
void LLPanelMainInventory::setSortBy(const LLSD& userdata)
{
	std::string sort_field = userdata.asString();
	if (sort_field == "name")
	{
		U32 order = getActivePanel()->getSortOrder();
		getActivePanel()->setSortOrder( order & ~LLInventoryFilter::SO_DATE );
			
		gSavedSettings.setBOOL("Inventory.SortByName", TRUE );
		gSavedSettings.setBOOL("Inventory.SortByDate", FALSE );
	}
	else if (sort_field == "date")
	{
		U32 order = getActivePanel()->getSortOrder();
		getActivePanel()->setSortOrder( order | LLInventoryFilter::SO_DATE );

		gSavedSettings.setBOOL("Inventory.SortByName", FALSE );
		gSavedSettings.setBOOL("Inventory.SortByDate", TRUE );
	}
	else if (sort_field == "foldersalwaysbyname")
	{
		U32 order = getActivePanel()->getSortOrder();
		if ( order & LLInventoryFilter::SO_FOLDERS_BY_NAME )
		{
			order &= ~LLInventoryFilter::SO_FOLDERS_BY_NAME;

			gSavedSettings.setBOOL("Inventory.FoldersAlwaysByName", FALSE );
		}
		else
		{
			order |= LLInventoryFilter::SO_FOLDERS_BY_NAME;

			gSavedSettings.setBOOL("Inventory.FoldersAlwaysByName", TRUE );
		}
		getActivePanel()->setSortOrder( order );
	}
	else if (sort_field == "systemfolderstotop")
	{
		U32 order = getActivePanel()->getSortOrder();
		if ( order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP )
		{
			order &= ~LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;

			gSavedSettings.setBOOL("Inventory.SystemFoldersToTop", FALSE );
		}
		else
		{
			order |= LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;

			gSavedSettings.setBOOL("Inventory.SystemFoldersToTop", TRUE );
		}
		getActivePanel()->setSortOrder( order );
	}
}
Esempio n. 15
0
bool LLCrashLogger::init()
{
	// We assume that all the logs we're looking for reside on the current drive
	gDirUtilp->initAppDirs("SecondLife");

	// Default to the product name "Second Life" (this is overridden by the -name argument)
	mProductName = "Second Life";
	
	mCrashSettings.declareS32(CRASH_BEHAVIOR_SETTING, CRASH_BEHAVIOR_ASK, "Controls behavior when viewer crashes "
		"(0 = ask before sending crash report, 1 = always send crash report, 2 = never send crash report)");

	llinfos << "Loading crash behavior setting" << llendl;
	mCrashBehavior = loadCrashBehaviorSetting();

	//Run through command line options
	if(getOption("previous").isDefined())
	{
		llinfos << "Previous execution did not remove SecondLife.exec_marker" << llendl;
		mCrashInPreviousExec = TRUE;
	}

	if(getOption("dialog").isDefined())
	{
		llinfos << "Show the user dialog" << llendl;
		mCrashBehavior = CRASH_BEHAVIOR_ASK;
	}
	
	LLSD name = getOption("name");
	if(name.isDefined())
	{	
		mProductName = name.asString();
	}

	// If user doesn't want to send, bail out
	if (mCrashBehavior == CRASH_BEHAVIOR_NEVER_SEND)
	{
		llinfos << "Crash behavior is never_send, quitting" << llendl;
		return false;
	}

	gServicePump = new LLPumpIO(gAPRPoolp);
	gServicePump->prime(gAPRPoolp);
	LLHTTPClient::setPump(*gServicePump);

	//If we've opened the crash logger, assume we can delete the marker file if it exists	
	if( gDirUtilp )
	{
		std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker");
		ll_apr_file_remove( marker_file );
	}
	
	return true;
}
Esempio n. 16
0
	bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
	{
		std::string search_type = userdata.asString();
		if(search_type == "name")
		{
			mPtr->getActivePanel()->setSearchType(0);

			gSavedPerAccountSettings.setU32("rkeastInventorySearchType",0);
			
			mPtr->getControl("Inventory.SearchByName")->setValue(TRUE);
			mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE);	
			mPtr->getControl("Inventory.SearchByDesc")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE);
		}
		else if(search_type == "creator")
		{
			mPtr->getActivePanel()->setSearchType(1);

			gSavedPerAccountSettings.setU32("rkeastInventorySearchType",1);

			mPtr->getControl("Inventory.SearchByName")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByCreator")->setValue(TRUE);
			mPtr->getControl("Inventory.SearchByDesc")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE);
		}
		else if(search_type == "desc")
		{
			mPtr->getActivePanel()->setSearchType(2);

			gSavedPerAccountSettings.setU32("rkeastInventorySearchType",2);

			mPtr->getControl("Inventory.SearchByName")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByDesc")->setValue(TRUE);
			mPtr->getControl("Inventory.SearchByAll")->setValue(FALSE);
		}
		else if(search_type == "all")
		{
			mPtr->getActivePanel()->setSearchType(3);

			gSavedPerAccountSettings.setU32("rkeastInventorySearchType",3);

			mPtr->getControl("Inventory.SearchByName")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByDesc")->setValue(FALSE);
			mPtr->getControl("Inventory.SearchByAll")->setValue(TRUE);
		}
		
		//Clear search when switching modes.
		mPtr->getActivePanel()->setFilterSubString(LLStringUtil::null);
		mPtr->getActivePanel()->setFilterTypes(0xffffffff);
	return true;
	}
Esempio n. 17
0
// static
void LLButton::setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
{
	LLButton* button = dynamic_cast<LLButton*>(ctrl);
	if (!button)
		return;
	// Get the visibility control name for the floater
	std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString());
	// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
	button->setControlVariable(LLUI::sSettingGroups["floater"]->getControl(vis_control_name));
	// Set the clicked callback to toggle the floater
	button->setClickedCallback(boost::bind(&LLDockableFloater::toggleInstance, sdname));
}
Esempio n. 18
0
bool LLLandmarksPanel::isActionChecked(const LLSD& userdata) const
{
	const std::string command_name = userdata.asString();

	if ( "sort_by_date" == command_name)
	{
		bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
		return  sorting_order;
	}

	return false;
}
Esempio n. 19
0
	bool onEnable(const LLSD& data)
	{
		std::string param = data.asString();
		LLUUID selected_id = mUUIDs.back();

		if ("edit" == param)
		{
			return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
		}

		return true;
	}
Esempio n. 20
0
void LLParticipantList::LLParticipantListMenu::sortParticipantList(const LLSD& userdata)
{
	std::string param = userdata.asString();
	if ("sort_by_name" == param)
	{
		mParent.setSortOrder(E_SORT_BY_NAME);
	}
	else if ("sort_by_recent_speakers" == param)
	{
		mParent.setSortOrder(E_SORT_BY_RECENT_SPEAKERS);
	}
}
Esempio n. 21
0
bool NearbyMenu::checkContextMenuItem(const LLSD& userdata)
{
	std::string item = userdata.asString();
	const LLUUID& id = mUUIDs.front();

	if (item == std::string("is_blocked"))
	{
		return LLAvatarActions::isBlocked(id);
	}

	return false;
}
Esempio n. 22
0
bool LLPanelPeople::onFriendsViewSortMenuItemCheck(const LLSD& userdata) 
{
	std::string item = userdata.asString();
	U32 sort_order = gSavedSettings.getU32("FriendsSortOrder");

	if (item == "sort_name") 
		return sort_order == E_SORT_BY_NAME;
	if (item == "sort_status")
		return sort_order == E_SORT_BY_STATUS;

	return false;
}
Esempio n. 23
0
bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata) 
{
	std::string item = userdata.asString();
	U32 sort_order = gSavedSettings.getU32("RecentPeopleSortOrder");

	if (item == "sort_recent")
		return sort_order == E_SORT_BY_MOST_RECENT;
	if (item == "sort_name") 
		return sort_order == E_SORT_BY_NAME;

	return false;
}
Esempio n. 24
0
// <FS:CR> Milkshake-style radar alerts
//static
void FSRadar::onRadarReportToClicked(const LLSD& userdata)
{
	std::string chosen_item = userdata.asString();
	if (chosen_item == "radar_toasts")
	{
		gSavedSettings.setBOOL("FSMilkshakeRadarToasts", TRUE);
	}
	else if (chosen_item == "radar_nearby_chat")
	{
		gSavedSettings.setBOOL("FSMilkshakeRadarToasts", FALSE);
	}
}
bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
{
	bool result = false;
	switch (mType)
	{
	case TYPE_U32:
	case TYPE_S32:
		result = a.asInteger() == b.asInteger();
		break;
	case TYPE_BOOLEAN:
		result = a.asBoolean() == b.asBoolean();
		break;
	case TYPE_F32:
		result = a.asReal() == b.asReal();
		break;
	case TYPE_VEC3:
	case TYPE_VEC3D:
		result = LLVector3d(a) == LLVector3d(b);
		break;
	case TYPE_RECT:
		result = LLRect(a) == LLRect(b);
		break;
	case TYPE_COL4:
		result = LLColor4(a) == LLColor4(b);
		break;
	case TYPE_COL3:
		result = LLColor3(a) == LLColor3(b);
		break;
	case TYPE_COL4U:
		result = LLColor4U(a) == LLColor4U(b);
		break;
	case TYPE_STRING:
		result = a.asString() == b.asString();
		break;
	default:
		break;
	}

	return result;
}
	bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
	{
		LLInventoryPanel *panel = mPtr;
		LLFolderView* folder = panel->getRootFolder();
		if(!folder) return true;

		std::set<LLUUID> selected_items = folder->getSelectionList();
		LLUUID id = *selected_items.begin();

		std::string joint_name = userdata.asString();
		LLViewerJointAttachment* attachmentp = NULL;
		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
			 iter != gAgentAvatarp->mAttachmentPoints.end(); )
		{
			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
			LLViewerJointAttachment* attachment = curiter->second;
			if (attachment->getName() == joint_name)
			{
				attachmentp = attachment;
				break;
			}
		}
		if (!attachmentp)
		{
			return true;
		}
		if (LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id))
		{
			if(gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID()))
			{
				rez_attachment(item, attachmentp);	// don't replace if called from an "Attach To..." menu
			}
			else if(item->isFinished())
			{
				// must be in library. copy it to our inventory and put it on.
//				LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&rez_attachment_cb, _1, attachmentp));
// [SL:KB] - Patch: Appearance-DnDWear | Checked: 2013-02-04 (Catznip-3.4)
				LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&rez_attachment_cb, _1, attachmentp, false));
// [/SL;KB]
				copy_inventory_item(
					gAgentID,
					item->getPermissions().getOwner(),
					item->getUUID(),
					LLUUID::null,
					std::string(),
					cb);
			}
		}
		gFocusMgr.setKeyboardFocus(NULL);

		return true;
	}
Esempio n. 27
0
void LLPanelPicks::onPlusMenuItemClicked(const LLSD& param)
{
	std::string value = param.asString();

	if("new_pick" == value)
	{
		createNewPick();
	}
	else if("new_classified" == value)
	{
		createNewClassified();
	}
}
Esempio n. 28
0
bool LLProgressView::handleUpdate(const LLSD& event_data)
{
	LLSD message = event_data.get("message");
	LLSD desc = event_data.get("desc");
	LLSD percent = event_data.get("percent");

	if(message.isDefined())
	{
		setMessage(message.asString());
	}

	if(desc.isDefined())
	{
		setText(desc.asString());
	}
	
	if(percent.isDefined())
	{
		setPercent(percent.asReal());
	}
	return false;
}
Esempio n. 29
0
//static
bool FSRadar::radarReportToCheck(const LLSD& userdata)
{
	std::string menu_item = userdata.asString();
	bool report_to = gSavedSettings.getBOOL("FSMilkshakeRadarToasts");
	if (report_to)
	{
		return (menu_item == "radar_toasts");
	}
	else
	{
		return (menu_item == "radar_nearby_chat");
	}
}
Esempio n. 30
0
bool LLPanelPicks::onEnableMenuItem(const LLSD& user_data)
{
	std::string param = user_data.asString();

	LLClassifiedItem* c_item = dynamic_cast<LLClassifiedItem*>(mClassifiedsList->getSelectedItem());
	if(c_item && "info" == param)
	{
		// dont show Info panel if classified was not created
		return isClassifiedPublished(c_item);
	}

	return true;
}