コード例 #1
0
void LLUICtrlFactory::setupPaths()
{
	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml");

	LLXMLNodePtr root;
	BOOL success  = LLXMLNode::parseFile(filename, root, NULL);
	sXUIPaths.clear();
	
	if (success)
	{
		LLXMLNodePtr path;
	
		for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling())
		{
			LLUIString path_val_ui(path->getValue());
			std::string language = LLUI::getLanguage();
			path_val_ui.setArg("[LANGUAGE]", language);

			if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui.getString()) == sXUIPaths.end())
			{
				sXUIPaths.push_back(path_val_ui.getString());
			}
		}
	}
	else // parsing failed
	{
		std::string slash = gDirUtilp->getDirDelimiter();
		std::string dir = "xui" + slash + "en-us";
		llwarns << "XUI::config file unable to open: " << filename << llendl;
		sXUIPaths.push_back(dir);
	}
}
コード例 #2
0
//static 
void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t& registry, LLXMLNodePtr output_node)
{
	LLFastTimer ft(FTM_CREATE_CHILDREN);
	if (node.isNull()) return;

	for (LLXMLNodePtr child_node = node->getFirstChild(); child_node.notNull(); child_node = child_node->getNextSibling())
	{
		LLXMLNodePtr outputChild;
		if (output_node) 
		{
			outputChild = output_node->createChild("", FALSE);
		}

		if (!instance().createFromXML(child_node, viewp, LLStringUtil::null, registry, outputChild))
		{
			// child_node is not a valid child for the current parent
			std::string child_name = std::string(child_node->getName()->mString);
			if (LLDefaultChildRegistry::instance().getValue(child_name))
			{
				// This means that the registry assocaited with the parent widget does not have an entry
				// for the child widget
				// You might need to add something like:
				// static ParentWidgetRegistry::Register<ChildWidgetType> register("child_widget_name");
				llwarns << child_name << " is not a valid child of " << node->getName()->mString << llendl;
			}
			else
			{
				llwarns << "Could not create widget named " << child_node->getName()->mString << llendl;
			}
		}

		if (outputChild && !outputChild->mChildren && outputChild->mAttributes.empty() && outputChild->getValue().empty())
		{
			output_node->deleteChild(outputChild);
		}
	}

}