void LLFloaterBulkPermission::doApply() { // Inspects a stream of selected object contents and adds modifiable ones to the given array. class ModifiableGatherer : public LLSelectedNodeFunctor { public: ModifiableGatherer(LLDynamicArray<LLUUID>& q) : mQueue(q) {} virtual bool apply(LLSelectNode* node) { if( node->allowOperationOnNode(PERM_MODIFY, GP_OBJECT_MANIPULATE) ) { mQueue.put(node->getObject()->getID()); } return true; } private: LLDynamicArray<LLUUID>& mQueue; }; LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); list->deleteAllItems(); ModifiableGatherer gatherer(mObjectIDs); LLSelectMgr::getInstance()->getSelection()->applyToNodes(&gatherer); if(mObjectIDs.empty()) { list->setCommentText(getString("nothing_to_modify_text")); } else { mDone = FALSE; if (!start()) { llwarns << "Unexpected bulk permission change failure." << llendl; } } }
void lggAutoCorrectFloater::updateNamesList() { namesList->deleteAllItems(); static BOOL *enabledd = rebind_llcontrol<BOOL>("EmeraldEnableAutoCorrect", &gSavedSettings, true); if(!(*enabledd)) { updateItemsList(); return; } static S32 *countAuto= rebind_llcontrol<S32>("EmeraldAutoCorrectCount", &gSavedSettings, true); childSetValue("em_ac_stats",*countAuto); LLSD autoCorrects = LGGAutoCorrect::getInstance()->getAutoCorrects(); 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& listName = (*loc_it).first; LLSD element; element["id"] = listName; LLSD& friend_column = element["columns"][0]; friend_column["column"] = "Entries"; friend_column["value"] = listName; friend_column["font"] = "SANSSERIF"; const LLSD& loc_map = (*loc_it).second; if(loc_map["enabled"].asBoolean()) friend_column["font-style"] = "BOLD"; else friend_column["font-style"] = "NORMAL"; if(namesList) namesList->addElement(element, ADD_BOTTOM); } updateItemsList(); }
// virtual void LLFloaterBump::onOpen(const LLSD& key) { LLScrollListCtrl* list = getChild<LLScrollListCtrl>("bump_list"); if (!list) return; list->deleteAllItems(); if (gMeanCollisionList.empty()) { std::string none_detected = getString("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); } else { for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); iter != gMeanCollisionList.end(); ++iter) { LLMeanCollisionData *mcd = *iter; add(list, mcd); } } }
// static void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getRootObjectCount() != 1) { LLNotificationsUtil::add("BuyContentsOneOnly"); return; } LLFloaterBuyContents* floater = LLFloaterReg::showTypedInstance<LLFloaterBuyContents>("buy_object_contents"); if (!floater) return; LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("item_list"); if (list) list->deleteAllItems(); floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); LLUUID owner_id; std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotificationsUtil::add("BuyContentsOneOwner"); return; } floater->mSaleInfo = sale_info; // Update the display LLSelectNode* node = selection->getFirstRootNode(); if (!node) return; if(node->mPermissions->isGroupOwned()) { gCacheName->getGroupName(owner_id, owner_name); } floater->getChild<LLUICtrl>("contains_text")->setTextArg("[NAME]", node->mName); floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice())); floater->getChild<LLUICtrl>("buy_text")->setTextArg("[NAME]", owner_name); std::string type_currency = LLGridManager::getInstance()->getCurrency(); floater->getChild<LLUICtrl>("buy_text")->setTextArg("[CUR]", type_currency); // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); floater->registerVOInventoryListener(obj,NULL); floater->requestVOInventory(); }
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 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 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; } } }
// static void LLFloaterBump::show(void *contents) { if (gNoRender) { return; } if (!sInstance) { sInstance = new LLFloaterBump(); } LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("bump_list"); if (!list) return; list->deleteAllItems(); if (gMeanCollisionList.empty()) { std::string none_detected = sInstance->getString("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; row["columns"][0]["color"] = gColors.getColor("DefaultListText").getValue(); list->addElement(row); } else { for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); iter != gMeanCollisionList.end(); ++iter) { LLMeanCollisionData *mcd = *iter; LLFloaterBump::add(list, mcd); } } sInstance->open(); /*Flawfinder: ignore*/ }
// static void LLFloaterBump::show(void *contents) { if (gNoRender) { return; } if (!sInstance) { sInstance = new LLFloaterBump(); } LLScrollListCtrl* list = LLUICtrlFactory::getScrollListByName(sInstance, "bump_list"); if (!list) return; list->deleteAllItems(); if (gMeanCollisionList.isEmpty()) { LLString none_detected = sInstance->childGetText("none_detected"); LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); } else { for (LLMeanCollisionData* mcd = gMeanCollisionList.getFirstData(); mcd; mcd = gMeanCollisionList.getNextData()) { LLFloaterBump::add(list, mcd); } } sInstance->open(); /*Flawfinder: ignore*/ }
// static void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) { LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); if (selection->getRootObjectCount() != 1) { LLNotifications::instance().add("BuyContentsOneOnly"); return; } // Create a new instance only if needed if (sInstance) { LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("item_list"); if (list) list->deleteAllItems(); } else { sInstance = new LLFloaterBuyContents(); } sInstance->open(); /*Flawfinder: ignore*/ sInstance->setFocus(TRUE); sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); // Always center the dialog. User can change the size, // but purchases are important and should be center screen. // This also avoids problems where the user resizes the application window // mid-session and the saved rect is off-center. sInstance->center(); LLUUID owner_id; std::string owner_name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); if (!owners_identical) { LLNotifications::instance().add("BuyContentsOneOwner"); return; } sInstance->mSaleInfo = sale_info; // Update the display LLSelectNode* node = selection->getFirstRootNode(); if (!node) return; if(node->mPermissions->isGroupOwned()) { gCacheName->getGroupName(owner_id, owner_name); } sInstance->childSetTextArg("contains_text", "[NAME]", node->mName); sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice())); sInstance->childSetTextArg("buy_text", "[NAME]", owner_name); // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); sInstance->registerVOInventoryListener(obj,NULL); sInstance->requestVOInventory(); }
void FloaterGridManager::refreshGrids() { LLScrollListCtrl *grids = FloaterGridManager::getInstance()->getChild<LLScrollListCtrl>("grid_selector"); std::string lastSelectedItem; LLSD element; if (grids->getFirstSelected()) { lastSelectedItem = grids->getFirstSelected()->getValue().asString(); } grids->deleteAllItems(); for (HippoGridManager::GridIterator it = gHippoGridManager->beginGrid(); it != gHippoGridManager->endGrid(); ++it) { std::string grid_nick = it->second->getGridNick(); // There's no reason why empty grids nicks should be in this list, ugh if (!grid_nick.empty() && grid_nick != gHippoGridManager->getCurrentGridNick()) { element["id"] = grid_nick; element["columns"][0]["column"] = "grid"; element["columns"][0]["type"] = "text"; element["columns"][0]["value"] = grid_nick; grids->addElement(element, ADD_BOTTOM); } } // Setting the default needs to be rethought. // Right now, we just use the last-selected grid, // but leaving this as the current behavior for now if (!gHippoGridManager->getCurrentGridNick().empty()) { element["id"] = gHippoGridManager->getCurrentGridNick(); element["columns"][0]["column"] = "grid"; element["columns"][0]["type"] = "text"; element["columns"][0]["font-style"] = "BOLD"; element["columns"][0]["value"] = gHippoGridManager->getCurrentGridNick(); grids->addElement(element, ADD_TOP); } // Reselect the item if we had one selected if (lastSelectedItem.empty()) { grids->selectItemByLabel(gHippoGridManager->getCurrentGridNick()); } else { grids->selectItemByLabel(lastSelectedItem); } // TODO: get rid of all this state junk if ((FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)) { grids->addElement("<new>", ADD_BOTTOM); } //if (selectIndex >= 0) //{ // grids->setCurrentByIndex(selectIndex); //} //else //{ // grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label //} // FloaterGridManager::getInstance()->childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " "); FloaterGridManager::getInstance()->childSetEnabled("btn_delete", grids->getItemCount() > 0); FloaterGridManager::getInstance()->childSetEnabled("btn_copy", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0)); // FloaterGridManager::getInstance()->childSetEnabled("set_default", (FloaterGridManager::getInstance()->getState() == NORMAL) && (grids->getItemCount() > 0)); FloaterGridManager::getInstance()->childSetEnabled("gridnick", (FloaterGridManager::getInstance()->getState() == ADD_NEW) || (FloaterGridManager::getInstance()->getState() == ADD_COPY)); if (FloaterGridManager::getInstance()->getState() == NORMAL) { HippoGridInfo *gridInfo = gHippoGridManager->getGrid(FloaterGridManager::getInstance()->getCurGrid()); if (gridInfo) { FloaterGridManager::getInstance()->childSetText("gridnick", gridInfo->getGridNick()); //FloaterGridManager::getInstance()->childSetText("grid_name", gridInfo->getGridName()); FloaterGridManager::getInstance()->childSetText("loginuri", gridInfo->getLoginUri()); FloaterGridManager::getInstance()->childSetText("loginpage", gridInfo->getLoginPage()); FloaterGridManager::getInstance()->childSetText("helperuri", gridInfo->getHelperUri()); FloaterGridManager::getInstance()->childSetText("website", gridInfo->getWebSite()); FloaterGridManager::getInstance()->childSetText("support", gridInfo->getSupportUrl()); FloaterGridManager::getInstance()->childSetText("register", gridInfo->getRegisterUrl()); FloaterGridManager::getInstance()->childSetText("password", gridInfo->getPasswordUrl()); FloaterGridManager::getInstance()->childSetText("first_name", gridInfo->getFirstName()); FloaterGridManager::getInstance()->childSetText("last_name", gridInfo->getLastName()); if(gridInfo->getAvatarPassword().length() == 32) FloaterGridManager::getInstance()->childSetText("avatar_password", std::string(PASSWORD_FILLER)); else if(gridInfo->getPasswordUrl().empty()) FloaterGridManager::getInstance()->childSetText("avatar_password", std::string("")); if (gridInfo->getPlatform() == HippoGridInfo::PLATFORM_SECONDLIFE) { FloaterGridManager::getInstance()->childSetEnabled("search", false); FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null); //childSetEnabled("render_compat", false); //childSetValue("render_compat", false); } else { FloaterGridManager::getInstance()->childSetEnabled("search", true); FloaterGridManager::getInstance()->childSetText("search", gridInfo->getSearchUrl()); //childSetEnabled("render_compat", true); //childSetValue("render_compat", gridInfo->isRenderCompat()); } } else { FloaterGridManager::getInstance()->childSetText("gridnick", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("gridname", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("loginuri", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("loginpage", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("helperuri", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("website", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("support", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("register", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("password", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("first_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("last_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("avatar_password", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null); } } else if (FloaterGridManager::getInstance()->getState() == ADD_NEW) { llinfos << "mState == ADD_NEW" << llendl; std::string required = "<required>"; FloaterGridManager::getInstance()->childSetText("gridnick", required); FloaterGridManager::getInstance()->childSetText("gridname", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("loginuri", required); FloaterGridManager::getInstance()->childSetText("loginpage", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("helperuri", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("website", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("support", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("register", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("password", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("first_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("last_name", LLStringUtil::null); FloaterGridManager::getInstance()->childSetText("avatar_password", LLStringUtil::null); // childSetEnabled("search", true); FloaterGridManager::getInstance()->childSetText("search", LLStringUtil::null); } else if (FloaterGridManager::getInstance()->getState() == ADD_COPY) { llinfos << "mState == ADD_COPY" << llendl; FloaterGridManager::getInstance()->childSetText("gridnick", LLStringExplicit("<required>")); } else { llwarns << "Illegal state " << FloaterGridManager::getInstance()->getState() << llendl; } return; }
//////////////////////////////////////////////////////////////////////////////// // static void LLPanelMediaSettingsSecurity::initValues( void* userdata, const LLSD& media_settings , bool editable) { LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata; std::string base_key( "" ); std::string tentative_key( "" ); struct { std::string key_name; LLUICtrl* ctrl_ptr; std::string ctrl_type; } data_set [] = { { LLMediaEntry::WHITELIST_ENABLE_KEY, self->mEnableWhiteList, "LLCheckBoxCtrl" }, { LLMediaEntry::WHITELIST_KEY, self->mWhiteListList, "LLScrollListCtrl" }, { "", NULL , "" } }; for( int i = 0; data_set[ i ].key_name.length() > 0; ++i ) { base_key = std::string( data_set[ i ].key_name ); tentative_key = base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX ); bool enabled_overridden = false; // TODO: CP - I bet there is a better way to do this using Boost if ( media_settings[ base_key ].isDefined() ) { if ( data_set[ i ].ctrl_type == "LLCheckBoxCtrl" ) { static_cast< LLCheckBoxCtrl* >( data_set[ i ].ctrl_ptr )-> setValue( media_settings[ base_key ].asBoolean() ); } else if ( data_set[ i ].ctrl_type == "LLScrollListCtrl" ) { // get control LLScrollListCtrl* list = static_cast< LLScrollListCtrl* >( data_set[ i ].ctrl_ptr ); list->deleteAllItems(); // points to list of white list URLs LLSD url_list = media_settings[ base_key ]; // better be the whitelist llassert(data_set[ i ].ctrl_ptr == self->mWhiteListList); // If tentative, don't add entries if (media_settings[ tentative_key ].asBoolean()) { self->mWhiteListList->setEnabled(false); enabled_overridden = true; } else { // iterate over them and add to scroll list LLSD::array_iterator iter = url_list.beginArray(); while( iter != url_list.endArray() ) { std::string entry = *iter; self->addWhiteListEntry( entry ); ++iter; } } }; if ( ! enabled_overridden) data_set[ i ].ctrl_ptr->setEnabled(editable); data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() ); }; }; // initial update - hides/shows status messages etc. self->updateWhitelistEnableStatus(); }