Feature Request: Allow typing login uris into the grids combo box on the login screen

Furthermore, users may now type in grid name, grid nick, or grid login uri into the box and it will resolve to an existing grid they've used before, or (for uris only) try to add the new grid with the data it provides.
Input will have trailing and leading spaces trimmed.

Thanks to Diva Canto for this brilliant request!
This commit is contained in:
Inusaito Sayori
2013-09-30 17:18:41 -04:00
parent 705de655a9
commit 2333a684a3
2 changed files with 29 additions and 2 deletions

View File

@@ -215,6 +215,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
LLComboBox *server_choice_combo = getChild<LLComboBox>("grids_combo");
server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1));
server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo));
// Load all of the grids, sorted, and then add a bar and the current grid at the top
updateGridCombo();
@@ -1031,7 +1032,33 @@ void LLPanelLogin::refreshLoginPage()
//void LLPanelLogin::onSelectServer()
void LLPanelLogin::onSelectGrid(LLUICtrl *ctrl)
{
gHippoGridManager->setCurrentGrid(ctrl->getValue());
std::string grid(ctrl->getValue().asString());
LLStringUtil::trim(grid); // Guard against copy paste
if (!gHippoGridManager->getGrid(grid)) // We can't get an input grid by name or nick, perhaps a Login URI was entered
{
HippoGridInfo* info(new HippoGridInfo("")); // Start off with empty grid name, otherwise we don't know what to name
info->setLoginUri(grid);
if (info->retrieveGridInfo()) // There's info from this URI
{
grid = info->getGridName();
if (HippoGridInfo* nick_info = gHippoGridManager->getGrid(info->getGridNick())) // Grid of same nick exists
{
delete info;
grid = nick_info->getGridName();
}
else // Guess not, try adding this grid
{
gHippoGridManager->addGrid(info); // deletes info if not needed (existing or no name)
}
}
else
{
delete info;
grid = gHippoGridManager->getCurrentGridName();
}
}
gHippoGridManager->setCurrentGrid(grid);
ctrl->setValue(grid);
}
void LLPanelLogin::onLocationSLURL()

View File

@@ -53,7 +53,7 @@
left="0" mouse_opaque="true" name="grids_combo_text" v_pad="0" width="120">
Grid:
</text>
<combo_box allow_text_entry="false" bottom_delta="-24" follows="left|bottom" height="20"
<combo_box allow_text_entry="true" max_chars="128" bottom_delta="-24" follows="left|bottom" height="20"
left="0" mouse_opaque="true" name="grids_combo" width="120" />
<button name="grids_btn" label="Grid Manager"
bottom_delta="-20" left_delta="10" height="16" width="100"