void LLToastScriptQuestion::createButtons()
{
	LLNotificationFormPtr form = mNotification->getForm();
	int num_elements = form->getNumElements();
	int buttons_width = 0;

	for (int i = 0; i < num_elements; ++i)
	{
		LLSD form_element = form->getElement(i);
		if ("button" == form_element["type"].asString())
		{
			LLButton::Params p;
			const LLFontGL* font = LLFontGL::getFontSansSerif();
			p.name(form_element["name"].asString());
			p.label(form_element["text"].asString());
			p.layout("topleft");
			p.font(font);
			p.rect.height(BUTTON_HEIGHT);
			p.click_callback.function(boost::bind(&LLToastScriptQuestion::onButtonClicked, this, form_element["name"].asString()));
			p.rect.left = LEFT_PAD;
			p.rect.width = font->getWidth(form_element["text"].asString());
			p.auto_resize = true;
			p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
			p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));
			p.image_color_disabled(LLUIColorTable::instance().getColor("ButtonCautionImageColor"));

			LLButton* button = LLUICtrlFactory::create<LLButton>(p);
			button->autoResize();
			getChild<LLPanel>("buttons_panel")->addChild(button);

			LLRect rect = button->getRect();
			rect.setLeftTopAndSize(buttons_width, rect.mTop, rect.getWidth(), rect.getHeight());
			button->setRect(rect);

			buttons_width += rect.getWidth() + LEFT_PAD;
		}
	}
}
void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in v3
{
	LLScrollListCtrl& disabled_popups =
		getChildRef<LLScrollListCtrl>("disabled_popups");
	LLScrollListCtrl& enabled_popups =
		getChildRef<LLScrollListCtrl>("enabled_popups");
	
	disabled_popups.deleteAllItems();
	enabled_popups.deleteAllItems();

	for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
		iter != LLNotifications::instance().templatesEnd();
		++iter)
	{
		LLNotificationTemplatePtr templatep = iter->second;
		LLNotificationFormPtr formp = templatep->mForm;

		LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType();
		if (ignore == LLNotificationForm::IGNORE_NO)
				continue;

		LLSD params;
		params["name"] = (*iter).first;
		LLNotificationPtr notification = LLNotificationPtr(new LLNotification(params));

		LLSD row;
		std::string ignore_msg = formp->getIgnoreMessage();
		LLStringUtil::format(ignore_msg,notification->getSubstitutions());
		row["columns"][0]["value"] = ignore_msg;
		row["columns"][0]["font"] = "SANSSERIF_SMALL";
		row["columns"][0]["width"] = 300;

		LLScrollListItem* item = NULL;

		bool show_popup = !formp->getIgnored();
		if (!show_popup)
		{
			if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
			{
				LLSD last_response = LLUI::sConfigGroup->getLLSD("Default" + templatep->mName);
				if (!last_response.isUndefined())
				{
					for (LLSD::map_const_iterator it = last_response.beginMap();
						it != last_response.endMap();
						++it)
					{
						if (it->second.asBoolean())
						{
							row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString();
							break;
						}
					}
				}
				row["columns"][1]["font"] = "SANSSERIF_SMALL";
				row["columns"][1]["width"] = 160;
			}
			item = disabled_popups.addElement(row,
							   ADD_SORTED);
		}
		else
		{
			item = enabled_popups.addElement(row,
							  ADD_SORTED);
		}

		if (item)
		{
			item->setUserdata((void*)&iter->first);
		}
	}
}
Exemple #3
0
void LLPanelMsgs::buildLists()
{
	LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
	LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups");

	disabled_popups.deleteAllItems();
	enabled_popups.deleteAllItems();

	for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
		iter != LLNotifications::instance().templatesEnd();
		++iter)
	{
		LLNotificationTemplatePtr templatep = iter->second;
		LLNotificationFormPtr formp = templatep->mForm;

		LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType();
		if (ignore == LLNotificationForm::IGNORE_NO)
				continue;

		std::string message = formp->getIgnoreMessage();
		LLStringUtil::format_map_t targs;
		targs["[SECOND_LIFE]"] = LLNotifications::instance().getGlobalString("SECOND_LIFE");
		targs["[VIEWER_NAME]"] = LLNotifications::instance().getGlobalString("VIEWER_NAME");
		LLStringUtil::format(message, targs);

		LLSD row;
		row["columns"][0]["value"] = message;
		row["columns"][0]["font"] = "SANSSERIF_SMALL";
		row["columns"][0]["width"] = 300;

		LLScrollListItem* item = NULL;

		bool show_popup = gSavedSettings.getWarning(templatep->mName);
		if (!show_popup)
		{
			if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
			{
				LLSD last_response = LLUI::sConfigGroup->getLLSD("Default" + templatep->mName);
				if (!last_response.isUndefined())
				{
					for (LLSD::map_const_iterator it = last_response.beginMap();
						it != last_response.endMap();
						++it)
					{
						if (it->second.asBoolean())
						{
							row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString();
							break;
						}
					}
				}
				row["columns"][1]["font"] = "SANSSERIF_SMALL";
				row["columns"][1]["width"] = 160;
			}
			item = disabled_popups.addElement(row,
							   ADD_SORTED);
		}
		else
		{
			item = enabled_popups.addElement(row,
							  ADD_SORTED);
		}

		if (item)
		{
			item->setUserdata((void*)&iter->first);
		}
	}
}
void LLFloaterPreference::buildPopupLists()
{
	LLScrollListCtrl& disabled_popups =
		getChildRef<LLScrollListCtrl>("disabled_popups");
	LLScrollListCtrl& enabled_popups =
		getChildRef<LLScrollListCtrl>("enabled_popups");
	
	disabled_popups.deleteAllItems();
	enabled_popups.deleteAllItems();
	
	for (LLNotifications::TemplateMap::const_iterator iter = LLNotifications::instance().templatesBegin();
		 iter != LLNotifications::instance().templatesEnd();
		 ++iter)
	{
		LLNotificationTemplatePtr templatep = iter->second;
		LLNotificationFormPtr formp = templatep->mForm;
		
		LLNotificationForm::EIgnoreType ignore = formp->getIgnoreType();
		if (ignore == LLNotificationForm::IGNORE_NO)
			continue;
		
		LLSD row;
		row["columns"][0]["value"] = formp->getIgnoreMessage();
		row["columns"][0]["font"] = "SANSSERIF_SMALL";
		row["columns"][0]["width"] = 400;
		
		LLScrollListItem* item = NULL;
		
		bool show_popup = formp->getIgnored();
		if (!show_popup)
		{
			if (ignore == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
			{
				LLSD last_response = LLUI::sSettingGroups["config"]->getLLSD("Default" + templatep->mName);
				if (!last_response.isUndefined())
				{
					for (LLSD::map_const_iterator it = last_response.beginMap();
						 it != last_response.endMap();
						 ++it)
					{
						if (it->second.asBoolean())
						{
							row["columns"][1]["value"] = formp->getElement(it->first)["ignore"].asString();
							break;
						}
					}
				}
				row["columns"][1]["font"] = "SANSSERIF_SMALL";
				row["columns"][1]["width"] = 360;
			}
			item = disabled_popups.addElement(row);
		}
		else
		{
			item = enabled_popups.addElement(row);
		}
		
		if (item)
		{
			item->setUserdata((void*)&iter->first);
		}
	}
}