Skip to content
Snippets Groups Projects
Commit 70aa89f7 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

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.
parent a2d4122d
No related branches found
No related tags found
No related merge requests found
...@@ -178,7 +178,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, ...@@ -178,7 +178,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
mPasswordModified = FALSE; mPasswordModified = FALSE;
LLPanelLogin::sInstance = this; sInstance = this;
LLView* login_holder = gViewerWindow->getLoginPanelHolder(); LLView* login_holder = gViewerWindow->getLoginPanelHolder();
if (login_holder) if (login_holder)
...@@ -234,29 +234,44 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, ...@@ -234,29 +234,44 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(), server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
current_grid, current_grid,
ADD_TOP); ADD_TOP);
server_choice_combo->selectFirstItem(); server_choice_combo->selectFirstItem();
LLSLURL start_slurl(LLStartUp::getStartSLURL()); 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 ? if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ?
{ {
// no, so get the preference setting // no, so get the preference setting
std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); std::string defaultStartLocation = gSavedSettings.getString("LoginLocation");
LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL; LL_INFOS("AppInit")<<"default LoginLocation '"<<defaultStartLocation<<"'"<<LL_ENDL;
LLSLURL defaultStart(defaultStartLocation); LLSLURL defaultStart(defaultStartLocation);
if ( defaultStart.isSpatial() ) if ( defaultStart.isSpatial() && ! force_grid )
{ {
LLStartUp::setStartSLURL(defaultStart); LLStartUp::setStartSLURL(defaultStart);
} }
else 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); LLSLURL homeStart(LLSLURL::SIM_LOCATION_HOME);
LLStartUp::setStartSLURL(homeStart); 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); childSetAction("connect_btn", onClickConnect, this);
...@@ -380,7 +395,7 @@ void LLPanelLogin::setFocus(BOOL b) ...@@ -380,7 +395,7 @@ void LLPanelLogin::setFocus(BOOL b)
{ {
if(b) if(b)
{ {
LLPanelLogin::giveFocus(); giveFocus();
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment