diff options
author | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2015-01-14 15:44:14 +0200 |
---|---|---|
committer | Mnikolenko ProductEngine <mnikolenko@productengine.com> | 2015-01-14 15:44:14 +0200 |
commit | 7ce290f170157cd7f0d4807e5734ddacc91b7eec (patch) | |
tree | 7de8ad71bbc50b609cc003738edd5d5c720fa85e /indra/newview | |
parent | ef31cdef028c77201e502ccc9d30259c76cc4aaf (diff) |
MAINT-4790 WIP code clean-up
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llpanellogin.cpp | 99 | ||||
-rwxr-xr-x | indra/newview/llpanellogin.h | 7 |
2 files changed, 7 insertions, 99 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index bbc3b85bf0..fee240daa9 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -175,7 +175,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mUsernameLength(0), mPasswordLength(0), mLocationLength(0), - mFavoriteSelected(false), mShowFavorites(false) { setBackgroundVisible(FALSE); @@ -196,7 +195,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } else { - buildFromFile( "panel_login.xml"); + buildFromFile( "panel_login.xml"); } reshape(rect.getWidth(), rect.getHeight()); @@ -204,7 +203,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLLineEditor* password_edit(getChild<LLLineEditor>("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::onClickConnectLast, this)); + password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("forgot_password_text")); @@ -212,14 +211,9 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLComboBox* favorites_combo = getChild<LLComboBox>("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences favorites_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); - favorites_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectFavorite, this)); LLComboBox* server_choice_combo = getChild<LLComboBox>("server_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectServer, this)); - - LLLineEditor* location_edit = sInstance->getChild<LLLineEditor>("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(); @@ -267,9 +261,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } - childSetAction("connect_btn", onClickConnectLast, this); - childSetAction("connect_favorite_btn", onClickConnectFavorite, this); - childSetAction("connect_location_btn", onClickConnectLocation, this); + childSetAction("connect_btn", onClickConnect, this); LLButton* def_btn = getChild<LLButton>("connect_btn"); setDefaultBtn(def_btn); @@ -329,7 +321,7 @@ void LLPanelLogin::addFavoritesToStartLocation() LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); if (!combo) return; int num_items = combo->getItemCount(); - for (int i = num_items - 1; i > 0; i--) + for (int i = num_items - 1; i > 1; i--) { combo->remove(i); } @@ -862,33 +854,6 @@ 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<LLUICtrl>("location_edit")->getValue().asString(); - LLStartUp::setStartSLURL(location); - - void* unused_parameter = 0; - LLPanelLogin::sInstance->onClickConnect(unused_parameter); -} - -// static void LLPanelLogin::onClickConnect(void *) { if (sInstance && sInstance->mCallback) @@ -1036,60 +1001,9 @@ void LLPanelLogin::updateServer() void LLPanelLogin::updateLoginButtons() { - LLButton* last_login_btn = getChild<LLButton>("connect_btn"); - LLButton* loc_btn = getChild<LLButton>("connect_location_btn"); - LLButton* fav_btn = getChild<LLButton>("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<LLComboBox>("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; + LLButton* login_btn = getChild<LLButton>("connect_btn"); - updateLoginButtons(); + login_btn->setEnabled(mUsernameLength != 0 && mPasswordLength != 0); } void LLPanelLogin::onSelectServer() @@ -1134,7 +1048,6 @@ 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; diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index aa63ffabfc..869f2f8d39 100755 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -90,14 +90,9 @@ private: friend class LLPanelLoginListener; void addFavoritesToStartLocation(); void addUsersWithFavoritesToUsername(); - void onLocationEditChanged(LLUICtrl* ctrl); - void onSelectFavorite(); void onSelectServer(); void onLocationSLURL(); - static void onClickConnectLast(void*); - static void onClickConnectFavorite(void*); - static void onClickConnectLocation(void*); static void onClickConnect(void*); static void onClickNewAccount(void*); static void onClickVersion(void*); @@ -120,7 +115,7 @@ private: static LLPanelLogin* sInstance; static BOOL sCapslockDidNotification; bool mFirstLoginThisInstall; - bool mFavoriteSelected; + unsigned int mUsernameLength; unsigned int mPasswordLength; unsigned int mLocationLength; |