コード例 #1
0
// virtual
void LLPanelSnapshot::updateCustomResControls()
{
    // Only show width/height spinners and the aspect ratio checkbox
    // when a custom resolution is chosen.
    LLComboBox* combo = getChild<LLComboBox>(getImageSizeComboName());
    const bool show = combo->getFirstSelectedIndex() == (combo->getItemCount() - 1);
    getChild<LLUICtrl>(getImageSizePanelName())->setVisible(show);
}
コード例 #2
0
// static
void LLPanelLogin::setLoginMRUEnabled(bool enabled)
{
	if (!sInstance)
	{
		return;
	}

	LLComboBox* combo = sInstance->getChild<LLComboBox>("name_combo");
	if (!enabled) combo->removeall();
	combo->setButtonVisible(enabled);
	combo->setEnabled(enabled && combo->getItemCount() != 0);
}
コード例 #3
0
ファイル: llpanellogin.cpp プロジェクト: wish-ds/firestorm-ds
void LLPanelLogin::addFavoritesToStartLocation()
{
	// <FS:Ansariel> Clear password field while typing (FIRE-6266)
	getChild<LLLineEditor>("password_edit")->clear();
	// </FS:Ansariel> Clear password field while typing (FIRE-6266)

	// Clear the combo.
	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
	if (!combo) return;
	int num_items = combo->getItemCount();
	for (int i = num_items - 1; i > 2; i--)
	{
		combo->remove(i);
	}

	// Load favorites into the combo.
	std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
	std::string canonical_user_name = canonicalize_username(user_defined_name);
	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
	LLSD fav_llsd;
	llifstream file;
	file.open(filename);
	if (!file.is_open()) return;
	LLSDSerialize::fromXML(fav_llsd, file);
	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
		iter != fav_llsd.endMap(); ++iter)
	{
		// The account name in stored_favorites.xml has Resident last name even if user has
		// a single word account name, so it can be compared case-insensitive with the
		// user defined "firstname lastname".
		S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first);
		if (res != 0)
		{
			lldebugs << "Skipping favorites for " << iter->first << llendl;
			continue;
		}

		combo->addSeparator();
		lldebugs << "Loading favorites for " << iter->first << llendl;
		LLSD user_llsd = iter->second;
		for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
			iter1 != user_llsd.endArray(); ++iter1)
		{
			std::string label = (*iter1)["name"].asString();
			std::string value = (*iter1)["slurl"].asString();
			if(label != "" && value != "")
			{
				combo->add(label, value);
			}
		}
		break;
	}
}
コード例 #4
0
// static
void HippoPanelGridsImpl::onSelectGrid(LLUICtrl* ctrl, void *data)
{
	HippoPanelGridsImpl *self = (HippoPanelGridsImpl*)data;
	std::string newGrid = ctrl->getValue().asString();
	if (!self->saveCurGrid()) {
		// creating new grid failed
		LLComboBox *grids = self->getChild<LLComboBox>("grid_selector");
		grids->setCurrentByIndex(grids->getItemCount() - 1);
		return;
	}
	self->mCurGrid = newGrid;
	self->loadCurGrid();
}
コード例 #5
0
void LLPanelLogin::updateGridCombo()
{
	const std::string &defaultGrid = gHippoGridManager->getDefaultGridName();

	LLComboBox *grids = getChild<LLComboBox>("grids_combo");
	std::string top_entry;

	grids->removeall();

	const HippoGridInfo *curGrid = gHippoGridManager->getCurrentGrid();
	const HippoGridInfo *defGrid = gHippoGridManager->getGrid(defaultGrid);

	S32 idx(-1);
	HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid();
	for (it = gHippoGridManager->beginGrid(); it != end; ++it)
	{
		std::string grid = it->second->getGridName();
		if (grid.empty() || it->second == defGrid)
			continue;
		if (it->second == curGrid) idx = grids->getItemCount();
		grids->add(grid);
	}
	if (curGrid || defGrid)
	{
		if (defGrid)
		{
			grids->add(defGrid->getGridName(),ADD_TOP);
			++idx;
		}
		grids->setCurrentByIndex(idx);
	}
	else
	{
		grids->setLabel(LLStringExplicit(""));  // LLComboBox::removeall() does not clear the label
	}
}
コード例 #6
0
ファイル: llcombobox.cpp プロジェクト: VirtualReality/Viewer
//static 
void LLComboBox::onTextEntry(LLLineEditor* line_editor, void* user_data)
{
	LLComboBox* self = (LLComboBox*)user_data;

	if (self->mTextEntryCallback)
	{
		(*self->mTextEntryCallback)(line_editor, self->mCallbackUserData);
	}

	KEY key = gKeyboard->currentKey();
	if (key == KEY_BACKSPACE || 
		key == KEY_DELETE)
	{
		if (self->mList->selectItemByLabel(line_editor->getText(), FALSE))
		{
			line_editor->setTentative(FALSE);
		}
		else
		{
			if (!self->mSuppressTentative) line_editor->setTentative(self->mTextEntryTentative);
			self->mList->deselectAllItems();
		}
		return;
	}

	if (key == KEY_LEFT || 
		key == KEY_RIGHT)
	{
		return;
	}

	if (key == KEY_DOWN)
	{
		self->setCurrentByIndex(llmin(self->getItemCount() - 1, self->getCurrentIndex() + 1));
		if (!self->mList->getVisible())
		{
			if( self->mPrearrangeCallback )
			{
				self->mPrearrangeCallback( self, self->mCallbackUserData );
			}

			if (self->mList->getItemCount() != 0)
			{
				self->showList();
			}
		}
		line_editor->selectAll();
		line_editor->setTentative(FALSE);
	}
	else if (key == KEY_UP)
	{
		self->setCurrentByIndex(llmax(0, self->getCurrentIndex() - 1));
		if (!self->mList->getVisible())
		{
			if( self->mPrearrangeCallback )
			{
				self->mPrearrangeCallback( self, self->mCallbackUserData );
			}

			if (self->mList->getItemCount() != 0)
			{
				self->showList();
			}
		}
		line_editor->selectAll();
		line_editor->setTentative(FALSE);
	}
	else
	{
		// RN: presumably text entry
		self->updateSelection();
	}
}
コード例 #7
0
void FSPanelLogin::addFavoritesToStartLocation()
{
	mShowFavorites = false;
	// Clear the combo.
	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
	if (!combo) return;
	int num_items = combo->getItemCount();
	for (int i = num_items - 1; i > 2; i--)
	{
		combo->remove(i);
	}

	// Load favorites into the combo.
	std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
	std::string canonical_user_name = canonicalize_username(user_defined_name);
	U32 resident_pos = canonical_user_name.find("Resident");
	if (resident_pos > 0)
	{
		canonical_user_name = canonical_user_name.substr(0, resident_pos - 1);
	}
	std::string current_grid = getChild<LLComboBox>("server_combo")->getSimple();
	std::string current_user = canonical_user_name + " @ " + current_grid;
	LL_DEBUGS("Favorites") << "Current user: \"" << current_user << "\"" << LL_ENDL;
	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");

	LLSD fav_llsd;
	llifstream file;
	file.open(filename.c_str());
	if (!file.is_open())
	{
		return;
	}
	LLSDSerialize::fromXML(fav_llsd, file);
	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
		iter != fav_llsd.endMap(); ++iter)
	{
		// The account name in stored_favorites.xml has Resident last name even if user has
		// a single word account name, so it can be compared case-insensitive with the
		// user defined "firstname lastname".
		S32 res = LLStringUtil::compareInsensitive(current_user, iter->first);
		if (res != 0)
		{
			LL_DEBUGS() << "Skipping favorites for " << iter->first << LL_ENDL;
			continue;
		}

		combo->addSeparator();
		LL_DEBUGS() << "Loading favorites for " << iter->first << LL_ENDL;
		LLSD user_llsd = iter->second;
		for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
			iter1 != user_llsd.endArray(); ++iter1)
		{
			std::string label = (*iter1)["name"].asString();
			std::string value = (*iter1)["slurl"].asString();
			if(label != "" && value != "")
			{
				mShowFavorites = true;
				combo->add(label, value);
			}
		}
		break;
	}

	LLFloaterPreference::updateShowFavoritesCheckbox(mShowFavorites);
}