Get rid of grid nicks, and just use the Grid Name everywhere (its cleaner, and one less thing to fill out).

This commit is contained in:
RevolutionSmythe
2011-08-14 20:57:50 -05:00
committed by Siana Gearz
parent 8fc875cee8
commit b8cd305f89
9 changed files with 41 additions and 111 deletions

View File

@@ -119,7 +119,6 @@ HippoPanelGridsImpl::~HippoPanelGridsImpl()
BOOL HippoPanelGridsImpl::postBuild()
{
requires<LLComboBox>("grid_selector");
requires<LLLineEditor>("gridnick");
requires<LLComboBox>("platform");
requires<LLLineEditor>("gridname");
requires<LLLineEditor>("loginuri");
@@ -176,7 +175,7 @@ void HippoPanelGridsImpl::refresh()
}
HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid();
for (it = gHippoGridManager->beginGrid(); it != end; ++it) {
const std::string &grid = it->second->getGridNick();
const std::string &grid = it->second->getGridName();
if (grid != defaultGrid) {
grids->add(grid);
if (grid == mCurGrid) selectIndex = i;
@@ -198,13 +197,13 @@ void HippoPanelGridsImpl::refresh()
childSetEnabled("btn_delete", (selectIndex >= 0));
childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0));
childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0));
childSetEnabled("gridnick", (mState == ADD_NEW) || (mState == ADD_COPY));
childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY));
if (childGetValue("platform").asString() == "SecondLife") {
// disable platform selector, if logged into the grid edited and it is SL
// so object export restrictions cannot be circumvented by changing the platform
bool enablePlatform = (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) ||
(mCurGrid != gHippoGridManager->getConnectedGrid()->getGridNick());
(mCurGrid != gHippoGridManager->getConnectedGrid()->getGridName());
childSetEnabled("platform", enablePlatform);
childSetEnabled("search", false);
childSetText("search", LLStringExplicit(""));
@@ -232,7 +231,7 @@ void HippoPanelGridsImpl::apply()
gHippoGridManager->saveFile();
refresh();
// update render compatibility
if (mCurGrid == gHippoGridManager->getConnectedGrid()->getGridNick())
if (mCurGrid == gHippoGridManager->getConnectedGrid()->getGridName())
gHippoLimits->setLimits();
}
@@ -250,7 +249,6 @@ void HippoPanelGridsImpl::loadCurGrid()
{
HippoGridInfo *gridInfo = gHippoGridManager->getGrid(mCurGrid);
if (gridInfo && (mState != ADD_NEW)) {
childSetText("gridnick", gridInfo->getGridNick());
LLComboBox *platform = getChild<LLComboBox>("platform");
if (platform) platform->setCurrentByIndex(gridInfo->getPlatform());
childSetText("gridname", gridInfo->getGridName());
@@ -264,7 +262,6 @@ void HippoPanelGridsImpl::loadCurGrid()
childSetValue("render_compat", gridInfo->isRenderCompat());
} else {
std::string empty = "";
childSetText("gridnick", empty);
LLComboBox *platform = getChild<LLComboBox>("platform");
if (platform) platform->setCurrentByIndex(HippoGridInfo::PLATFORM_OTHER);
childSetText("gridname", empty);
@@ -281,10 +278,10 @@ void HippoPanelGridsImpl::loadCurGrid()
if (mState == ADD_NEW) {
std::string required = "<required>";
childSetText("gridnick", required);
childSetText("gridname", required);
childSetText("loginuri", required);
} else if (mState == ADD_COPY) {
childSetText("gridnick", std::string("<required>"));
childSetText("gridname", std::string("<required>"));
} else if (mState != NORMAL) {
llwarns << "Illegal state " << mState << '.' << llendl;
}
@@ -300,21 +297,21 @@ bool HippoPanelGridsImpl::saveCurGrid()
if (mState == NORMAL) {
gridInfo = gHippoGridManager->getGrid(mCurGrid);
gridInfo->retrieveGridInfo();
refresh();
} else if ((mState == ADD_NEW) || (mState == ADD_COPY)) {
// check nickname
std::string gridnick = childGetValue("gridnick");
if (gridnick == "<required>") gridnick = "";
HippoGridInfo::sanitizeGridNick(gridnick);
childSetValue("gridnick", (gridnick != "")? gridnick: "<required>");
if (gridnick == "") {
std::string gridname = childGetValue("gridname");
if (gridname == "<required>") gridname = "";
childSetValue("gridname", (gridname != "")? gridname: "<required>");
if (gridname == "") {
LLNotifications::instance().add("GridsNoNick");
return false;
}
if (gHippoGridManager->getGrid(gridnick)) {
if (gHippoGridManager->getGrid(gridname)) {
LLSD args;
args["NAME"] = gridnick;
args["NAME"] = gridname;
LLNotifications::instance().add("GridExists", args);
return false;
}
@@ -323,18 +320,16 @@ bool HippoPanelGridsImpl::saveCurGrid()
std::string loginuri = childGetValue("loginuri");
if ((loginuri == "") || (loginuri == "<required>")) {
LLSD args;
args["NAME"] = gridnick;
args["NAME"] = gridname;
LLNotifications::instance().add("GridsNoLoginUri", args);
return false;
}
mState = NORMAL;
mCurGrid = gridnick;
gridInfo = new HippoGridInfo(gridnick);
mCurGrid = gridname;
gridInfo = new HippoGridInfo(gridname);
gHippoGridManager->addGrid(gridInfo);
gridInfo->retrieveGridInfo();
refresh();
return true;
} else {
llwarns << "Illegal state " << mState << '.' << llendl;
@@ -346,12 +341,7 @@ bool HippoPanelGridsImpl::saveCurGrid()
llwarns << "Grid not found, ignoring changes." << llendl;
return true;
}
if (gridInfo->getGridNick() != childGetValue("gridnick").asString()) {
llwarns << "Grid nickname mismatch, ignoring changes." << llendl;
return true;
}
gridInfo->setPlatform(childGetValue("platform"));
gridInfo->setGridName(childGetValue("gridname"));
gridInfo->setLoginUri(childGetValue("loginuri"));
@@ -406,7 +396,6 @@ void HippoPanelGridsImpl::retrieveGridInfo()
grid->setLoginUri(loginuri);
if (grid->retrieveGridInfo()) {
if (grid->getGridNick() != "") childSetText("gridnick", grid->getGridNick());
if (grid->getPlatform() != HippoGridInfo::PLATFORM_OTHER)
getChild<LLComboBox>("platform")->setCurrentByIndex(grid->getPlatform());
if (grid->getGridName() != "") childSetText("gridname", grid->getGridName());
@@ -418,6 +407,7 @@ void HippoPanelGridsImpl::retrieveGridInfo()
if (grid->getRegisterUrl() != "") childSetText("register", grid->getRegisterUrl());
if (grid->getPasswordUrl() != "") childSetText("password", grid->getPasswordUrl());
if (grid->getSearchUrl() != "") childSetText("search", grid->getSearchUrl());
if (grid->getGridMessage() != "") childSetText("gridmessage", grid->getGridMessage());
} else {
LLNotifications::instance().add("GridInfoError");
}