From a0a4a0736d93e0ab4f397281e38bf21f2f2f1425 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 4 Feb 2014 13:57:10 -0800 Subject: MAINT-3675 NUI:Login Screen - Allow login call to be made from web --- indra/newview/llpanellogin.cpp | 98 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 911ecaad9d..60208c92b0 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -26,6 +26,8 @@ #include "llviewerprecompiledheaders.h" +#include + #include "llpanellogin.h" #include "lllayoutstack.h" @@ -97,6 +99,87 @@ public: } }; +class LLLoginLocationAutoHandler : public LLCommandHandler +{ +public: + // don't allow from external browsers + LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { } + bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) + { + if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) + { + if ( tokens.size() == 0 || tokens.size() > 4 ) + return false; + + // unescape is important - uris with spaces are escaped in this code path + // (e.g. space -> %20) and the code to log into a region doesn't support that. + const std::string region = LLURI::unescape( tokens[0].asString() ); + + // just region name as payload + if ( tokens.size() == 1 ) + { + // region name only - slurl will end up as center of region + LLSLURL slurl(region); + LLPanelLogin::autologinToLocation(slurl); + } + else + // region name and x coord as payload + if ( tokens.size() == 2 ) + { + // invalid to only specify region and x coordinate + // slurl code will revert to same as region only, so do this anyway + LLSLURL slurl(region); + LLPanelLogin::autologinToLocation(slurl); + } + else + // region name and x/y coord as payload + if ( tokens.size() == 3 ) + { + // region and x/y specified - default z to 0 + F32 xpos; + std::istringstream codec(tokens[1].asString()); + codec >> xpos; + + F32 ypos; + codec.clear(); + codec.str(tokens[2].asString()); + codec >> ypos; + + const LLVector3 location(xpos, ypos, 0.0f); + LLSLURL slurl(region, location); + + LLPanelLogin::autologinToLocation(slurl); + } + else + // region name and x/y/z coord as payload + if ( tokens.size() == 4 ) + { + // region and x/y/z specified - ok + F32 xpos; + std::istringstream codec(tokens[1].asString()); + codec >> xpos; + + F32 ypos; + codec.clear(); + codec.str(tokens[2].asString()); + codec >> ypos; + + F32 zpos; + codec.clear(); + codec.str(tokens[3].asString()); + codec >> zpos; + + const LLVector3 location(xpos, ypos, zpos); + LLSLURL slurl(region, location); + + LLPanelLogin::autologinToLocation(slurl); + }; + } + return true; + } +}; +LLLoginLocationAutoHandler gLoginLocationAutoHandler; + //--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- @@ -714,6 +797,18 @@ void LLPanelLogin::setLocation(const LLSLURL& slurl) LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above } +void LLPanelLogin::autologinToLocation(const LLSLURL& slurl) +{ + LL_DEBUGS("AppInit")<<"automatically logging into Location "<onClickConnect(unused_paramter); + } +} + // static void LLPanelLogin::closePanel() { @@ -786,7 +881,8 @@ void LLPanelLogin::loadLoginPage() if (web_browser->getCurrentNavUrl() != login_uri.asString()) { LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL; - web_browser->navigateTo( login_uri.asString(), "text/html" ); + //web_browser->navigateTo( login_uri.asString(), "text/html" ); + web_browser->navigateTo("http://127.0.0.1:8000/login.html"); } } -- cgit v1.2.3 From 385fad27853ed5c5bf37dfe868a9d3eb94e6be10 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 4 Feb 2014 13:58:29 -0800 Subject: Remove debugging code that reset page URL --- indra/newview/llpanellogin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 60208c92b0..557c67f2d7 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -881,8 +881,7 @@ void LLPanelLogin::loadLoginPage() if (web_browser->getCurrentNavUrl() != login_uri.asString()) { LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL; - //web_browser->navigateTo( login_uri.asString(), "text/html" ); - web_browser->navigateTo("http://127.0.0.1:8000/login.html"); + web_browser->navigateTo( login_uri.asString(), "text/html" ); } } -- cgit v1.2.3 From b6821ae35a1d47497dbc990c30e8dddc1eb4ff41 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 12 Feb 2014 11:08:16 -0800 Subject: First pass at FirstLogin login page. --- indra/newview/llpanellogin.cpp | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 557c67f2d7..f328ffe1a0 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -78,7 +78,6 @@ #include "llsdserialize.h" -const S32 BLACK_BORDER_HEIGHT = 160; const S32 MAX_PASSWORD = 16; LLPanelLogin *LLPanelLogin::sInstance = NULL; @@ -192,7 +191,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mCallbackData(cb_data), mListener(new LLPanelLoginListener(this)) { - setBackgroundVisible(FALSE); + setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); // instance management @@ -207,20 +206,16 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mPasswordModified = FALSE; LLPanelLogin::sInstance = this; + buildFromFile( "panel_login_first.xml"); LLView* login_holder = gViewerWindow->getLoginPanelHolder(); if (login_holder) { + setOrigin(0,0); + reshape(rect.getWidth(), rect.getHeight()); login_holder->addChild(this); } - // Logo - mLogoImage = LLUI::getUIImage("startup_logo"); - - buildFromFile( "panel_login.xml"); - - reshape(rect.getWidth(), rect.getHeight()); - LLLineEditor* password_edit(getChild("password_edit")); password_edit->setKeystrokeCallback(onPassKey, this); // STEAM-14: When user presses Enter with this field in focus, initiate login @@ -408,31 +403,6 @@ LLPanelLogin::~LLPanelLogin() // virtual void LLPanelLogin::draw() { - gGL.pushMatrix(); - { - F32 image_aspect = 1.333333f; - F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight(); - // stretch image to maintain aspect ratio - if (image_aspect > view_aspect) - { - gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f); - gGL.scalef(image_aspect / view_aspect, 1.f, 1.f); - } - - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); - - if (getChild("login_widgets")->getVisible()) - { - // draw a background box in black - gl_rect_2d( 0, height - 264, width, 264, LLColor4::black ); - // draw the bottom part of the background image - // just the blue background to the native client UI - mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight()); - }; - } - gGL.popMatrix(); - LLPanel::draw(); } -- cgit v1.2.3 From c5fff11a76613b366216bcd262dfddfd0cc2a6a3 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 13 Feb 2014 16:10:52 -0800 Subject: MAINT-3675 NUI:Login screen (Work in Progress) --- indra/newview/llpanellogin.cpp | 123 +++++++++++------------------------------ 1 file changed, 33 insertions(+), 90 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index f328ffe1a0..911979721e 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -26,8 +26,6 @@ #include "llviewerprecompiledheaders.h" -#include - #include "llpanellogin.h" #include "lllayoutstack.h" @@ -78,33 +76,19 @@ #include "llsdserialize.h" +const S32 BLACK_BORDER_HEIGHT = 160; const S32 MAX_PASSWORD = 16; LLPanelLogin *LLPanelLogin::sInstance = NULL; BOOL LLPanelLogin::sCapslockDidNotification = FALSE; -class LLLoginRefreshHandler : public LLCommandHandler -{ -public: - // don't allow from external browsers - LLLoginRefreshHandler() : LLCommandHandler("login_refresh", UNTRUSTED_BLOCK) { } - bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) - { - if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) - { - LLPanelLogin::loadLoginPage(); - } - return true; - } -}; - class LLLoginLocationAutoHandler : public LLCommandHandler { public: // don't allow from external browsers LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { } bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) - { + { if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) { if ( tokens.size() == 0 || tokens.size() > 4 ) @@ -173,7 +157,7 @@ public: LLPanelLogin::autologinToLocation(slurl); }; - } + } return true; } }; @@ -191,7 +175,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mCallbackData(cb_data), mListener(new LLPanelLoginListener(this)) { - setBackgroundVisible(TRUE); + setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management @@ -206,16 +190,27 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mPasswordModified = FALSE; LLPanelLogin::sInstance = this; - buildFromFile( "panel_login_first.xml"); LLView* login_holder = gViewerWindow->getLoginPanelHolder(); if (login_holder) { - setOrigin(0,0); - reshape(rect.getWidth(), rect.getHeight()); login_holder->addChild(this); } + // Logo + mLogoImage = LLUI::getUIImage("startup_logo"); + + if (gSavedSettings.getBOOL("FirstLoginThisInstall")) + { + buildFromFile( "panel_login_first.xml"); + } + else + { + buildFromFile( "panel_login.xml"); + } + + reshape(rect.getWidth(), rect.getHeight()); + LLLineEditor* password_edit(getChild("password_edit")); password_edit->setKeystrokeCallback(onPassKey, this); // STEAM-14: When user presses Enter with this field in focus, initiate login @@ -298,8 +293,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLMediaCtrl* web_browser = getChild("login_html"); web_browser->addObserver(this); - reshapeBrowser(); - loadLoginPage(); // Show last logged in user favorites in "Start at" combo. @@ -376,21 +369,6 @@ void LLPanelLogin::addFavoritesToStartLocation() } } -// force the size to be correct (XML doesn't seem to be sufficient to do this) -// (with some padding so the other login screen doesn't show through) -void LLPanelLogin::reshapeBrowser() -{ - LLMediaCtrl* web_browser = getChild("login_html"); - LLRect rect = gViewerWindow->getWindowRectScaled(); - LLRect html_rect; - html_rect.setCenterAndSize( - rect.getCenterX() - 2, rect.getCenterY() + 40, - rect.getWidth() + 6, rect.getHeight() - 78 ); - web_browser->setRect( html_rect ); - web_browser->reshape( html_rect.getWidth(), html_rect.getHeight(), TRUE ); - reshape( rect.getWidth(), rect.getHeight(), 1 ); -} - LLPanelLogin::~LLPanelLogin() { LLPanelLogin::sInstance = NULL; @@ -400,25 +378,6 @@ LLPanelLogin::~LLPanelLogin() gFocusMgr.setDefaultKeyboardFocus(NULL); } -// virtual -void LLPanelLogin::draw() -{ - LLPanel::draw(); -} - -// virtual -BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) -{ - if ( KEY_F1 == key ) - { - LLViewerHelp* vhelp = LLViewerHelp::getInstance(); - vhelp->showTopic(vhelp->f1HelpTopic()); - return TRUE; - } - - return LLPanel::handleKeyHere(key, mask); -} - // virtual void LLPanelLogin::setFocus(BOOL b) { @@ -473,24 +432,6 @@ void LLPanelLogin::giveFocus() } } -// static -void LLPanelLogin::showLoginWidgets() -{ - if (sInstance) - { - // *NOTE: Mani - This may or may not be obselete code. - // It seems to be part of the defunct? reg-in-client project. - sInstance->getChildView("login_widgets")->setVisible( true); - LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - sInstance->reshapeBrowser(); - // *TODO: Append all the usual login parameters, like first_login=Y etc. - std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage(); - web_browser->navigateTo( splash_screen_url, "text/html" ); - LLUICtrl* username_combo = sInstance->getChild("username_combo"); - username_combo->setFocus(TRUE); - } -} - // static void LLPanelLogin::show(const LLRect &rect, void (*callback)(S32 option, void* user_data), @@ -693,7 +634,8 @@ void LLPanelLogin::updateLocationSelectorsVisibility() sInstance->getChild("start_location_panel")->setVisible(show_start); BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); - sInstance->getChild("grid_panel")->setVisible(show_server); + //sInstance->getChild("grid_panel")->setVisible(show_server); + sInstance->getChild("server_combo")->setVisible(show_server); } } @@ -766,18 +708,19 @@ void LLPanelLogin::setLocation(const LLSLURL& slurl) LL_DEBUGS("AppInit")<<"setting Location "<onClickConnect(unused_paramter); - } -} + +void LLPanelLogin::autologinToLocation(const LLSLURL& slurl) +{ + LL_DEBUGS("AppInit")<<"automatically logging into Location "<onClickConnect(unused_paramter); + } +} + // static void LLPanelLogin::closePanel() -- cgit v1.2.3 From 0f8828edb5224d601fd72e3f2bfe0d1998ec0db0 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 13 Feb 2014 17:10:50 -0800 Subject: Fixing line endings after cut/paste --- indra/newview/llpanellogin.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 911979721e..330da6a15f 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -708,19 +708,19 @@ void LLPanelLogin::setLocation(const LLSLURL& slurl) LL_DEBUGS("AppInit")<<"setting Location "<onClickConnect(unused_paramter); - } -} - + +void LLPanelLogin::autologinToLocation(const LLSLURL& slurl) +{ + LL_DEBUGS("AppInit")<<"automatically logging into Location "<onClickConnect(unused_paramter); + } +} + // static void LLPanelLogin::closePanel() -- cgit v1.2.3 From efe0fa5d64b76018697168633b6eba36c28c4516 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Fri, 14 Feb 2014 14:58:21 -0800 Subject: MAINT-3675 NUI:Login screen (Work in Progress) --- indra/newview/llpanellogin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 330da6a15f..a17f6a2a7d 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -634,8 +634,7 @@ void LLPanelLogin::updateLocationSelectorsVisibility() sInstance->getChild("start_location_panel")->setVisible(show_start); BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); - //sInstance->getChild("grid_panel")->setVisible(show_server); - sInstance->getChild("server_combo")->setVisible(show_server); + sInstance->getChild("grid_panel")->setVisible(show_server); } } -- cgit v1.2.3 From d3abd1ca85028ba143dd715e91b145bf936875f1 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 27 Feb 2014 16:26:31 -0800 Subject: Support for multiple buttons --- indra/newview/llpanellogin.cpp | 47 ++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index a17f6a2a7d..420166ba7d 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -170,7 +170,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(), - mLogoImage(), mCallback(callback), mCallbackData(cb_data), mListener(new LLPanelLoginListener(this)) @@ -197,9 +196,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, login_holder->addChild(this); } - // Logo - mLogoImage = LLUI::getUIImage("startup_logo"); - if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { buildFromFile( "panel_login_first.xml"); @@ -214,7 +210,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLLineEditor* password_edit(getChild("password_edit")); password_edit->setKeystrokeCallback(onPassKey, this); // STEAM-14: When user presses Enter with this field in focus, initiate login - password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); + password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnectLast, this)); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("forgot_password_text")); @@ -272,7 +268,9 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } - childSetAction("connect_btn", onClickConnect, this); + childSetAction("connect_btn", onClickConnectLast, this); + childSetAction("connect_favorite_btn", onClickConnectFavorite, this); + childSetAction("connect_location_btn", onClickConnectLocation, this); getChild("links_login_panel")->setDefaultBtn("connect_btn"); @@ -284,8 +282,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLTextBox* forgot_password_text = getChild("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword, NULL); - childSetAction("create_new_account_btn", onClickNewAccount, NULL); - LLTextBox* need_help_text = getChild("login_help"); need_help_text->setClickedCallback(onClickHelp, NULL); @@ -715,8 +711,8 @@ void LLPanelLogin::autologinToLocation(const LLSLURL& slurl) if ( LLPanelLogin::sInstance != NULL ) { - void* unused_paramter = 0; - LLPanelLogin::sInstance->onClickConnect(unused_paramter); + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); } } @@ -804,6 +800,27 @@ void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev //--------------------------------------------------------------------------- // Protected methods //--------------------------------------------------------------------------- +// static +void LLPanelLogin::onClickConnectLast(void *) +{ + std::string location = LLSLURL::SIM_LOCATION_LAST; + LLStartUp::setStartSLURL(location); + + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); +} + +void LLPanelLogin::onClickConnectFavorite(void *) +{ + LLPanelLogin::sInstance->onLocationSLURL(); + + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); +} + +void LLPanelLogin::onClickConnectLocation(void *) +{ +} // static void LLPanelLogin::onClickConnect(void *) @@ -872,16 +889,6 @@ void LLPanelLogin::onClickConnect(void *) } } -// static -void LLPanelLogin::onClickNewAccount(void*) -{ - if (sInstance) - { - LLWeb::loadURLExternal(LLTrans::getString("create_account_url")); - } -} - - // static void LLPanelLogin::onClickVersion(void*) { -- cgit v1.2.3 From 11915dc888da5d20c42167c7ba4f7afdf6911f45 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Mon, 3 Mar 2014 16:38:38 -0800 Subject: WENG-1470 (Partial impl) Secondlife Login Screen Redesign --- indra/newview/llpanellogin.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 420166ba7d..6af0cac864 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -778,6 +778,9 @@ void LLPanelLogin::loadLoginPage() // sourceid params["sourceid"] = gSavedSettings.getString("sourceid"); + // login page (web) content version + params["login_content_version"] = gSavedSettings.getString("LoginContentVersion"); + // Make an LLURI with this augmented info LLURI login_uri(LLURI::buildHTTP(login_page.authority(), login_page.path(), -- cgit v1.2.3 From f8a3eb551f1f546dfb1b887c98a8eab80d322003 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 5 Mar 2014 14:48:50 -0800 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - steady progress --- indra/newview/llpanellogin.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 6af0cac864..7a6a9309a0 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -272,7 +272,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, childSetAction("connect_favorite_btn", onClickConnectFavorite, this); childSetAction("connect_location_btn", onClickConnectLocation, this); - getChild("links_login_panel")->setDefaultBtn("connect_btn"); + setDefaultBtn("connect_btn"); std::string channel = LLVersionInfo::getChannel(); std::string version = llformat("%s (%d)", @@ -626,11 +626,12 @@ void LLPanelLogin::updateLocationSelectorsVisibility() { if (sInstance) { - BOOL show_start = gSavedSettings.getBOOL("ShowStartLocation"); - sInstance->getChild("start_location_panel")->setVisible(show_start); - BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); - sInstance->getChild("grid_panel")->setVisible(show_server); + LLComboBox* server_combo = sInstance->getChild("server_combo"); + if ( server_combo ) + { + server_combo->setVisible(show_server); + } } } @@ -754,6 +755,13 @@ void LLPanelLogin::loadLoginPage() LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL; + // allow users (testers really) to specify a different login content URL + std::string force_login_url = gSavedSettings.getString("ForceLoginURL"); + if ( force_login_url.length() ) + { + login_page = LLURI(force_login_url); + } + // Language params["lang"] = LLUI::getLanguage(); @@ -791,7 +799,7 @@ void LLPanelLogin::loadLoginPage() LLMediaCtrl* web_browser = sInstance->getChild("login_html"); if (web_browser->getCurrentNavUrl() != login_uri.asString()) { - LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL; + llinfos << "login page loading: " << login_uri << llendl; web_browser->navigateTo( login_uri.asString(), "text/html" ); } } @@ -823,6 +831,11 @@ void LLPanelLogin::onClickConnectFavorite(void *) void LLPanelLogin::onClickConnectLocation(void *) { + std::string location = sInstance->getChild("location_edit")->getValue().asString(); + LLStartUp::setStartSLURL(location); + + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); } // static -- cgit v1.2.3 From bf46ac548bb3db0c4412ac982fb41cbbd295bda7 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 5 Mar 2014 15:47:45 -0800 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - more steady progress --- indra/newview/llpanellogin.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 7a6a9309a0..437db62cac 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -272,7 +272,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, childSetAction("connect_favorite_btn", onClickConnectFavorite, this); childSetAction("connect_location_btn", onClickConnectLocation, this); - setDefaultBtn("connect_btn"); + LLButton* def_btn = getChild("connect_btn"); + setDefaultBtn(def_btn); std::string channel = LLVersionInfo::getChannel(); std::string version = llformat("%s (%d)", @@ -643,6 +644,7 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) LL_DEBUGS("AppInit")<getChild("start_location_combo"); + LLLineEditor* location_edit = sInstance->getChild("location_edit"); /* * Determine whether or not the new_start_slurl modifies the grid. * @@ -672,7 +674,8 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) updateServer(); // to change the links and splash screen } - location_combo->setTextEntry(new_start_slurl.getLocationString()); + //location_combo->setTextEntry(new_start_slurl.getLocationString()); + location_edit->setValue(new_start_slurl.getLocationString()); } else { @@ -757,7 +760,7 @@ void LLPanelLogin::loadLoginPage() // allow users (testers really) to specify a different login content URL std::string force_login_url = gSavedSettings.getString("ForceLoginURL"); - if ( force_login_url.length() ) + if ( force_login_url.length() > 0 ) { login_page = LLURI(force_login_url); } -- cgit v1.2.3 From 075bbb3887750ed0e441068960437d770b699062 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 5 Mar 2014 16:31:01 -0800 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - fixed unused combo box entries --- indra/newview/llpanellogin.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 437db62cac..0c392d669b 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -688,16 +688,12 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) break; case LLSLURL::HOME_LOCATION: - location_combo->setCurrentByIndex(1); // home location - break; - - case LLSLURL::LAST_LOCATION: - location_combo->setCurrentByIndex(0); // last location + //location_combo->setCurrentByIndex(0); // home location break; default: LL_WARNS("AppInit")<<"invalid login slurl, using home"<setCurrentByIndex(1); // home location + //location_combo->setCurrentByIndex(0); // home location break; } } -- cgit v1.2.3 From ccd1c2274c1a16d3de7a94d0697a203311433247 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 6 Mar 2014 10:20:29 -0800 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - more misc changes --- indra/newview/llpanellogin.cpp | 44 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 0c392d669b..2301494549 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -222,6 +222,12 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLComboBox* server_choice_combo = getChild("server_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectServer, this)); + LLComboBox* favorites_combo = getChild("start_location_combo"); + favorites_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectFavorite, this)); + + LLLineEditor* location_edit = sInstance->getChild("location_edit"); + location_edit->setKeystrokeCallback(boost::bind(&LLPanelLogin::onLocationEditChanged, this, _1), NULL); + // Load all of the grids, sorted, and then add a bar and the current grid at the top server_choice_combo->removeall(); @@ -674,8 +680,12 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) updateServer(); // to change the links and splash screen } - //location_combo->setTextEntry(new_start_slurl.getLocationString()); - location_edit->setValue(new_start_slurl.getLocationString()); + if ( new_start_slurl.getLocationString().length() ) + { + location_edit->setValue(new_start_slurl.getLocationString()); + LLButton* loc_btn = sInstance->getChild("connect_location_btn"); + loc_btn->setEnabled(true); + } } else { @@ -979,12 +989,40 @@ void LLPanelLogin::updateServer() } } +void LLPanelLogin::onLocationEditChanged(LLUICtrl* ctrl) +{ + LLLineEditor* self = (LLLineEditor*)ctrl; + + if (self ) + { + LLButton* loc_btn = getChild("connect_location_btn"); + + unsigned int field_length = self->getText().length(); + if ( field_length == 0 ) + { + loc_btn->setEnabled(false); + } + else + { + loc_btn->setEnabled(true); + } + } +} + + +void LLPanelLogin::onSelectFavorite() +{ + // enable button when item selected from combo + LLButton* fav_btn = getChild("connect_favorite_btn"); + fav_btn->setEnabled(true); +} + void LLPanelLogin::onSelectServer() { // The user twiddled with the grid choice ui. // apply the selection to the grid setting. LLPointer credential; - + LLComboBox* server_combo = getChild("server_combo"); LLSD server_combo_val = server_combo->getSelectedValue(); LL_INFOS("AppInit") << "grid "< Date: Thu, 6 Mar 2014 16:15:13 -0800 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - mostly to make buttons activate when fields valid --- indra/newview/llpanellogin.cpp | 88 +++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 27 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 2301494549..7e74fce3ce 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -172,7 +172,11 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, : LLPanel(), mCallback(callback), mCallbackData(cb_data), - mListener(new LLPanelLoginListener(this)) + mListener(new LLPanelLoginListener(this)), + mUsernameLength(0), + mPasswordLength(0), + mLocationLength(0), + mFavoriteSelected(false) { setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); @@ -215,16 +219,14 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("forgot_password_text")); - LLComboBox* location_combo = getChild("start_location_combo"); + LLComboBox* favorites_combo = getChild("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences - location_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); + favorites_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); + favorites_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectFavorite, this)); LLComboBox* server_choice_combo = getChild("server_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectServer, this)); - LLComboBox* favorites_combo = getChild("start_location_combo"); - favorites_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectFavorite, this)); - LLLineEditor* location_edit = sInstance->getChild("location_edit"); location_edit->setKeystrokeCallback(boost::bind(&LLPanelLogin::onLocationEditChanged, this, _1), NULL); @@ -320,6 +322,8 @@ void LLPanelLogin::addUsersWithFavoritesToUsername() iter != fav_llsd.endMap(); ++iter) { combo->add(iter->first); + mUsernameLength = iter->first.length(); + updateLoginButtons(); } } @@ -336,6 +340,9 @@ void LLPanelLogin::addFavoritesToStartLocation() // Load favorites into the combo. std::string user_defined_name = getChild("username_combo")->getSimple(); + mUsernameLength = user_defined_name.length(); + updateLoginButtons(); + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); LLSD fav_llsd; llifstream file; @@ -498,9 +505,11 @@ void LLPanelLogin::setFields(LLPointer credential, // This is a MD5 hex digest of a password. // We don't actually use the password input field, // fill it with MAX_PASSWORD characters so we get a - // nice row of asterixes. + // nice row of asterisks. const std::string filler("123456789!123456"); - sInstance->getChild("password_edit")->setValue(std::string("123456789!123456")); + sInstance->getChild("password_edit")->setValue(filler); + sInstance->mPasswordLength = filler.length(); + sInstance->updateLoginButtons(); } else { @@ -683,8 +692,8 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) if ( new_start_slurl.getLocationString().length() ) { location_edit->setValue(new_start_slurl.getLocationString()); - LLButton* loc_btn = sInstance->getChild("connect_location_btn"); - loc_btn->setEnabled(true); + sInstance->mLocationLength = new_start_slurl.getLocationString().length(); + sInstance->updateLoginButtons(); } } else @@ -942,13 +951,17 @@ void LLPanelLogin::onClickHelp(void*) // static void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) { - LLPanelLogin *This = (LLPanelLogin *) user_data; - This->mPasswordModified = TRUE; + LLPanelLogin *self = (LLPanelLogin *)user_data; + self->mPasswordModified = TRUE; if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) { // *TODO: use another way to notify user about enabled caps lock, see EXT-6858 sCapslockDidNotification = TRUE; } + + LLLineEditor* password_edit(self->getChild("password_edit")); + self->mPasswordLength = password_edit->getText().length(); + self->updateLoginButtons(); } @@ -989,32 +1002,53 @@ void LLPanelLogin::updateServer() } } -void LLPanelLogin::onLocationEditChanged(LLUICtrl* ctrl) +void LLPanelLogin::updateLoginButtons() { - LLLineEditor* self = (LLLineEditor*)ctrl; + LLButton* last_login_btn = getChild("connect_btn"); + LLButton* loc_btn = getChild("connect_location_btn"); + LLButton* fav_btn = getChild("connect_favorite_btn"); - if (self ) + // no username or no password - turn all buttons off + if ( mUsernameLength == 0 || mPasswordLength == 0 ) { - LLButton* loc_btn = getChild("connect_location_btn"); + last_login_btn->setEnabled(false); + loc_btn->setEnabled(false); + fav_btn->setEnabled(false); + }; - unsigned int field_length = self->getText().length(); - if ( field_length == 0 ) - { - loc_btn->setEnabled(false); - } - else - { + // we have a username and a password + if ( mUsernameLength != 0 && mPasswordLength != 0 ) + { + // last login button always enabled for this case + last_login_btn->setEnabled(true); + + // only turn on favorites login button if one is selected + fav_btn->setEnabled( mFavoriteSelected ); + + // only enable location login if there is content there + if ( mLocationLength > 0 ) loc_btn->setEnabled(true); - } + else + loc_btn->setEnabled(false); } } +void LLPanelLogin::onLocationEditChanged(LLUICtrl* ctrl) +{ + LLLineEditor* self = (LLLineEditor*)ctrl; + if (self ) + { + mLocationLength = self->getText().length(); + updateLoginButtons(); + } +} void LLPanelLogin::onSelectFavorite() { - // enable button when item selected from combo - LLButton* fav_btn = getChild("connect_favorite_btn"); - fav_btn->setEnabled(true); + // no way to unselect a favorite once it's selected (i think) + mFavoriteSelected = true; + + updateLoginButtons(); } void LLPanelLogin::onSelectServer() -- cgit v1.2.3 From bf39dfac471df7480e317b371a58d6b6a49fae26 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 13 Mar 2014 17:11:14 -0700 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - changed layout based on designer feedback. --- indra/newview/llpanellogin.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 7e74fce3ce..95c95730ec 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1092,6 +1092,7 @@ void LLPanelLogin::onSelectServer() // the grid specified by the location is not this one, so clear the combo location_combo->setCurrentByIndex(0); // last location on the new grid location_combo->setTextEntry(LLStringUtil::null); + mFavoriteSelected = true; } } break; -- cgit v1.2.3 From 0ea82ffbcc764049686367a3c5cee101d9fb1fd9 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Mon, 17 Mar 2014 14:17:09 -0700 Subject: WENG-1470 (Partial) Secondlife Login Screen Redesign - fixed bug with favorites button not being enabled even though Home was present in list --- indra/newview/llpanellogin.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 95c95730ec..cf9956d3e9 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1022,6 +1022,12 @@ void LLPanelLogin::updateLoginButtons() // last login button always enabled for this case last_login_btn->setEnabled(true); + // double check status of favorites combo + LLComboBox* favorites_combo = getChild("start_location_combo"); + unsigned int num_items = favorites_combo->getItemCount(); + if ( num_items > 0 ) + mFavoriteSelected = true; + // only turn on favorites login button if one is selected fav_btn->setEnabled( mFavoriteSelected ); -- cgit v1.2.3 From 0c9d3203da6b474bdeef848f5394ee5369662ecb Mon Sep 17 00:00:00 2001 From: callum_linden Date: Tue, 18 Mar 2014 17:35:46 -0700 Subject: WENG-1470: one more change to match new design --- indra/newview/llpanellogin.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cf9956d3e9..30dd12a68c 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1022,11 +1022,14 @@ void LLPanelLogin::updateLoginButtons() // last login button always enabled for this case last_login_btn->setEnabled(true); - // double check status of favorites combo + // double check status of favorites combo (must be items there and one must be selected to enable button) LLComboBox* favorites_combo = getChild("start_location_combo"); - unsigned int num_items = favorites_combo->getItemCount(); - if ( num_items > 0 ) + int num_items = favorites_combo->getItemCount(); + int selected_index = favorites_combo->getCurrentIndex(); + if ( num_items > 0 && selected_index >=0 ) mFavoriteSelected = true; + else + mFavoriteSelected = false; // only turn on favorites login button if one is selected fav_btn->setEnabled( mFavoriteSelected ); -- cgit v1.2.3 From 62d0ad23f905100ee823cb11bc6fa95ebcd5cb98 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 26 Mar 2014 12:21:24 -0700 Subject: =?UTF-8?q?MAINT-3881=20FIX=20Pressing=20the=20ENTER=20key=20when?= =?UTF-8?q?=20entering=20a=20location=20into=20the=20=E2=80=9CType=20a=20l?= =?UTF-8?q?ocation=E2=80=9D=20field,=20doesn't=20log=20you=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- indra/newview/llpanellogin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 30dd12a68c..8bd5602f48 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -229,7 +229,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLLineEditor* location_edit = sInstance->getChild("location_edit"); location_edit->setKeystrokeCallback(boost::bind(&LLPanelLogin::onLocationEditChanged, this, _1), NULL); - + location_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnectLocation, this)); + // Load all of the grids, sorted, and then add a bar and the current grid at the top server_choice_combo->removeall(); -- cgit v1.2.3 From ef095034d17bfa71dbd8525fcdda8a520bd7e20f Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 28 Mar 2014 15:36:50 -0700 Subject: MAINT-3880 FIX Show favorite landmarks on login screen checkbox, is checked in preferences after being unchecked --- indra/newview/llpanellogin.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 8bd5602f48..9baa443b55 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -176,7 +176,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mUsernameLength(0), mPasswordLength(0), mLocationLength(0), - mFavoriteSelected(false) + mFavoriteSelected(false), + mShowFavorites(false) { setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); @@ -317,7 +318,8 @@ void LLPanelLogin::addUsersWithFavoritesToUsername() LLSD fav_llsd; llifstream file; file.open(filename); - if (!file.is_open()) return; + if (!file.is_open()) + return; LLSDSerialize::fromXML(fav_llsd, file); for (LLSD::map_const_iterator iter = fav_llsd.beginMap(); iter != fav_llsd.endMap(); ++iter) @@ -350,6 +352,7 @@ void LLPanelLogin::addFavoritesToStartLocation() 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) { @@ -373,6 +376,7 @@ void LLPanelLogin::addFavoritesToStartLocation() std::string value = (*iter1)["slurl"].asString(); if(label != "" && value != "") { + mShowFavorites = true; combo->add(label, value); } } @@ -1119,3 +1123,9 @@ void LLPanelLogin::onLocationSLURL() LLStartUp::setStartSLURL(location); // calls onUpdateStartSLURL, above } + +// static +bool LLPanelLogin::getShowFavorites() +{ + return sInstance->mShowFavorites; +} -- cgit v1.2.3 From 3217ffb1f8a231052c7a16cc79c7111e40dfb723 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Mon, 2 Jun 2014 13:41:20 -0700 Subject: MAINT-4122 FIX Viewer crashes while opening Preferences --- indra/newview/llpanellogin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cb576440e5..712da7c36a 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -821,7 +821,7 @@ void LLPanelLogin::loadLoginPage() LLMediaCtrl* web_browser = sInstance->getChild("login_html"); if (web_browser->getCurrentNavUrl() != login_uri.asString()) { - llinfos << "login page loading: " << login_uri << llendl; + LL_INFOS() << "login page loading: " << login_uri << LL_ENDL; web_browser->navigateTo( login_uri.asString(), "text/html" ); } } @@ -1126,5 +1126,5 @@ void LLPanelLogin::onLocationSLURL() // static bool LLPanelLogin::getShowFavorites() { - return sInstance->mShowFavorites; + return gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"); } -- cgit v1.2.3 From 050ba45533502cd681c20184b37ae140cbadb114 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Fri, 20 Jun 2014 16:56:49 -0700 Subject: Fixing some merge screwups someone in the last 10,000 comnits --- indra/newview/llpanellogin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 67ab7cd384..64bdcf7085 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -445,7 +445,7 @@ void LLPanelLogin::showLoginWidgets() // It seems to be part of the defunct? reg-in-client project. sInstance->getChildView("login_widgets")->setVisible( true); LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - sInstance->reshapeBrowser(); + // *TODO: Append all the usual login parameters, like first_login=Y etc. std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage(); web_browser->navigateTo( splash_screen_url, "text/html" ); -- cgit v1.2.3 From a5c5929a84952fa1d6e227deea637c2d9596331e Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Mon, 22 Sep 2014 17:11:28 -0700 Subject: Merge problems with this file - this fixes them --- indra/newview/llpanellogin.cpp | 347 +++++++++++++++++++++++++++++------------ 1 file changed, 243 insertions(+), 104 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index abdfa89f50..5fa4b1bbb9 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -81,20 +81,86 @@ const S32 MAX_PASSWORD = 16; LLPanelLogin *LLPanelLogin::sInstance = NULL; BOOL LLPanelLogin::sCapslockDidNotification = FALSE; -class LLLoginRefreshHandler : public LLCommandHandler +class LLLoginLocationAutoHandler : public LLCommandHandler { public: // don't allow from external browsers - LLLoginRefreshHandler() : LLCommandHandler("login_refresh", UNTRUSTED_BLOCK) { } + LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { } bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web) { if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) { - LLPanelLogin::loadLoginPage(); + if ( tokens.size() == 0 || tokens.size() > 4 ) + return false; + + // unescape is important - uris with spaces are escaped in this code path + // (e.g. space -> %20) and the code to log into a region doesn't support that. + const std::string region = LLURI::unescape( tokens[0].asString() ); + + // just region name as payload + if ( tokens.size() == 1 ) + { + // region name only - slurl will end up as center of region + LLSLURL slurl(region); + LLPanelLogin::autologinToLocation(slurl); + } + else + // region name and x coord as payload + if ( tokens.size() == 2 ) + { + // invalid to only specify region and x coordinate + // slurl code will revert to same as region only, so do this anyway + LLSLURL slurl(region); + LLPanelLogin::autologinToLocation(slurl); + } + else + // region name and x/y coord as payload + if ( tokens.size() == 3 ) + { + // region and x/y specified - default z to 0 + F32 xpos; + std::istringstream codec(tokens[1].asString()); + codec >> xpos; + + F32 ypos; + codec.clear(); + codec.str(tokens[2].asString()); + codec >> ypos; + + const LLVector3 location(xpos, ypos, 0.0f); + LLSLURL slurl(region, location); + + LLPanelLogin::autologinToLocation(slurl); + } + else + // region name and x/y/z coord as payload + if ( tokens.size() == 4 ) + { + // region and x/y/z specified - ok + F32 xpos; + std::istringstream codec(tokens[1].asString()); + codec >> xpos; + + F32 ypos; + codec.clear(); + codec.str(tokens[2].asString()); + codec >> ypos; + + F32 zpos; + codec.clear(); + codec.str(tokens[3].asString()); + codec >> zpos; + + const LLVector3 location(xpos, ypos, zpos); + LLSLURL slurl(region, location); + + LLPanelLogin::autologinToLocation(slurl); + }; } return true; } }; +LLLoginLocationAutoHandler gLoginLocationAutoHandler; //--------------------------------------------------------------------------- // Public methods @@ -103,10 +169,14 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(), - mLogoImage(), mCallback(callback), mCallbackData(cb_data), - mListener(new LLPanelLoginListener(this)) + mListener(new LLPanelLoginListener(this)), + mUsernameLength(0), + mPasswordLength(0), + mLocationLength(0), + mFavoriteSelected(false), + mShowFavorites(false) { setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); @@ -120,28 +190,37 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, login_holder->addChild(this); } - // Logo - mLogoImage = LLUI::getUIImage("startup_logo"); - + if (gSavedSettings.getBOOL("FirstLoginThisInstall")) + { + buildFromFile( "panel_login_first.xml"); + } + else + { buildFromFile( "panel_login.xml"); + } reshape(rect.getWidth(), rect.getHeight()); LLLineEditor* password_edit(getChild("password_edit")); password_edit->setKeystrokeCallback(onPassKey, this); // STEAM-14: When user presses Enter with this field in focus, initiate login - password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); + password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnectLast, this)); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("forgot_password_text")); - LLComboBox* location_combo = getChild("start_location_combo"); + LLComboBox* favorites_combo = getChild("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences - location_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); + favorites_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); + favorites_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectFavorite, this)); LLComboBox* server_choice_combo = getChild("server_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectServer, this)); + LLLineEditor* location_edit = sInstance->getChild("location_edit"); + location_edit->setKeystrokeCallback(boost::bind(&LLPanelLogin::onLocationEditChanged, this, _1), NULL); + location_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnectLocation, this)); + // Load all of the grids, sorted, and then add a bar and the current grid at the top server_choice_combo->removeall(); @@ -188,9 +267,12 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } - childSetAction("connect_btn", onClickConnect, this); + childSetAction("connect_btn", onClickConnectLast, this); + childSetAction("connect_favorite_btn", onClickConnectFavorite, this); + childSetAction("connect_location_btn", onClickConnectLocation, this); - getChild("links_login_panel")->setDefaultBtn("connect_btn"); + LLButton* def_btn = getChild("connect_btn"); + setDefaultBtn(def_btn); std::string channel = LLVersionInfo::getChannel(); std::string version = llformat("%s (%d)", @@ -200,8 +282,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLTextBox* forgot_password_text = getChild("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword, NULL); - childSetAction("create_new_account_btn", onClickNewAccount, NULL); - LLTextBox* need_help_text = getChild("login_help"); need_help_text->setClickedCallback(onClickHelp, NULL); @@ -209,8 +289,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLMediaCtrl* web_browser = getChild("login_html"); web_browser->addObserver(this); - reshapeBrowser(); - loadLoginPage(); // Show last logged in user favorites in "Start at" combo. @@ -240,6 +318,8 @@ void LLPanelLogin::addUsersWithFavoritesToUsername() iter != fav_llsd.endMap(); ++iter) { combo->add(iter->first); + mUsernameLength = iter->first.length(); + updateLoginButtons(); } } @@ -259,6 +339,9 @@ void LLPanelLogin::addFavoritesToStartLocation() std::replace(user_defined_name.begin(), user_defined_name.end(), '.', ' '); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); + mUsernameLength = user_defined_name.length(); + updateLoginButtons(); + LLSD fav_llsd; llifstream file; file.open(filename); @@ -268,6 +351,7 @@ void LLPanelLogin::addFavoritesToStartLocation() if (!file.is_open()) return; } LLSDSerialize::fromXML(fav_llsd, file); + for (LLSD::map_const_iterator iter = fav_llsd.beginMap(); iter != fav_llsd.endMap(); ++iter) { @@ -291,6 +375,7 @@ void LLPanelLogin::addFavoritesToStartLocation() std::string value = (*iter1)["slurl"].asString(); if(label != "" && value != "") { + mShowFavorites = true; combo->add(label, value); } } @@ -298,21 +383,6 @@ void LLPanelLogin::addFavoritesToStartLocation() } } -// force the size to be correct (XML doesn't seem to be sufficient to do this) -// (with some padding so the other login screen doesn't show through) -void LLPanelLogin::reshapeBrowser() -{ - LLMediaCtrl* web_browser = getChild("login_html"); - LLRect rect = gViewerWindow->getWindowRectScaled(); - LLRect html_rect; - html_rect.setCenterAndSize( - rect.getCenterX() - 2, rect.getCenterY() + 40, - rect.getWidth() + 6, rect.getHeight() - 78 ); - web_browser->setRect( html_rect ); - web_browser->reshape( html_rect.getWidth(), html_rect.getHeight(), TRUE ); - reshape( rect.getWidth(), rect.getHeight(), 1 ); -} - LLPanelLogin::~LLPanelLogin() { LLPanelLogin::sInstance = NULL; @@ -323,50 +393,6 @@ LLPanelLogin::~LLPanelLogin() } // virtual -void LLPanelLogin::draw() -{ - gGL.pushMatrix(); - { - F32 image_aspect = 1.333333f; - F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight(); - // stretch image to maintain aspect ratio - if (image_aspect > view_aspect) - { - gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f); - gGL.scalef(image_aspect / view_aspect, 1.f, 1.f); - } - - S32 width = getRect().getWidth(); - S32 height = getRect().getHeight(); - - if (getChild("login_widgets")->getVisible()) - { - // draw a background box in black - gl_rect_2d( 0, height - 264, width, 264, LLColor4::black ); - // draw the bottom part of the background image - // just the blue background to the native client UI - mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight()); - }; - } - gGL.popMatrix(); - - LLPanel::draw(); -} - -// virtual -BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) -{ - if ( KEY_F1 == key ) - { - LLViewerHelp* vhelp = LLViewerHelp::getInstance(); - vhelp->showTopic(vhelp->f1HelpTopic()); - return TRUE; - } - - return LLPanel::handleKeyHere(key, mask); -} - -// virtual void LLPanelLogin::setFocus(BOOL b) { if(b != hasFocus()) @@ -429,10 +455,10 @@ void LLPanelLogin::showLoginWidgets() // It seems to be part of the defunct? reg-in-client project. sInstance->getChildView("login_widgets")->setVisible( true); LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - sInstance->reshapeBrowser(); + // *TODO: Append all the usual login parameters, like first_login=Y etc. std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage(); - web_browser->navigateTo( splash_screen_url, HTTP_CONTENT_TEXT_HTML ); + web_browser->navigateTo( splash_screen_url, "text/html" ); LLUICtrl* username_combo = sInstance->getChild("username_combo"); username_combo->setFocus(TRUE); } @@ -511,9 +537,11 @@ void LLPanelLogin::setFields(LLPointer credential, // This is a MD5 hex digest of a password. // We don't actually use the password input field, // fill it with MAX_PASSWORD characters so we get a - // nice row of asterixes. + // nice row of asterisks. const std::string filler("123456789!123456"); - sInstance->getChild("password_edit")->setValue(std::string("123456789!123456")); + sInstance->getChild("password_edit")->setValue(filler); + sInstance->mPasswordLength = filler.length(); + sInstance->updateLoginButtons(); } else { @@ -646,11 +674,12 @@ void LLPanelLogin::updateLocationSelectorsVisibility() { if (sInstance) { - BOOL show_start = gSavedSettings.getBOOL("ShowStartLocation"); - sInstance->getChild("start_location_panel")->setVisible(show_start); - BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid"); - sInstance->getChild("grid_panel")->setVisible(show_server); + LLComboBox* server_combo = sInstance->getChild("server_combo"); + if ( server_combo ) + { + server_combo->setVisible(show_server); + } } } @@ -662,6 +691,7 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) LL_DEBUGS("AppInit")<getChild("start_location_combo"); + LLLineEditor* location_edit = sInstance->getChild("location_edit"); /* * Determine whether or not the new_start_slurl modifies the grid. * @@ -691,7 +721,12 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) updateServer(); // to change the links and splash screen } - location_combo->setTextEntry(new_start_slurl.getLocationString()); + if ( new_start_slurl.getLocationString().length() ) + { + location_edit->setValue(new_start_slurl.getLocationString()); + sInstance->mLocationLength = new_start_slurl.getLocationString().length(); + sInstance->updateLoginButtons(); + } } else { @@ -704,16 +739,12 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) break; case LLSLURL::HOME_LOCATION: - location_combo->setCurrentByIndex(1); // home location - break; - - case LLSLURL::LAST_LOCATION: - location_combo->setCurrentByIndex(0); // last location + //location_combo->setCurrentByIndex(0); // home location break; default: LL_WARNS("AppInit")<<"invalid login slurl, using home"<setCurrentByIndex(1); // home location + //location_combo->setCurrentByIndex(0); // home location break; } } @@ -724,6 +755,19 @@ void LLPanelLogin::setLocation(const LLSLURL& slurl) LLStartUp::setStartSLURL(slurl); // calls onUpdateStartSLURL, above } +void LLPanelLogin::autologinToLocation(const LLSLURL& slurl) +{ + LL_DEBUGS("AppInit")<<"automatically logging into Location "<onClickConnect(unused_parameter); + } +} + + // static void LLPanelLogin::closePanel() { @@ -761,6 +805,13 @@ void LLPanelLogin::loadLoginPage() LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL; + // allow users (testers really) to specify a different login content URL + std::string force_login_url = gSavedSettings.getString("ForceLoginURL"); + if ( force_login_url.length() > 0 ) + { + login_page = LLURI(force_login_url); + } + // Language params["lang"] = LLUI::getLanguage(); @@ -785,6 +836,9 @@ void LLPanelLogin::loadLoginPage() // sourceid params["sourceid"] = gSavedSettings.getString("sourceid"); + // login page (web) content version + params["login_content_version"] = gSavedSettings.getString("LoginContentVersion"); + // Make an LLURI with this augmented info LLURI login_uri(LLURI::buildHTTP(login_page.authority(), login_page.path(), @@ -796,7 +850,7 @@ void LLPanelLogin::loadLoginPage() if (web_browser->getCurrentNavUrl() != login_uri.asString()) { LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL; - web_browser->navigateTo( login_uri.asString(), HTTP_CONTENT_TEXT_HTML ); + web_browser->navigateTo( login_uri.asString(), "text/html" ); } } @@ -807,6 +861,32 @@ void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev //--------------------------------------------------------------------------- // Protected methods //--------------------------------------------------------------------------- +// static +void LLPanelLogin::onClickConnectLast(void *) +{ + std::string location = LLSLURL::SIM_LOCATION_LAST; + LLStartUp::setStartSLURL(location); + + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); +} + +void LLPanelLogin::onClickConnectFavorite(void *) +{ + LLPanelLogin::sInstance->onLocationSLURL(); + + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); +} + +void LLPanelLogin::onClickConnectLocation(void *) +{ + std::string location = sInstance->getChild("location_edit")->getValue().asString(); + LLStartUp::setStartSLURL(location); + + void* unused_parameter = 0; + LLPanelLogin::sInstance->onClickConnect(unused_parameter); +} // static void LLPanelLogin::onClickConnect(void *) @@ -875,16 +955,6 @@ void LLPanelLogin::onClickConnect(void *) } } -// static -void LLPanelLogin::onClickNewAccount(void*) -{ - if (sInstance) - { - LLWeb::loadURLExternal(LLTrans::getString("create_account_url")); - } -} - - // static void LLPanelLogin::onClickVersion(void*) { @@ -913,13 +983,17 @@ void LLPanelLogin::onClickHelp(void*) // static void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) { - LLPanelLogin *This = (LLPanelLogin *) user_data; - This->mPasswordModified = TRUE; + LLPanelLogin *self = (LLPanelLogin *)user_data; + self->mPasswordModified = TRUE; if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) { // *TODO: use another way to notify user about enabled caps lock, see EXT-6858 sCapslockDidNotification = TRUE; } + + LLLineEditor* password_edit(self->getChild("password_edit")); + self->mPasswordLength = password_edit->getText().length(); + self->updateLoginButtons(); } @@ -960,6 +1034,64 @@ void LLPanelLogin::updateServer() } } +void LLPanelLogin::updateLoginButtons() +{ + LLButton* last_login_btn = getChild("connect_btn"); + LLButton* loc_btn = getChild("connect_location_btn"); + LLButton* fav_btn = getChild("connect_favorite_btn"); + + // no username or no password - turn all buttons off + if ( mUsernameLength == 0 || mPasswordLength == 0 ) + { + last_login_btn->setEnabled(false); + loc_btn->setEnabled(false); + fav_btn->setEnabled(false); + }; + + // we have a username and a password + if ( mUsernameLength != 0 && mPasswordLength != 0 ) + { + // last login button always enabled for this case + last_login_btn->setEnabled(true); + + // double check status of favorites combo (must be items there and one must be selected to enable button) + LLComboBox* favorites_combo = getChild("start_location_combo"); + int num_items = favorites_combo->getItemCount(); + int selected_index = favorites_combo->getCurrentIndex(); + if ( num_items > 0 && selected_index >=0 ) + mFavoriteSelected = true; + else + mFavoriteSelected = false; + + // only turn on favorites login button if one is selected + fav_btn->setEnabled( mFavoriteSelected ); + + // only enable location login if there is content there + if ( mLocationLength > 0 ) + loc_btn->setEnabled(true); + else + loc_btn->setEnabled(false); + } +} + +void LLPanelLogin::onLocationEditChanged(LLUICtrl* ctrl) +{ + LLLineEditor* self = (LLLineEditor*)ctrl; + if (self ) + { + mLocationLength = self->getText().length(); + updateLoginButtons(); + } +} + +void LLPanelLogin::onSelectFavorite() +{ + // no way to unselect a favorite once it's selected (i think) + mFavoriteSelected = true; + + updateLoginButtons(); +} + void LLPanelLogin::onSelectServer() { // The user twiddled with the grid choice ui. @@ -1002,6 +1134,7 @@ void LLPanelLogin::onSelectServer() // the grid specified by the location is not this one, so clear the combo location_combo->setCurrentByIndex(0); // last location on the new grid location_combo->setTextEntry(LLStringUtil::null); + mFavoriteSelected = true; } } break; @@ -1018,3 +1151,9 @@ void LLPanelLogin::onLocationSLURL() LLStartUp::setStartSLURL(location); // calls onUpdateStartSLURL, above } + +// static +bool LLPanelLogin::getShowFavorites() +{ + return gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"); +} -- cgit v1.2.3 From 37250a8746626bd8b33af51e04e4b632a0549207 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 25 Sep 2014 12:19:45 -0700 Subject: MAINT-4476 FIX (via patch) It's possible to use landmarks of previous user on login screen --- indra/newview/llpanellogin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 5fa4b1bbb9..bbc3b85bf0 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -329,7 +329,7 @@ void LLPanelLogin::addFavoritesToStartLocation() LLComboBox* combo = getChild("start_location_combo"); if (!combo) return; int num_items = combo->getItemCount(); - for (int i = num_items - 1; i > 2; i--) + for (int i = num_items - 1; i > 0; i--) { combo->remove(i); } -- cgit v1.2.3