SL-11049: Notice explicit --grid command-line switch and honor it.

LLPanelLogin's constructor checks both LLGridManager::getGrid() and
LLStartUp::getStartSLURL(). But by the time we get there, we've blurred the
distinction between explicit command-line arguments and defaults left over
from a previous run. Of course, if the grid implied by getStartSLURL() is the
same as the getGrid(), the distinction is irrelevant.

But if they differ, up until now, getStartSLURL() has always "won" -- even
when getGrid() was set by an explicit --grid switch whereas getStartSLURL()
was only left over from a previous run.

Notice that case and try to avoid overriding the explicitly-specified grid
with the grid from the default SLURL.
meow-7.2.2
Nat Goodspeed 2019-04-25 15:48:20 -04:00
parent a2d4122de4
commit 70aa89f708
1 changed files with 22 additions and 7 deletions

View File

@ -178,7 +178,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
mPasswordModified = FALSE;
LLPanelLogin::sInstance = this;
sInstance = this;
LLView* login_holder = gViewerWindow->getLoginPanelHolder();
if (login_holder)
@ -234,29 +234,44 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
current_grid,
ADD_TOP);
server_choice_combo->selectFirstItem();
server_choice_combo->selectFirstItem();
LLSLURL start_slurl(LLStartUp::getStartSLURL());
// The StartSLURL might have been set either by an explicit command-line
// argument (CmdLineLoginLocation) or by default.
// current_grid might have been set either by an explicit command-line
// argument (CmdLineGridChoice) or by default.
// If the grid specified by StartSLURL is the same as current_grid, the
// distinction is moot.
// If we have an explicit command-line SLURL, use that.
// If we DON'T have an explicit command-line SLURL but we DO have an
// explicit command-line grid, which is different from the default SLURL's
// -- do NOT override the explicit command-line grid with the grid from
// the default SLURL!
bool force_grid{ start_slurl.getGrid() != current_grid &&
gSavedSettings.getString("CmdLineLoginLocation").empty() &&
! gSavedSettings.getString("CmdLineGridChoice").empty() };
if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ?
{
// no, so get the preference setting
std::string defaultStartLocation = gSavedSettings.getString("LoginLocation");
LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL;
LLSLURL defaultStart(defaultStartLocation);
if ( defaultStart.isSpatial() )
if ( defaultStart.isSpatial() && ! force_grid )
{
LLStartUp::setStartSLURL(defaultStart);
}
else
{
LL_INFOS("AppInit")<<"no valid LoginLocation, using home"<<LL_ENDL;
LL_INFOS("AppInit") << (force_grid? "--grid specified" : "no valid LoginLocation")
<< ", using home" << LL_ENDL;
LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME);
LLStartUp::setStartSLURL(homeStart);
}
}
else
else if (! force_grid)
{
LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed
onUpdateStartSLURL(start_slurl); // updates grid if needed
}
childSetAction("connect_btn", onClickConnect, this);
@ -380,7 +395,7 @@ void LLPanelLogin::setFocus(BOOL b)
{
if(b)
{
LLPanelLogin::giveFocus();
giveFocus();
}
else
{