BOOL LLFloaterExploreSounds::postBuild(void)
{
    LLScrollListCtrl* soundlist = getChild<LLScrollListCtrl>("sound_list");
    soundlist->setDoubleClickCallback(boost::bind(&LLFloaterExploreSounds::handle_play_locally,this));
    soundlist->sortByColumn("playing", TRUE);

    childSetAction("play_locally_btn", handle_play_locally, this);
    childSetAction("look_at_btn", handle_look_at, this);
    childSetAction("stop_btn", handle_stop, this);
    childSetAction("bl_btn", blacklistSound, this);


    return TRUE;
}
Esempio n. 2
0
void LLPanelFriends::updateColumns(void* user_data)
{
	LLPanelFriends* panelp = (LLPanelFriends*)user_data;
	if (panelp)
	{
		LLButton* expand_button = panelp->getChild<LLButton>("expand_collapse_btn");
		LLScrollListCtrl* list = panelp->getChild<LLScrollListCtrl>("friend_list");
		//llinfos << "Refreshing UI" << llendl;
		S32 width = 22;
		std::string button = ">";
		if (gSavedSettings.getBOOL("ContactListCollapsed"))
		{
			width = 0;
			button = "<";
		}
		expand_button->setLabel(button);
		LLScrollListColumn* column = list->getColumn(5);
		list->updateStaticColumnWidth(column, width);
		column->setWidth(width);
		column = list->getColumn(6);
		list->updateStaticColumnWidth(column, width);
		column->setWidth(width);
		column = list->getColumn(7);
		list->updateStaticColumnWidth(column, width);
		column->setWidth(width);
		list->updateLayout();
		if (!gSavedSettings.getBOOL("ContactListCollapsed"))
		{
			panelp->updateFriends(LLFriendObserver::ADD);
		}
	}
}
BOOL LLFloaterExploreSounds::postBuild(void)
{
	childSetDoubleClickCallback("sound_list", handle_play_locally, this);

	childSetAction("play_locally_btn", handle_play_locally, this);
	childSetAction("look_at_btn", handle_look_at, this);
	childSetAction("open_btn", handle_open, this);
	childSetAction("copy_uuid_btn", handle_copy_uuid, this);
	childSetAction("stop_btn", handle_stop, this);
	childSetAction("bl_btn", blacklistSound, this);

	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("sound_list");
	list->sortByColumn("playing", TRUE);
	return TRUE;
}
BOOL LLFloaterVFSExplorer::postBuild()
{
	childSetCommitCallback("file_list", onCommitFileList, this);

	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
	list->setDoubleClickCallback(boost::bind(&LLFloaterVFSExplorer::onClickItem, this));

	childSetAction("remove_btn", onClickRemove, this);
	childSetAction("reload_all_btn", onClickReload, this);
	childSetAction("copy_uuid_btn", onClickCopyUUID, this);
	childSetAction("edit_data_btn", onClickEditData, this);
	childSetAction("item_btn", onClickItem, this);
	refresh();
	return TRUE;
}
void LLFloaterTopObjects::updateSelectionInfo()
{
	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");

	if (!list) return;

	LLUUID object_id = list->getCurrentID();
	if (object_id.isNull()) return;

	std::string object_id_string = object_id.asString();

	childSetValue("id_editor", LLSD(object_id_string));
	childSetValue("object_name_editor", list->getFirstSelected()->getColumn(1)->getValue().asString());
	childSetValue("owner_name_editor", list->getFirstSelected()->getColumn(2)->getValue().asString());
}
// static
void LLFloaterBlacklist::onClickRemove(void* user_data)
{
	LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
	LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
	if(list->getFirstSelected())
	{
		LLScrollListItem* item = list->getFirstSelected();
		LLUUID selected_id = item->getColumn(0)->getValue().asUUID();
		if(selected_id.isNull()) return;
		list->deleteSingleItem(list->getFirstSelectedIndex());
		blacklist_entries.erase(selected_id);
		updateBlacklists();
		
	}
}
void lggAutoCorrectFloater::updateItemsList()
{
	entryList->deleteAllItems();
	if((namesList->getAllSelected().size())<=0)
	{

		updateListControlsEnabled(FALSE);
		return;
	}

	updateListControlsEnabled(TRUE);
	std::string listName= namesList->getFirstSelected()->getColumn(0)->getValue().asString();
	
	LLSD listData = LGGAutoCorrect::getInstance()->getAutoCorrectEntries(listName);
	childSetValue("em_ac_list_enabled",listData["enabled"].asBoolean());
	childSetValue("em_ac_list_style",listData["wordStyle"].asBoolean());
	childSetValue("em_ac_list_show",listData["announce"].asBoolean());
	childSetValue("em_ac_text_name",listName);
	childSetValue("em_ac_text_author",listData["author"]);
	childSetValue("em_ac_priority",listData["priority"]);
	static S32 *countAuto= rebind_llcontrol<S32>("EmeraldAutoCorrectCount", &gSavedSettings, true);
	childSetValue("em_ac_stats",*countAuto);
	
	LLSD autoCorrects = listData["data"];
	LLSD::map_const_iterator loc_it = autoCorrects.beginMap();
	LLSD::map_const_iterator loc_end = autoCorrects.endMap();
	for ( ; loc_it != loc_end; ++loc_it)
	{
		const std::string& wrong = (*loc_it).first;
		const std::string& right = (*loc_it).second;

		//std::string lentry(wrong+"=>"+right);

		LLSD element;
		element["id"] = wrong;
		LLSD& s_column = element["columns"][0];
		s_column["column"] = "Search";
		s_column["value"] = wrong;
		s_column["font"] = "SANSSERIF";
		LLSD& r_column = element["columns"][1];
		r_column["column"] = "Replace";
		r_column["value"] = right;
		r_column["font"] = "SANSSERIF";

		entryList->addElement(element, ADD_BOTTOM);
	}
	
}
void LLFloaterExploreAnimations::update()
{
	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("anim_list");
	LLUUID selection = list->getSelectedValue().asUUID();
	list->clearRows(); // do this differently probably

    std::string fullname;
    if (gCacheName->getFullName(mAvatarID, fullname))
    {
        setTitle(mTitle + ": " + fullname);
    }
    else
    {
        setTitle(mTitle + ": INVALID AVATAR (" + mAvatarID.asString() + ")");
	}


	std::list<LLAnimHistoryItem*> history = animHistory[mAvatarID];
	std::list<LLAnimHistoryItem*>::iterator iter = history.begin();
	std::list<LLAnimHistoryItem*>::iterator end = history.end();
	for( ; iter != end; ++iter)
	{
		LLAnimHistoryItem* item = (*iter);

		if (gSavedSettings.getBOOL("PhoenixFilterDefaultAnims") && isLindenDefaultAnim(item->mAssetID.asString().c_str()))
		{
			continue;
		}

		LLSD element;
		element["id"] = item->mAssetID;

		LLSD& name_column = element["columns"][0];
		name_column["column"] = "name";
		name_column["value"] = item->mAssetID.asString();

		LLSD& info_column = element["columns"][1];
		info_column["column"] = "info";
		if(item->mPlaying)
			info_column["value"] = "Playing";
		else
			info_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item->mTimeStopped) / 60.f);

		list->addElement(element, ADD_BOTTOM);
	}

	list->selectByID(selection);
}
void LLFloaterAttachments::onClickViewChildren(void* user_data)
{
	LLFloaterAttachments* floaterp = (LLFloaterAttachments*)user_data;

	LLScrollListCtrl* scrollp = floaterp->getChild<LLScrollListCtrl>("attachment_list");
	LLScrollListItem* scroll_itemp = scrollp->getFirstSelected();
	if(scroll_itemp && !floaterp->mViewingChildren)
	{
		LLUUID primid = scroll_itemp->getUUID();
		if(floaterp->mHUDAttachmentHierarchy.count(primid) > 0)
		{
			scrollp->clearRows();

			std::multimap<LLUUID, LLUUID>::iterator child_begin = floaterp->mHUDAttachmentHierarchy.lower_bound(primid);
			std::multimap<LLUUID, LLUUID>::iterator child_end = floaterp->mHUDAttachmentHierarchy.upper_bound(primid);

			while(child_begin != child_end)
			{
				LLHUDAttachment* hud_prim = floaterp->mHUDAttachmentPrims[child_begin->second];
				floaterp->addAttachmentToList(hud_prim->mObjectID, hud_prim->mName, hud_prim->mDescription);
				child_begin++;
			}
			floaterp->getChild<LLButton>("view_children_btn")->setLabel(std::string("Parent..."));
			floaterp->mViewingChildren = true;
		}
	}
	else if(floaterp->mViewingChildren)
	{
		if(floaterp->mHUDAttachmentHierarchy.count(floaterp->mAvatarID) > 0)
		{
			scrollp->clearRows();

			std::multimap<LLUUID, LLUUID>::iterator parent_begin = floaterp->mHUDAttachmentHierarchy.lower_bound(floaterp->mAvatarID);
			std::multimap<LLUUID, LLUUID>::iterator parent_end = floaterp->mHUDAttachmentHierarchy.upper_bound(floaterp->mAvatarID);

			while(parent_begin != parent_end)
			{
				LLHUDAttachment* hud_prim = floaterp->mHUDAttachmentPrims[parent_begin->second];
				floaterp->addAttachmentToList(hud_prim->mObjectID, hud_prim->mName, hud_prim->mDescription);
				parent_begin++;
			}
			floaterp->getChild<LLButton>("view_children_btn")->setLabel(std::string("Children..."));
			floaterp->mViewingChildren = false;
		}
	}

	floaterp->refreshButtons();
}
BOOL LLNotificationChannelPanel::postBuild()
{
	LLButton* header_button = getChild<LLButton>("header");
	header_button->setLabel(mChannelPtr->getName());
	header_button->setClickedCallback(toggleClick, this);

	mChannelPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1, true));
	mChannelRejectsPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1, false));

	LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("notifications_list");
	scroll->setDoubleClickCallback(onClickNotification, this);
	scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0));
	scroll = getChild<LLScrollListCtrl>("notification_rejects_list");
	scroll->setDoubleClickCallback(onClickNotificationReject, this);
	scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0));
	return TRUE;
}
Esempio n. 11
0
// reacts to user clicking a valid field in the local scroll list.
void LLFloaterTexturePicker::onLocalScrollCommit()
{
	LLUUID id(mLocalScrollCtrl->getSelectedItemLabel(LOCALLIST_COL_ID));

	mOwner->setImageAssetID(id);
	if (childGetValue("apply_immediate_check").asBoolean())
		mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE, id); // calls an overridden function.
}
void LLFloaterTelehub::unpackTelehubInfo(LLMessageSystem* msg)
{
	msg->getUUID("TelehubBlock", "ObjectID", mTelehubObjectID);
	msg->getString("TelehubBlock", "ObjectName", mTelehubObjectName);
	msg->getVector3("TelehubBlock", "TelehubPos", mTelehubPos);
	msg->getQuat("TelehubBlock", "TelehubRot", mTelehubRot);

	mNumSpawn = msg->getNumberOfBlocks("SpawnPointBlock");
	for (S32 i = 0; i < mNumSpawn; i++)
	{
		msg->getVector3("SpawnPointBlock", "SpawnPointPos", mSpawnPointPos[i], i);
	}

	// Update parts of the UI that change only when message received.

	if (mTelehubObjectID.isNull())
	{
		getChildView("status_text_connected")->setVisible( false);
		getChildView("status_text_not_connected")->setVisible( true);
		getChildView("help_text_connected")->setVisible( false);
		getChildView("help_text_not_connected")->setVisible( true);
	}
	else
	{
		getChild<LLUICtrl>("status_text_connected")->setTextArg("[OBJECT]", mTelehubObjectName);
		getChildView("status_text_connected")->setVisible( true);
		getChildView("status_text_not_connected")->setVisible( false);
		getChildView("help_text_connected")->setVisible( true);
		getChildView("help_text_not_connected")->setVisible( false);
	}

	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
	if (list)
	{
		list->deleteAllItems();
		for (S32 i = 0; i < mNumSpawn; i++)
		{
			std::string pos = llformat("%.1f, %.1f, %.1f", 
									mSpawnPointPos[i].mV[VX],
									mSpawnPointPos[i].mV[VY],
									mSpawnPointPos[i].mV[VZ]);
			list->addSimpleElement(pos);
		}
		list->selectNthItem(mNumSpawn - 1);
	}
}
void LLFloaterMessageLog::refreshNetInfo(BOOL force)
{
	if(mInfoPaneMode != IPANE_NET) return;
	LLScrollListCtrl* scrollp = getChild<LLScrollListCtrl>("net_list");
	LLScrollListItem* selected_itemp = scrollp->getFirstSelected();
	if(selected_itemp)
	{
		LLTextEditor* net_info = getChild<LLTextEditor>("net_info");
		if(!force && (net_info->hasSelection() || net_info->hasFocus())) return;
		LLNetListItem* itemp = findNetListItem(selected_itemp->getUUID());
		if(itemp)
		{
			std::string info(llformat("%s, %d\n--------------------------------\n\n", itemp->mName.c_str(), itemp->mHandle));
			if(itemp->mCircuitData)
			{
				LLCircuitData* cdp = itemp->mCircuitData;
				info.append("Circuit\n--------------------------------\n");
				info.append(llformat(" * Host: %s\n", cdp->getHost().getString().c_str()));
				S32 seconds = (S32)cdp->getAgeInSeconds();
				S32 minutes = seconds / 60;
				seconds = seconds % 60;
				S32 hours = minutes / 60;
				minutes = minutes % 60;
				info.append(llformat(" * Age: %dh %dm %ds\n", hours, minutes, seconds));
				info.append(llformat(" * Alive: %s\n", cdp->isAlive() ? "yes" : "no"));
				info.append(llformat(" * Blocked: %s\n", cdp->isBlocked() ? "yes" : "no"));
				info.append(llformat(" * Allow timeout: %s\n", cdp->getAllowTimeout() ? "yes" : "no"));
				info.append(llformat(" * Trusted: %s\n", cdp->getTrusted() ? "yes" : "no"));
				info.append(llformat(" * Ping delay: %d\n", cdp->getPingDelay()));
				info.append(llformat(" * Packets out: %d\n", cdp->getPacketsOut()));
				info.append(llformat(" * Bytes out: %d\n", cdp->getBytesOut()));
				info.append(llformat(" * Packets in: %d\n", cdp->getPacketsIn()));
				info.append(llformat(" * Bytes in: %d\n", cdp->getBytesIn()));
				info.append(llformat(" * Endpoint ID: %s\n", cdp->getLocalEndPointID().asString().c_str()));
				info.append(llformat(" * Remote ID: %s\n", cdp->getRemoteID().asString().c_str()));
				info.append(llformat(" * Remote session ID: %s\n", cdp->getRemoteSessionID().asString().c_str()));
				info.append("\n");
			}

			childSetText("net_info", info);
		}
		else childSetText("net_info", std::string(""));
	}
	else childSetText("net_info", std::string(""));
}
BOOL LLFloaterTelehub::postBuild()
{
	gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo);

	getChild<LLUICtrl>("connect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickConnect, this));
	getChild<LLUICtrl>("disconnect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickDisconnect, this));
	getChild<LLUICtrl>("add_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickAddSpawnPoint, this));
	getChild<LLUICtrl>("remove_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickRemoveSpawnPoint, this));

	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list");
	if (list)
	{
		// otherwise you can't walk with arrow keys while floater is up
		list->setAllowKeyboardMovement(FALSE);
	}

	return TRUE;
}
// static
void LLFloaterExploreSounds::handle_stop(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	std::vector<LLScrollListItem*> selection = list->getAllSelected();
	std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
	std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
	std::vector<LLUUID> asset_list;
	for( ; selection_iter != selection_end; ++selection_iter)
	{
		LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
		if(item.mID.isNull()) continue;
		if(item.isPlaying())
		{
			item.mAudioSource->play(LLUUID::null);
		}
	}
}
Esempio n. 16
0
// static
void LLFloaterMessageLog::onClickSendToMessageBuilder(void* user_data)
{
	LLFloaterMessageLog* floaterp = (LLFloaterMessageLog*)user_data;
	LLScrollListCtrl* scrollp = floaterp->getChild<LLScrollListCtrl>("message_log");
	LLScrollListItem* selected_itemp = scrollp->getFirstSelected();
	if(!selected_itemp) return;
	LLUUID id = selected_itemp->getUUID();
	std::vector<LLFloaterMessageLogItem>::iterator end = sFloaterMessageLogItems.end();
	for(std::vector<LLFloaterMessageLogItem>::iterator iter = sFloaterMessageLogItems.begin(); iter != end; ++iter)
	{
		if(iter->mID == id)
		{
			std::string message_text = iter->getFull(FALSE);
			LLFloaterMessageBuilder::show(message_text);
			break;
		}
	}
}
// static
void LLFloaterMessageLog::onCommitMessageLog(LLUICtrl* ctrl, void* user_data)
{
	LLFloaterMessageLog* floaterp = (LLFloaterMessageLog*)user_data;
	LLScrollListCtrl* scrollp = floaterp->getChild<LLScrollListCtrl>("message_log");
	LLScrollListItem* selected_itemp = scrollp->getFirstSelected();
	if(!selected_itemp) return;
	LLUUID id = selected_itemp->getUUID();
	std::vector<LLFloaterMessageLogItem>::iterator end = sFloaterMessageLogItems.end();
	for(std::vector<LLFloaterMessageLogItem>::iterator iter = sFloaterMessageLogItems.begin(); iter != end; ++iter)
	{
		if(iter->mID == id)
		{
			floaterp->setNetInfoMode(NI_LOG);
			floaterp->childSetText("net_info", iter->getFull(FALSE));
			break;
		}
	}
}
//static
void LLFloaterTeleportHistory::saveFile(const std::string &file_name)
{
    LLFloaterTeleportHistory *pFloaterHistory = LLFloaterTeleportHistory::findInstance();
    if(!pFloaterHistory)
        return;

    std::string temp_str = gDirUtilp->getLindenUserDir(true);
    if( temp_str.empty() )
    {
        LL_INFOS() << "Can't save teleport history - no user directory set yet." << LL_ENDL;
        return;
    }
    temp_str += gDirUtilp->getDirDelimiter() + file_name;
    llofstream export_file(temp_str);
    if (!export_file.good())
    {
        LL_WARNS() << "Unable to open " << file_name << " for output." << LL_ENDL;
        return;
    }
    LL_INFOS() << "Writing "<< file_name << " file at " << temp_str << LL_ENDL;

    LLSD elements;
    LLScrollListCtrl* pScrollList = pFloaterHistory->mPlacesList;
    if (pScrollList)
    {
        std::vector<LLScrollListItem*> data_list = pScrollList->getAllData();
        std::sort(data_list.begin(),data_list.end(),SortByAge());//Re-sort. Column sorting may have mucked the list up. Newer entries in front.
        for (std::vector<LLScrollListItem*>::iterator itr = data_list.begin(); itr != data_list.end(); ++itr)
        {
            //Pack into LLSD mimicing one passed to addElement
            LLSD data_entry;
            //id is actually reverse of the indexing of the element LLSD. Higher id = newer.
            data_entry["id"] = pScrollList->getItemCount() - elements.size() - 1;
            for(S32 i = 0; i < (*itr)->getNumColumns(); ++i)
            {
                data_entry["columns"][i]["column"]=pScrollList->getColumn(i)->mName;
                data_entry["columns"][i]["value"]=(*itr)->getColumn(i)->getValue();
            }
            elements.append(data_entry);
        }
    }
    LLSDSerialize::toXML(elements, export_file);
    export_file.close();
}
Esempio n. 19
0
BOOL LLPanelDirLand::postBuild()
{
	LLPanelDirBrowser::postBuild();

	childSetValue("type", gSavedSettings.getString("FindLandType"));

	bool adult_enabled = gAgent.canAccessAdult();
	bool mature_enabled = gAgent.canAccessMature();
	childSetVisible("incpg", true);
	if (!mature_enabled)
	{
		childSetValue("incmature", FALSE);
		childDisable("incmature");
	}
	if (!adult_enabled)
	{
		childSetValue("incadult", FALSE);
		childDisable("incadult");
	}

	childSetCommitCallback("pricecheck", onCommitPrice, this);
	childSetCommitCallback("areacheck", onCommitArea, this);

	childSetValue("priceedit", gStatusBar->getBalance());
	childSetEnabled("priceedit", gSavedSettings.getBOOL("FindLandPrice"));
	childSetPrevalidate("priceedit", LLLineEditor::prevalidateNonNegativeS32);
	
	childSetEnabled("areaedit", gSavedSettings.getBOOL("FindLandArea"));
	childSetPrevalidate("areaedit", LLLineEditor::prevalidateNonNegativeS32);

	childSetAction("Search", onClickSearchCore, this);
	setDefaultBtn("Search");

	mCurrentSortColumn = "per_meter";

	LLScrollListCtrl* results = getChild<LLScrollListCtrl>("results");
	if (results)
	{
		results->setSortChangedCallback(onClickSort);
		results->sortByColumn(mCurrentSortColumn,mCurrentSortAscending);
	}

	return TRUE;
}
void LLPanelDirBrowser::selectByUUID(const LLUUID& id)
{
	LLScrollListCtrl* list = findChild<LLScrollListCtrl>("results");
	if (!list) return;
	BOOL found = list->setCurrentByID(id);
	if (found)
	{
		// we got it, don't wait for network
		// Don't bother looking for this in the draw loop.
		mWantSelectID.setNull();
		// Make sure UI updates.
		onCommitList();
	}
	else
	{
		// waiting for this item from the network
		mWantSelectID = id;
	}
}
Esempio n. 21
0
// static
void LLFloaterBlacklist::onClickRemove(void* user_data)
{
	LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
	LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
	if(list->getFirstSelected())
	{
		uuid_vec_t selectedIDs = list->getSelectedIDs();
		typename uuid_vec_t::const_iterator iterator;
		for(iterator  = selectedIDs.begin();
		    iterator != selectedIDs.end();
		    ++iterator)
		{
			LLUUID selectedID = *iterator;
			blacklist_entries.erase(selectedID);
		}
		list->deleteSelectedItems();
		updateBlacklists();
	}
}
void LLFloaterTopObjects::onTP(void* data)
{
    LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
    if (!list) return;
    LLScrollListItem* first_selected = list->getFirstSelected();
    if (!first_selected) return;

    std::string name = first_selected->getColumn(1)->getValue().asString();
    std::string pos_string =  first_selected->getColumn(3)->getValue().asString();

    F32 x, y, z;
    S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
    if (matched != 3) return;

    LLVector3 pos_agent(x, y, z);
    LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);

    gAgent.teleportViaLocation( pos_global );
}
Esempio n. 23
0
void LLFloaterBulkPermission::doApply()
{
	// Its alive now do the nasty work that the ScriptQueue and friends try to do in the menu code
	// but first grab the user options

	LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(this, "queue output");
	list->deleteAllItems();

	//Apply to selected objects if requested first

	if(parent)
	{
		llinfos<< "Setting permission on parent items" << llendl;
		gSelectMgr->selectionSetObjectPermissions(PERM_NEXT_OWNER,true, req_perm_mask);
		gSelectMgr->selectionSetObjectPermissions(PERM_NEXT_OWNER,false, ~req_perm_mask); //How annoying need to set and unset
	}


	LLFloaterBulkPermission* q;
	q=(LLFloaterBulkPermission*)this;

	BulkQueueObjects func(q);
	const bool firstonly = false;
	bool fail = gSelectMgr->getSelection()->applyToObjects(&func, firstonly);
	if(fail)
	{
		if ( !func.modifiable )
		{
			gViewerWindow->alertXml("NO MODIFY");
		}
		else
		{
			llwarns << "Bad logic. Are there actualy any items in that prim?" << llendl;
		}
	}
	else
	{
		if (!q->start())
		{
			llwarns << "Unexpected failure attepmting to set permissions." << llendl;
		}
	}
}
void LLFloaterTopObjects::onLagWarning(void* data)
{
    LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
    if (!list) return;
    LLScrollListItem* first_selected = list->getFirstSelected();
    if (!first_selected) return;
    LLUUID taskid = first_selected->getUUID();

    std::string name = first_selected->getColumn(1)->getValue().asString();
    std::string score = first_selected->getColumn(0)->getValue().asString();

    std::istringstream stm;
    stm.str(score);
    F32 f_score;
    stm >> f_score;
    F32 percentage = 100.f * (f_score / 22);

    std::string message = llformat(
                              "Hello %s, you are receiving this automated message because you are wearing heavily scripted attachments/HUDs, "
                              "causing excessive script lag (%5.2f ms, that's ca. %5.2f%% of the region's resources.)\n\n"
                              "Please remove resizer scripts or attachments to reduce your script time, thank you.",
                              name.c_str(),
                              (F32)f_score,
                              (F32)percentage
                          );

    std::string my_name;
    gAgent.buildFullname(my_name);

    cmdline_printchat(llformat("Script time warning sent to %s: (%5.2f ms)",
                               name.c_str(),(F32)f_score));

    send_improved_im(LLUUID(taskid),
                     my_name,
                     message,
                     IM_ONLINE,
                     IM_NOTHING_SPECIAL,
                     LLUUID::null,
                     NO_TIMESTAMP,
                     (U8*)EMPTY_BINARY_BUCKET,
                     EMPTY_BINARY_BUCKET_SIZE);
}
Esempio n. 25
0
void LLFloaterTopObjects::showBeacon()
{
	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
	if (!list) return;

	LLScrollListItem* first_selected = list->getFirstSelected();
	if (!first_selected) return;

	std::string name = first_selected->getColumn(1)->getValue().asString();
	std::string pos_string =  first_selected->getColumn(3)->getValue().asString();

	F32 x, y, z;
	S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z);
	if (matched != 3) return;

	LLVector3 pos_agent(x, y, z);
	LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent);
	std::string tooltip("");
	LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM);
}
// static
void LLFloaterExploreSounds::handle_open(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	std::vector<LLScrollListItem*> selection = list->getAllSelected();
	std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
	std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
	std::vector<LLUUID> asset_list;
	for( ; selection_iter != selection_end; ++selection_iter)
	{
		LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
		if(item.mID.isNull()) continue;
		// Unique assets only
		if(std::find(asset_list.begin(), asset_list.end(), item.mAssetID) == asset_list.end())
		{
			asset_list.push_back(item.mAssetID);
			LLUUID inv_item = LLLocalInventory::addItem(item.mAssetID.asString(), LLAssetType::AT_SOUND, item.mAssetID, true);
		}
	}
}
void LLFloaterTopObjects::lookAtAvatar()
{
    LLScrollListCtrl* list = getChild<LLScrollListCtrl>("objects_list");
    if (!list) return;
    LLScrollListItem* first_selected = list->getFirstSelected();
    if (!first_selected) return;
    LLUUID taskid = first_selected->getUUID();

    LLVOAvatar* voavatar = gObjectList.findAvatar(taskid);
    if(voavatar)
    {
        gAgentCamera.setFocusOnAvatar(FALSE, FALSE);
        gAgentCamera.changeCameraToThirdPerson();
        gAgentCamera.setFocusGlobal(voavatar->getPositionGlobal(),taskid);
        gAgentCamera.setCameraPosAndFocusGlobal(voavatar->getPositionGlobal()
                                                + LLVector3d(3.5,1.35,0.75) * voavatar->getRotation(),
                                                voavatar->getPositionGlobal(),
                                                taskid );
    }
}
// static
void LLFloaterExploreSounds::handle_play_locally(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	std::vector<LLScrollListItem*> selection = list->getAllSelected();
	std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
	std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
	std::vector<LLUUID> asset_list;
	for( ; selection_iter != selection_end; ++selection_iter)
	{
		LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
		if(item.mID.isNull()) continue;
		// Unique assets only
		if(std::find(asset_list.begin(), asset_list.end(), item.mAssetID) == asset_list.end())
		{
			asset_list.push_back(item.mAssetID);
			gAudiop->triggerSound(item.mAssetID, LLUUID::null, 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
		}
	}
}
// static
void LLFloaterExploreSounds::handle_copy_uuid(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	LLUUID selection = list->getSelectedValue().asUUID(); // Single item only
	LLSoundHistoryItem item = floater->getItem(selection);
	if(item.mID.isNull()) return;

	if (item.mOwnerID == gAgent.getID())
	{
		gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(item.mAssetID.asString()));
	}
	else
	{
		LLChat chat;
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		chat.mText = llformat("Can't copy UUIDs you don't own.");
		LLFloaterChat::addChat(chat);
	}
}
void LLPanelDirBrowser::onCommitList()
{
	LLScrollListCtrl* list = findChild<LLScrollListCtrl>("results");
	if (!list) return;

	// Start with everyone invisible
	if (mFloaterDirectory)
	{
		mFloaterDirectory->hideAllDetailPanels();
	}
	
	if (FALSE == list->getCanSelect())
	{
		return;
	}

	std::string id_str = childGetValue("results").asString();
	if (id_str.empty())
	{
		return;
	}

	LLSD item_id = list->getCurrentID();
	S32 type = mResultsContents[id_str]["type"];
	if (type == EVENT_CODE)
	{
		// all but events use the UUID above
		item_id = mResultsContents[id_str]["event_id"];
	}
	//std::string name = self->mResultsContents[id_str]["name"].asString();
	showDetailPanel(type, item_id);

	if (type == FOR_SALE_CODE)
	{
		std::string land_type = mResultsContents[id_str]["landtype"].asString();
		if (mFloaterDirectory && mFloaterDirectory->mPanelPlaceSmallp)
		{
			mFloaterDirectory->mPanelPlaceSmallp->setLandTypeString(land_type);
		}	
	}
}