diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llpanellogin.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r-- | linden/indra/newview/llpanellogin.cpp | 435 |
1 files changed, 220 insertions, 215 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index 26075a1..f403271 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp | |||
@@ -65,7 +65,7 @@ | |||
65 | #include "llnotify.h" | 65 | #include "llnotify.h" |
66 | #include "llappviewer.h" // for gHideLinks | 66 | #include "llappviewer.h" // for gHideLinks |
67 | #include "llurlsimstring.h" | 67 | #include "llurlsimstring.h" |
68 | #include "llvieweruictrlfactory.h" | 68 | #include "lluictrlfactory.h" |
69 | #include "llhttpclient.h" | 69 | #include "llhttpclient.h" |
70 | #include "llweb.h" | 70 | #include "llweb.h" |
71 | #include "llwebbrowserctrl.h" | 71 | #include "llwebbrowserctrl.h" |
@@ -206,7 +206,7 @@ void LLLoginHandler::parse(const LLSD& queryMap) | |||
206 | 206 | ||
207 | if (LLAppViewer::instance()->getLoginURIs().size() == 0) | 207 | if (LLAppViewer::instance()->getLoginURIs().size() == 0) |
208 | { | 208 | { |
209 | snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); /* Flawfinder: ignore */ | 209 | gGridName = gGridInfo[gGridChoice].mName; /* Flawfinder: ignore */ |
210 | LLAppViewer::instance()->resetURIs(); | 210 | LLAppViewer::instance()->resetURIs(); |
211 | } | 211 | } |
212 | 212 | ||
@@ -349,9 +349,9 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
349 | gViewerWindow->getRootView()->addChildAtEnd(this); | 349 | gViewerWindow->getRootView()->addChildAtEnd(this); |
350 | 350 | ||
351 | // Logo | 351 | // Logo |
352 | mLogoImage = gImageList.getImage("startup_logo.tga", LLUUID::null, MIPMAP_FALSE, TRUE); | 352 | mLogoImage = LLUI::getUIImage("startup_logo.j2c"); |
353 | 353 | ||
354 | gUICtrlFactory->buildPanel(this, "panel_login.xml"); | 354 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); |
355 | 355 | ||
356 | #if USE_VIEWER_AUTH | 356 | #if USE_VIEWER_AUTH |
357 | //leave room for the login menu bar | 357 | //leave room for the login menu bar |
@@ -368,44 +368,43 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
368 | childSetUserData("password_edit", this); | 368 | childSetUserData("password_edit", this); |
369 | 369 | ||
370 | // change z sort of clickable text to be behind buttons | 370 | // change z sort of clickable text to be behind buttons |
371 | sendChildToBack(getChildByName("channel_text")); | 371 | sendChildToBack(getChildView("channel_text")); |
372 | sendChildToBack(getChildByName("version_text")); | 372 | sendChildToBack(getChildView("version_text")); |
373 | sendChildToBack(getChildByName("forgot_password_text")); | 373 | sendChildToBack(getChildView("forgot_password_text")); |
374 | 374 | ||
375 | LLLineEditor* edit = LLUICtrlFactory::getLineEditorByName(this, "password_edit"); | 375 | LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); |
376 | if (edit) edit->setDrawAsterixes(TRUE); | 376 | if (edit) edit->setDrawAsterixes(TRUE); |
377 | 377 | ||
378 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(this, "start_location_combo"); | 378 | LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); |
379 | if (combo) | 379 | combo->setAllowTextEntry(TRUE, 128, FALSE); |
380 | { | ||
381 | combo->setAllowTextEntry(TRUE, 128, FALSE); | ||
382 | 380 | ||
383 | // The XML file loads the combo with the following labels: | 381 | // The XML file loads the combo with the following labels: |
384 | // 0 - "My Home" | 382 | // 0 - "My Home" |
385 | // 1 - "My Last Location" | 383 | // 1 - "My Last Location" |
386 | // 2 - "<Type region name>" | 384 | // 2 - "<Type region name>" |
387 | 385 | ||
388 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); | 386 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); |
389 | LLString sim_string = LLURLSimString::sInstance.mSimString; | 387 | LLString sim_string = LLURLSimString::sInstance.mSimString; |
390 | if (!sim_string.empty()) | 388 | if (!sim_string.empty()) |
391 | { | 389 | { |
392 | // Replace "<Type region name>" with this region name | 390 | // Replace "<Type region name>" with this region name |
393 | combo->remove(2); | 391 | combo->remove(2); |
394 | combo->add( sim_string ); | 392 | combo->add( sim_string ); |
395 | combo->setTextEntry(sim_string); | 393 | combo->setTextEntry(sim_string); |
396 | combo->setCurrentByIndex( 2 ); | 394 | combo->setCurrentByIndex( 2 ); |
397 | } | 395 | } |
398 | else if (login_last) | 396 | else if (login_last) |
399 | { | 397 | { |
400 | combo->setCurrentByIndex( 1 ); | 398 | combo->setCurrentByIndex( 1 ); |
401 | } | ||
402 | else | ||
403 | { | ||
404 | combo->setCurrentByIndex( 0 ); | ||
405 | } | ||
406 | |||
407 | combo->setCommitCallback( &LLPanelGeneral::set_start_location ); | ||
408 | } | 399 | } |
400 | else | ||
401 | { | ||
402 | combo->setCurrentByIndex( 0 ); | ||
403 | } | ||
404 | |||
405 | combo->setCommitCallback( &LLPanelGeneral::set_start_location ); | ||
406 | |||
407 | childSetCommitCallback("server_combo", onSelectServer, this); | ||
409 | 408 | ||
410 | childSetAction("connect_btn", onClickConnect, this); | 409 | childSetAction("connect_btn", onClickConnect, this); |
411 | 410 | ||
@@ -413,71 +412,59 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
413 | 412 | ||
414 | childSetAction("quit_btn", onClickQuit, this); | 413 | childSetAction("quit_btn", onClickQuit, this); |
415 | 414 | ||
416 | LLTextBox* version_text = LLUICtrlFactory::getTextBoxByName(this, "version_text"); | 415 | LLTextBox* version_text = getChild<LLTextBox>("version_text"); |
417 | if (version_text) | 416 | LLString version = llformat("%d.%d.%d (%d)", |
418 | { | 417 | LL_VERSION_MAJOR, |
419 | LLString version = llformat("%d.%d.%d (%d)", | 418 | LL_VERSION_MINOR, |
420 | LL_VERSION_MAJOR, | 419 | LL_VERSION_PATCH, |
421 | LL_VERSION_MINOR, | 420 | LL_VIEWER_BUILD ); |
422 | LL_VERSION_PATCH, | 421 | version_text->setText(version); |
423 | LL_VIEWER_BUILD ); | 422 | version_text->setClickedCallback(onClickVersion); |
424 | version_text->setText(version); | 423 | version_text->setCallbackUserData(this); |
425 | version_text->setClickedCallback(onClickVersion); | 424 | |
426 | version_text->setCallbackUserData(this); | 425 | LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); |
427 | } | 426 | channel_text->setText(gSavedSettings.getString("VersionChannelName")); |
428 | 427 | channel_text->setClickedCallback(onClickVersion); | |
429 | LLTextBox* channel_text = LLUICtrlFactory::getTextBoxByName(this, "channel_text"); | 428 | channel_text->setCallbackUserData(this); |
430 | if (channel_text) | ||
431 | { | ||
432 | channel_text->setText(gChannelName); | ||
433 | channel_text->setClickedCallback(onClickVersion); | ||
434 | channel_text->setCallbackUserData(this); | ||
435 | } | ||
436 | 429 | ||
437 | LLTextBox* forgot_password_text = LLUICtrlFactory::getTextBoxByName(this, "forgot_password_text"); | 430 | LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); |
438 | if (forgot_password_text) | 431 | forgot_password_text->setClickedCallback(onClickForgotPassword); |
439 | { | ||
440 | forgot_password_text->setClickedCallback(onClickForgotPassword); | ||
441 | } | ||
442 | #endif | 432 | #endif |
443 | 433 | ||
444 | // get the web browser control | 434 | // get the web browser control |
445 | LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); | 435 | LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); |
446 | if ( web_browser ) | 436 | // Need to handle login secondlife:///app/ URLs |
447 | { | 437 | web_browser->setOpenAppSLURLs( true ); |
448 | // Need to handle login secondlife:///app/ URLs | ||
449 | web_browser->setOpenAppSLURLs( true ); | ||
450 | 438 | ||
451 | // observe browser events | 439 | // observe browser events |
452 | web_browser->addObserver( this ); | 440 | web_browser->addObserver( this ); |
453 | 441 | ||
454 | // don't make it a tab stop until SL-27594 is fixed | 442 | // don't make it a tab stop until SL-27594 is fixed |
455 | web_browser->setTabStop(FALSE); | 443 | web_browser->setTabStop(FALSE); |
456 | web_browser->navigateToLocalPage( "loading", "loading.html" ); | 444 | web_browser->navigateToLocalPage( "loading", "loading.html" ); |
457 | 445 | ||
458 | // make links open in external browser | 446 | // make links open in external browser |
459 | web_browser->setOpenInExternalBrowser( true ); | 447 | web_browser->setOpenInExternalBrowser( true ); |
460 | 448 | ||
461 | // 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) | 449 | // 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) |
462 | LLRect htmlRect = getRect(); | 450 | LLRect htmlRect = getRect(); |
463 | #if USE_VIEWER_AUTH | 451 | #if USE_VIEWER_AUTH |
464 | htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); | 452 | htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); |
465 | #else | 453 | #else |
466 | htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); | 454 | htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); |
467 | #endif | 455 | #endif |
468 | web_browser->setRect( htmlRect ); | 456 | web_browser->setRect( htmlRect ); |
469 | web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); | 457 | web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); |
470 | reshape( getRect().getWidth(), getRect().getHeight(), 1 ); | 458 | reshape( getRect().getWidth(), getRect().getHeight(), 1 ); |
471 | 459 | ||
472 | // kick off a request to grab the url manually | 460 | // kick off a request to grab the url manually |
473 | gResponsePtr = LLIamHereLogin::build( this ); | 461 | gResponsePtr = LLIamHereLogin::build( this ); |
474 | std::string login_page = LLAppViewer::instance()->getLoginPage(); | 462 | std::string login_page = gSavedSettings.getString("LoginPage"); |
475 | if (login_page.empty()) | 463 | if (login_page.empty()) |
476 | { | 464 | { |
477 | login_page = getString( "real_url" ); | 465 | login_page = getString( "real_url" ); |
478 | } | 466 | } |
479 | LLHTTPClient::head( login_page, gResponsePtr ); | 467 | LLHTTPClient::head( login_page, gResponsePtr ); |
480 | }; | ||
481 | 468 | ||
482 | #if !USE_VIEWER_AUTH | 469 | #if !USE_VIEWER_AUTH |
483 | // Initialize visibility (and don't force visibility - use prefs) | 470 | // Initialize visibility (and don't force visibility - use prefs) |
@@ -549,15 +536,13 @@ LLPanelLogin::~LLPanelLogin() | |||
549 | if ( gResponsePtr ) | 536 | if ( gResponsePtr ) |
550 | gResponsePtr->setParent( 0 ); | 537 | gResponsePtr->setParent( 0 ); |
551 | 538 | ||
552 | // We know we're done with the image, so be rid of it. | 539 | //// We know we're done with the image, so be rid of it. |
553 | gImageList.deleteImage( mLogoImage ); | 540 | //gImageList.deleteImage( mLogoImage ); |
554 | } | 541 | } |
555 | 542 | ||
556 | // virtual | 543 | // virtual |
557 | void LLPanelLogin::draw() | 544 | void LLPanelLogin::draw() |
558 | { | 545 | { |
559 | if (!getVisible()) return; | ||
560 | |||
561 | glPushMatrix(); | 546 | glPushMatrix(); |
562 | { | 547 | { |
563 | F32 image_aspect = 1.333333f; | 548 | F32 image_aspect = 1.333333f; |
@@ -578,14 +563,14 @@ void LLPanelLogin::draw() | |||
578 | // draw a background box in black | 563 | // draw a background box in black |
579 | gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); | 564 | gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) ); |
580 | // draw the bottom part of the background image - just the blue background to the native client UI | 565 | // draw the bottom part of the background image - just the blue background to the native client UI |
581 | gl_draw_scaled_image(0, -264, width + 8, mLogoImage->getHeight(), mLogoImage); | 566 | mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight()); |
582 | #endif | 567 | #endif |
583 | } | 568 | } |
584 | else | 569 | else |
585 | { | 570 | { |
586 | // the HTML login page is not available so default to the original screen | 571 | // the HTML login page is not available so default to the original screen |
587 | S32 offscreen_part = height / 3; | 572 | S32 offscreen_part = height / 3; |
588 | gl_draw_scaled_image(0, -offscreen_part, width, height+offscreen_part, mLogoImage); | 573 | mLogoImage->draw(0, -offscreen_part, width, height+offscreen_part); |
589 | }; | 574 | }; |
590 | } | 575 | } |
591 | glPopMatrix(); | 576 | glPopMatrix(); |
@@ -594,56 +579,50 @@ void LLPanelLogin::draw() | |||
594 | } | 579 | } |
595 | 580 | ||
596 | // virtual | 581 | // virtual |
597 | BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | 582 | BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) |
598 | { | 583 | { |
599 | if (getVisible() && getEnabled()) | 584 | if (( KEY_RETURN == key ) && (MASK_ALT == mask)) |
600 | { | 585 | { |
601 | if (( KEY_RETURN == key ) && (MASK_ALT == mask)) | 586 | gViewerWindow->toggleFullscreen(FALSE); |
602 | { | 587 | return TRUE; |
603 | gViewerWindow->toggleFullscreen(FALSE); | 588 | } |
604 | return TRUE; | ||
605 | } | ||
606 | 589 | ||
607 | if (('P' == key) && (MASK_CONTROL == mask)) | 590 | if (('P' == key) && (MASK_CONTROL == mask)) |
608 | { | 591 | { |
609 | LLFloaterPreference::show(NULL); | 592 | LLFloaterPreference::show(NULL); |
610 | return TRUE; | 593 | return TRUE; |
611 | } | 594 | } |
612 | 595 | ||
613 | if (('T' == key) && (MASK_CONTROL == mask)) | 596 | if (('T' == key) && (MASK_CONTROL == mask)) |
614 | { | 597 | { |
615 | new LLFloaterSimple("floater_test.xml"); | 598 | new LLFloaterSimple("floater_test.xml"); |
616 | return TRUE; | 599 | return TRUE; |
617 | } | 600 | } |
618 | 601 | ||
619 | if ( KEY_F1 == key ) | 602 | if ( KEY_F1 == key ) |
620 | { | 603 | { |
621 | llinfos << "Spawning HTML help window" << llendl; | 604 | llinfos << "Spawning HTML help window" << llendl; |
622 | gViewerHtmlHelp.show(); | 605 | gViewerHtmlHelp.show(); |
623 | return TRUE; | 606 | return TRUE; |
624 | } | 607 | } |
625 | 608 | ||
626 | # if !LL_RELEASE_FOR_DOWNLOAD | 609 | # if !LL_RELEASE_FOR_DOWNLOAD |
627 | if ( KEY_F2 == key ) | 610 | if ( KEY_F2 == key ) |
628 | { | 611 | { |
629 | llinfos << "Spawning floater TOS window" << llendl; | 612 | llinfos << "Spawning floater TOS window" << llendl; |
630 | LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,""); | 613 | LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,""); |
631 | tos_dialog->startModal(); | 614 | tos_dialog->startModal(); |
632 | return TRUE; | 615 | return TRUE; |
633 | } | 616 | } |
634 | #endif | 617 | #endif |
635 | 618 | ||
636 | if (!called_from_parent) | 619 | if (KEY_RETURN == key && MASK_NONE == mask) |
637 | { | 620 | { |
638 | if (KEY_RETURN == key && MASK_NONE == mask) | 621 | // let the panel handle UICtrl processing: calls onClickConnect() |
639 | { | 622 | return LLPanel::handleKeyHere(key, mask); |
640 | // let the panel handle UICtrl processing: calls onClickConnect() | ||
641 | return LLPanel::handleKeyHere(key, mask, called_from_parent); | ||
642 | } | ||
643 | } | ||
644 | } | 623 | } |
645 | 624 | ||
646 | return LLPanel::handleKeyHere(key, mask, called_from_parent); | 625 | return LLPanel::handleKeyHere(key, mask); |
647 | } | 626 | } |
648 | 627 | ||
649 | // virtual | 628 | // virtual |
@@ -685,12 +664,12 @@ void LLPanelLogin::giveFocus() | |||
685 | { | 664 | { |
686 | // User saved his name but not his password. Move | 665 | // User saved his name but not his password. Move |
687 | // focus to password field. | 666 | // focus to password field. |
688 | edit = LLUICtrlFactory::getLineEditorByName(sInstance, "password_edit"); | 667 | edit = sInstance->getChild<LLLineEditor>("password_edit"); |
689 | } | 668 | } |
690 | else | 669 | else |
691 | { | 670 | { |
692 | // User doesn't have a name, so start there. | 671 | // User doesn't have a name, so start there. |
693 | edit = LLUICtrlFactory::getLineEditorByName(sInstance, "first_name_edit"); | 672 | edit = sInstance->getChild<LLLineEditor>("first_name_edit"); |
694 | } | 673 | } |
695 | 674 | ||
696 | if (edit) | 675 | if (edit) |
@@ -771,12 +750,9 @@ void LLPanelLogin::addServer(const char *server, S32 domain_name) | |||
771 | return; | 750 | return; |
772 | } | 751 | } |
773 | 752 | ||
774 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); | 753 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |
775 | if (combo) | 754 | combo->add(server, LLSD(domain_name) ); |
776 | { | 755 | combo->setCurrentByIndex(0); |
777 | combo->add(server, LLSD(domain_name) ); | ||
778 | combo->setCurrentByIndex(0); | ||
779 | } | ||
780 | } | 756 | } |
781 | 757 | ||
782 | // static | 758 | // static |
@@ -810,27 +786,24 @@ BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name) | |||
810 | } | 786 | } |
811 | else | 787 | else |
812 | { | 788 | { |
813 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); | 789 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |
814 | if (combo) | 790 | LLSD combo_val = combo->getValue(); |
791 | if (LLSD::TypeInteger == combo_val.type()) | ||
815 | { | 792 | { |
816 | LLSD combo_val = combo->getValue(); | 793 | domain_name = combo->getValue().asInteger(); |
817 | if (LLSD::TypeInteger == combo_val.type()) | ||
818 | { | ||
819 | domain_name = combo->getValue().asInteger(); | ||
820 | 794 | ||
821 | if ((S32)GRID_INFO_OTHER == domain_name) | 795 | if ((S32)GRID_INFO_OTHER == domain_name) |
822 | { | ||
823 | server = gGridName; | ||
824 | } | ||
825 | } | ||
826 | else | ||
827 | { | 796 | { |
828 | // no valid selection, return other | 797 | server = gGridName; |
829 | domain_name = (S32)GRID_INFO_OTHER; | ||
830 | server = combo_val.asString(); | ||
831 | } | 798 | } |
832 | user_picked = combo->isDirty(); | ||
833 | } | 799 | } |
800 | else | ||
801 | { | ||
802 | // no valid selection, return other | ||
803 | domain_name = (S32)GRID_INFO_OTHER; | ||
804 | server = combo_val.asString(); | ||
805 | } | ||
806 | user_picked = combo->isDirty(); | ||
834 | } | 807 | } |
835 | 808 | ||
836 | return user_picked; | 809 | return user_picked; |
@@ -845,11 +818,8 @@ void LLPanelLogin::getLocation(LLString &location) | |||
845 | return; | 818 | return; |
846 | } | 819 | } |
847 | 820 | ||
848 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo"); | 821 | LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo"); |
849 | if (combo) | 822 | location = combo->getValue().asString(); |
850 | { | ||
851 | location = combo->getValue().asString(); | ||
852 | } | ||
853 | } | 823 | } |
854 | 824 | ||
855 | // static | 825 | // static |
@@ -860,8 +830,7 @@ void LLPanelLogin::refreshLocation( bool force_visible ) | |||
860 | #if USE_VIEWER_AUTH | 830 | #if USE_VIEWER_AUTH |
861 | loadLoginPage(); | 831 | loadLoginPage(); |
862 | #else | 832 | #else |
863 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo"); | 833 | LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo"); |
864 | if (!combo) return; | ||
865 | 834 | ||
866 | if (LLURLSimString::parse()) | 835 | if (LLURLSimString::parse()) |
867 | { | 836 | { |
@@ -927,13 +896,70 @@ void LLPanelLogin::loadLoginPage() | |||
927 | 896 | ||
928 | std::ostringstream oStr; | 897 | std::ostringstream oStr; |
929 | 898 | ||
930 | std::string login_page = LLAppViewer::instance()->getLoginPage(); | 899 | std::string login_page = gSavedSettings.getString("LoginPage"); |
931 | if (login_page.empty()) | 900 | if (login_page.empty()) |
932 | { | 901 | { |
933 | login_page = sInstance->getString( "real_url" ); | 902 | login_page = sInstance->getString( "real_url" ); |
934 | } | 903 | } |
935 | oStr << login_page; | 904 | oStr << login_page; |
936 | 905 | ||
906 | // Use the right delimeter depending on how LLURI parses the URL | ||
907 | LLURI login_page_uri = LLURI(login_page); | ||
908 | std::string first_query_delimiter = "&"; | ||
909 | if (login_page_uri.queryMap().size() == 0) | ||
910 | { | ||
911 | first_query_delimiter = "?"; | ||
912 | } | ||
913 | |||
914 | // Language | ||
915 | LLString language(gSavedSettings.getString("Language")); | ||
916 | if(language == "default") | ||
917 | { | ||
918 | language = gSavedSettings.getString("SystemLanguage"); | ||
919 | } | ||
920 | oStr << first_query_delimiter<<"lang=" << language; | ||
921 | |||
922 | // First Login? | ||
923 | if (gSavedSettings.getBOOL("FirstLoginThisInstall")) | ||
924 | { | ||
925 | oStr << "&firstlogin=TRUE"; | ||
926 | } | ||
927 | |||
928 | // Channel and Version | ||
929 | LLString version = llformat("%d.%d.%d (%d)", | ||
930 | LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); | ||
931 | |||
932 | char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0); | ||
933 | char* curl_version = curl_escape(version.c_str(), 0); | ||
934 | |||
935 | oStr << "&channel=" << curl_channel; | ||
936 | oStr << "&version=" << curl_version; | ||
937 | |||
938 | curl_free(curl_channel); | ||
939 | curl_free(curl_version); | ||
940 | |||
941 | // Grid | ||
942 | LLString grid; | ||
943 | S32 grid_index; | ||
944 | getServer( grid, grid_index ); | ||
945 | if( grid_index != (S32)GRID_INFO_OTHER ) | ||
946 | { | ||
947 | grid = gGridInfo[grid_index].mLabel; | ||
948 | } | ||
949 | |||
950 | if(gGridChoice != (EGridInfo)grid_index) | ||
951 | { | ||
952 | LLAppViewer::instance()->resetURIs(); | ||
953 | gGridChoice = (EGridInfo)grid_index; | ||
954 | gViewerWindow->setMenuBackgroundColor(false, | ||
955 | !LLAppViewer::instance()->isInProductionGrid()); | ||
956 | gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); | ||
957 | } | ||
958 | |||
959 | char* curl_grid = curl_escape(grid.c_str(), 0); | ||
960 | oStr << "&grid=" << curl_grid; | ||
961 | curl_free(curl_grid); | ||
962 | |||
937 | #if USE_VIEWER_AUTH | 963 | #if USE_VIEWER_AUTH |
938 | LLURLSimString::sInstance.parse(); | 964 | LLURLSimString::sInstance.parse(); |
939 | 965 | ||
@@ -963,60 +989,35 @@ void LLPanelLogin::loadLoginPage() | |||
963 | } | 989 | } |
964 | 990 | ||
965 | LLString firstname, lastname; | 991 | LLString firstname, lastname; |
966 | 992 | ||
967 | if (gCmdLineFirstName.empty()) | 993 | if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) |
994 | { | ||
995 | LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); | ||
996 | firstname = cmd_line_login[0].asString(); | ||
997 | lastname = cmd_line_login[1].asString(); | ||
998 | password = cmd_line_login[2].asString(); | ||
999 | } | ||
1000 | |||
1001 | if (firstname.empty()) | ||
968 | { | 1002 | { |
969 | firstname = gSavedSettings.getString("FirstName"); | 1003 | firstname = gSavedSettings.getString("FirstName"); |
970 | } | 1004 | } |
971 | else | ||
972 | { | ||
973 | firstname = gCmdLineFirstName; | ||
974 | } | ||
975 | 1005 | ||
976 | if (gCmdLineLastName.empty()) | 1006 | if (lastname.empty()) |
977 | { | 1007 | { |
978 | lastname = gSavedSettings.getString("LastName"); | 1008 | lastname = gSavedSettings.getString("LastName"); |
979 | } | 1009 | } |
980 | else | ||
981 | { | ||
982 | lastname = gCmdLineLastName; | ||
983 | } | ||
984 | 1010 | ||
985 | LLString version = llformat("%d.%d.%d (%d)", | ||
986 | LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); | ||
987 | |||
988 | char* curl_region = curl_escape(region.c_str(), 0); | 1011 | char* curl_region = curl_escape(region.c_str(), 0); |
989 | char* curl_channel = curl_escape(gChannelName.c_str(), 0); | ||
990 | char* curl_version = curl_escape(version.c_str(), 0); | ||
991 | 1012 | ||
992 | 1013 | oStr <<"firstname=" << firstname << | |
993 | // Use the right delimeter depending on how LLURI parses the URL | 1014 | "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region; |
994 | LLURI login_page_uri = LLURI(login_page); | ||
995 | std::string first_query_delimiter = "&"; | ||
996 | if (login_page_uri.queryMap().size() == 0) | ||
997 | { | ||
998 | first_query_delimiter = "?"; | ||
999 | } | ||
1000 | oStr << first_query_delimiter << "firstname=" << firstname << | ||
1001 | "&lastname=" << lastname << "&location=" << location << "®ion=" << curl_region << | ||
1002 | "&grid=" << gGridInfo[gGridChoice].mLabel << "&channel=" << curl_channel << | ||
1003 | "&version=" << curl_version; | ||
1004 | 1015 | ||
1005 | curl_free(curl_region); | 1016 | curl_free(curl_region); |
1006 | curl_free(curl_channel); | ||
1007 | curl_free(curl_version); | ||
1008 | |||
1009 | LLString language(gSavedSettings.getString("Language")); | ||
1010 | if(language == "default") | ||
1011 | { | ||
1012 | language = gSavedSettings.getString("SystemLanguage"); | ||
1013 | } | ||
1014 | |||
1015 | oStr << "&lang=" << language; | ||
1016 | 1017 | ||
1017 | if (!gCmdLinePassword.empty()) | 1018 | if (!password.empty()) |
1018 | { | 1019 | { |
1019 | oStr << "&password=" << gCmdLinePassword; | 1020 | oStr << "&password=" << password; |
1020 | } | 1021 | } |
1021 | else if (!(password = load_password_from_disk()).empty()) | 1022 | else if (!(password = load_password_from_disk()).empty()) |
1022 | { | 1023 | { |
@@ -1087,15 +1088,12 @@ void LLPanelLogin::onClickConnect(void *) | |||
1087 | // has both first and last name typed | 1088 | // has both first and last name typed |
1088 | 1089 | ||
1089 | // store off custom server entry, if currently selected | 1090 | // store off custom server entry, if currently selected |
1090 | LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo"); | 1091 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |
1091 | if (combo) | 1092 | S32 selected_server = combo->getValue(); |
1093 | if (selected_server == GRID_INFO_NONE) | ||
1092 | { | 1094 | { |
1093 | S32 selected_server = combo->getValue(); | 1095 | LLString custom_server = combo->getValue().asString(); |
1094 | if (selected_server == GRID_INFO_NONE) | 1096 | gSavedSettings.setString("CustomServer", custom_server); |
1095 | { | ||
1096 | LLString custom_server = combo->getValue().asString(); | ||
1097 | gSavedSettings.setString("CustomServer", custom_server); | ||
1098 | } | ||
1099 | } | 1097 | } |
1100 | sInstance->mCallback(0, sInstance->mCallbackData); | 1098 | sInstance->mCallback(0, sInstance->mCallbackData); |
1101 | } | 1099 | } |
@@ -1177,3 +1175,10 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) | |||
1177 | sCapslockDidNotification = TRUE; | 1175 | sCapslockDidNotification = TRUE; |
1178 | } | 1176 | } |
1179 | } | 1177 | } |
1178 | |||
1179 | // static | ||
1180 | void LLPanelLogin::onSelectServer(LLUICtrl*, void*) | ||
1181 | { | ||
1182 | // grid changed so show new splash screen (possibly) | ||
1183 | loadLoginPage(); | ||
1184 | } | ||