本文整理汇总了C++中LLNotificationFormPtr类的典型用法代码示例。如果您正苦于以下问题:C++ LLNotificationFormPtr类的具体用法?C++ LLNotificationFormPtr怎么用?C++ LLNotificationFormPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLNotificationFormPtr类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleIgnoredNotification
bool handleIgnoredNotification(const LLSD& payload)
{
if (payload["sigtype"].asString() == "add")
{
LLNotificationPtr pNotif = LLNotifications::instance().find(payload["id"].asUUID());
if (!pNotif) return false;
LLNotificationFormPtr form = pNotif->getForm();
LLSD response;
switch(form->getIgnoreType())
{
case LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE:
response = pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON);
break;
case LLNotificationForm::IGNORE_WITH_LAST_RESPONSE:
response = LLUI::sIgnoresGroup->getLLSD("Default" + pNotif->getName());
break;
case LLNotificationForm::IGNORE_SHOW_AGAIN:
break;
default:
return false;
}
pNotif->setIgnored(true);
pNotif->respond(response);
return true; // don't process this item any further
}
return false;
}
示例2: filterIgnoredNotifications
bool filterIgnoredNotifications(LLNotificationPtr notification)
{
LLNotificationFormPtr form = notification->getForm();
// Check to see if the user wants to ignore this alert
if (form->getIgnoreType() != LLNotificationForm::IGNORE_NO)
{
return LLUI::sConfigGroup->getWarning(notification->getName());
}
return true;
}
示例3: createButtons
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;
}
}
}
示例4: buildLists
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);
}
}
}
示例5: buildLists
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);
}
}
}
示例6: LLModalDialog
LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal)
: LLModalDialog( notification->getLabel(), 100, 100, modal ), // dummy size. Will reshape below.
LLInstanceTracker<LLAlertDialog, LLUUID>(notification->getID()),
mDefaultButton( NULL ),
mCheck(NULL),
mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH),
mLabel(notification->getName()),
mLineEditor(NULL),
mNote(notification)
{
const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME );
const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
const S32 EDITOR_HEIGHT = 20;
LLNotificationFormPtr form = mNote->getForm();
std::string edit_text_name;
std::string edit_text_contents;
bool is_password = false;
setBackgroundVisible(TRUE);
setBackgroundOpaque(TRUE);
typedef std::list<ButtonData> options_t;
options_t options;
// for now, get LLSD to iterator over form elements
LLSD form_sd = form->asLLSD();
for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
{
std::string type = (*it)["type"].asString();
if (type == "button")
{
options.push_back(ButtonData());
ButtonData& button_data = options.back();
button_data.mName = (*it)["name"].asString();
button_data.mText = (*it)["text"].asString();
button_data.mDefault = (*it)["default"].asBoolean();
if(options.size()-1 == mNote->getURLOption())
button_data.mUrl = mNote->getURL();
}
else if (type == "text")
{
edit_text_contents = (*it)["value"].asString();
edit_text_name = (*it)["name"].asString();
}
else if (type == "password")
{
edit_text_contents = (*it)["value"].asString();
edit_text_name = (*it)["name"].asString();
is_password = true;
}
}
// Buttons
if (options.empty())
{
options.push_back(ButtonData());
ButtonData& button_data = options.back();
button_data.mName = "close";
button_data.mText = "Close";
button_data.mDefault = true;
}
S32 num_options = options.size();
// Calc total width of buttons
S32 button_width = 0;
S32 sp = font->getWidth(std::string("OO"));
for( options_t::iterator it = options.begin(); it != options.end(); it++ )
{
S32 w = S32(font->getWidth( it->mText ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD;
button_width = llmax( w, button_width );
}
S32 btn_total_width = button_width;
if( num_options > 1 )
{
btn_total_width = (num_options * button_width) + ((num_options - 1) * BTN_HPAD);
}
// Message: create text box using raw string, as text has been structure deliberately
// Use size of created text box to generate dialog box size
std::string msg = mNote->getMessage();
llwarns << "Alert: " << msg << llendl;
LLTextBox* msg_box = new LLTextBox( std::string("Alert message"), msg, (F32)MAX_ALLOWED_MSG_WIDTH, font );
const LLRect& text_rect = msg_box->getRect();
S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD;
S32 dialog_height = text_rect.getHeight() + 3 * VPAD + BTN_HEIGHT;
if (hasTitleBar())
{
dialog_height += LINE_HEIGHT; // room for title bar
}
// it's ok for the edit text body to be empty, but we want the name to exist if we're going to draw it
if (!edit_text_name.empty())
{
dialog_height += EDITOR_HEIGHT + VPAD;
dialog_width = llmax(dialog_width, (S32)(font->getWidth( edit_text_contents ) + 0.99f));
}
//.........这里部分代码省略.........
示例7: buildPopupLists
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);
}
}
}