diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/llui/llcombobox.cpp | 5 | ||||
-rwxr-xr-x | indra/llui/llcombobox.h | 6 | ||||
-rwxr-xr-x | indra/llui/lllineeditor.cpp | 4 | ||||
-rwxr-xr-x | indra/llui/lllineeditor.h | 3 | ||||
-rwxr-xr-x | indra/newview/llpanellogin.cpp | 110 | ||||
-rwxr-xr-x | indra/newview/llpanellogin.h | 7 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/panel_login.xml | 141 |
7 files changed, 83 insertions, 193 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 56be52f69a..b32aea5ffa 100755 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -788,6 +788,11 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) // since the dropdown button eats the key if (key == KEY_RETURN) { + if (mask == MASK_NONE) + { + mOnReturnSignal(this, getValue()); + } + // don't show list and don't eat key input when committing // free-form text entry with RETURN since user already knows // what they are trying to select diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 67393504e7..c9b1212b70 100755 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -199,6 +199,11 @@ public: void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; } void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; } + /** + * Connects callback to signal called when Return key is pressed. + */ + boost::signals2::connection setReturnCallback( const commit_signal_t::slot_type& cb ) { return mOnReturnSignal.connect(cb); } + void setButtonVisible(BOOL visible); void onButtonMouseDown(); @@ -231,6 +236,7 @@ private: commit_callback_t mTextChangedCallback; commit_callback_t mSelectionCallback; boost::signals2::connection mTopLostSignalConnection; + commit_signal_t mOnReturnSignal; S32 mLastSelectedIndex; }; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index ae94a021d1..a08cf91a69 100755 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -88,6 +88,7 @@ LLLineEditor::Params::Params() background_image("background_image"), background_image_disabled("background_image_disabled"), background_image_focused("background_image_focused"), + bg_image_always_focused("bg_image_always_focused", false), select_on_focus("select_on_focus", false), revert_on_esc("revert_on_esc", true), spellcheck("spellcheck", false), @@ -147,6 +148,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mBgImage( p.background_image ), mBgImageDisabled( p.background_image_disabled ), mBgImageFocused( p.background_image_focused ), + mShowImageFocused( p.bg_image_always_focused ), mHaveHistory(FALSE), mReplaceNewlinesWithSpaces( TRUE ), mLabel(p.label), @@ -1675,7 +1677,7 @@ void LLLineEditor::drawBackground() { image = mBgImageDisabled; } - else if ( has_focus ) + else if ( has_focus || mShowImageFocused) { image = mBgImageFocused; } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 40f931ecc1..c6d472f59b 100755 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -90,6 +90,7 @@ public: spellcheck, commit_on_focus_lost, ignore_tab, + bg_image_always_focused, is_password; // colors @@ -375,6 +376,8 @@ protected: BOOL mReadOnly; + BOOL mShowImageFocused; + LLWString mPreeditWString; LLWString mPreeditOverwrittenWString; std::vector<S32> mPreeditPositions; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index dd61929f35..1495d720c7 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -172,7 +172,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mUsernameLength(0), mPasswordLength(0), mLocationLength(0), - mFavoriteSelected(false), mShowFavorites(false) { setBackgroundVisible(FALSE); @@ -193,7 +192,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } else { - buildFromFile( "panel_login.xml"); + buildFromFile( "panel_login.xml"); } reshape(rect.getWidth(), rect.getHeight()); @@ -201,22 +200,18 @@ 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")); LLComboBox* favorites_combo = getChild<LLComboBox>("start_location_combo"); updateLocationSelectorsVisibility(); // separate so that it can be called from preferences + favorites_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); 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(); @@ -264,9 +259,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); @@ -326,7 +319,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); } @@ -374,6 +367,10 @@ void LLPanelLogin::addFavoritesToStartLocation() { mShowFavorites = true; combo->add(label, value); + if ( LLStartUp::getStartSLURL().getSLURLString() == value) + { + combo->selectByValue(value); + } } } break; @@ -688,7 +685,6 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) LL_DEBUGS("AppInit")<<new_start_slurl.asString()<<LL_ENDL; LLComboBox* location_combo = sInstance->getChild<LLComboBox>("start_location_combo"); - LLLineEditor* location_edit = sInstance->getChild<LLLineEditor>("location_edit"); /* * Determine whether or not the new_start_slurl modifies the grid. * @@ -720,7 +716,10 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) } if ( new_start_slurl.getLocationString().length() ) { - location_edit->setValue(new_start_slurl.getLocationString()); + if (location_combo->getCurrentIndex() == -1) + { + location_combo->setLabel(new_start_slurl.getLocationString()); + } sInstance->mLocationLength = new_start_slurl.getLocationString().length(); sInstance->updateLoginButtons(); } @@ -859,33 +858,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) @@ -1033,60 +1005,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"); + LLButton* login_btn = getChild<LLButton>("connect_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; - - updateLoginButtons(); + login_btn->setEnabled(mUsernameLength != 0 && mPasswordLength != 0); } void LLPanelLogin::onSelectServer() @@ -1131,7 +1052,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; diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index a258a874b0..183ae2e824 100755 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -19,7 +19,7 @@ left="0" name="ui_stack" orientation="horizontal" - top="0" + top="10" width="1024"> <layout_panel height="172" @@ -30,7 +30,7 @@ auto_resize="false" follows="left|right|top" name="ui_container" - width="960" + width="1000" left="0" top="0" height="172"> @@ -56,7 +56,8 @@ name="username_combo" width="232"> <combo_box.combo_editor - text_pad_left="8" /> + text_pad_left="8" + bg_image_always_focused="true"/> <combo_box.combo_button visible="false" /> <combo_box.drop_down_button @@ -65,79 +66,42 @@ <line_editor follows="left|top" height="32" - left_pad="0" + left_pad="-11" max_length_bytes="16" text_pad_left="8" name="password_edit" label="Password" + bg_image_always_focused="true" font="SansSerifLarge" is_password="true" select_on_focus="true" commit_on_focus_lost="false" bottom_delta="0" - width="200" /> - <check_box - control_name="RememberPassword" - follows="left|top" - font="SansSerifMedium" - left_pad="20" - bottom_delta="-14" - height="24" - label="Remember me" - check_button.bottom="3" - name="remember_check" - width="145" /> - <text - follows="left|top" - font="SansSerifMedium" - text_color="EmphasisColor" - height="16" - name="forgot_password_text" - left_delta="0" - bottom_delta="16" - width="200"> - Forgotten password - </text> - <button - follows="left|top" - image_unselected="PushButton_Login" - image_pressed="PushButton_Login_Pressed" - image_hover="PushButton_Login_Over" - label="Log In" - label_color="White" - font="SansSerifMedium" - name="connect_btn" - enabled="true" - left="0" - width="80" - height="26" - bottom_delta="44" /> - <text - follows="left|top" - font="SansSerifLarge" - height="24" - name="At_My_Last_Location_Label" - left_pad="8" - bottom_delta="1" - width="120"> - at last location - </text> + width="165" /> <combo_box - control_name="NextLoginLocation" + allow_text_entry="true" + control_name="NextLoginLocation" follows="left|top" label="My favorite places" - height="26" + height="32" max_chars="128" - combo_editor.font="SansSerifMedium" - left_pad="20" + combo_editor.font="SansSerifLarge" + left_pad="15" bottom_delta="0" name="start_location_combo" width="175" combo_button.scale_image="true"> + <combo_box.combo_editor + bg_image_always_focused="true" + text_pad_left="8"/> + <combo_box.item + label="My last location" + name="MyLastLocation" + value="last" /> <combo_box.item label="My home" name="MyHome" - value="home" /> + value="home" /> </combo_box> <button follows="left|top" @@ -147,53 +111,48 @@ label="Log In" label_color="White" font="SansSerifMedium" - name="connect_favorite_btn" - left_pad="8" - width="80" - enabled="false" - height="26" - bottom_delta="0" /> - <line_editor + name="connect_btn" + enabled="true" + width="120" + height="32" + left_pad="15" + bottom_delta="0" /> + <check_box + control_name="RememberPassword" follows="left|top" - width="170" - height="26" - left_pad="40" - text_pad_left="8" - name="location_edit" - label="Type a location" font="SansSerifMedium" - select_on_focus="true" - commit_on_focus_lost="false" - bottom_delta="0" /> - <button + left="185" + bottom_delta="21" + height="24" + label="Remember me" + check_button.bottom="3" + name="remember_check" + width="145" /> + <text follows="left|top" - image_unselected="PushButton_Login" - image_pressed="PushButton_Login_Pressed" - image_hover="PushButton_Login_Over" - label="Log In" - enabled="false" - label_color="White" font="SansSerifMedium" - name="connect_location_btn" - left_pad="8" - width="80" - height="26" - bottom_delta="0" /> + text_color="EmphasisColor" + height="16" + name="forgot_password_text" + left="408" + bottom_delta="0" + width="200"> + Forgotten password + </text> <combo_box allow_text_entry="false" font="SansSerifTiny" follows="left|top" height="26" + left="588" + bottom_delta="10" max_chars="128" - label="Select grid" - left_pad="40" - bottom_delta="0" + label="Select grid" layout="topleft" - top_pad="2" name="server_combo" - width="128" /> - </layout_panel> - <layout_panel + width="149" /> + </layout_panel> + <layout_panel height="172" auto_resize="true" name="ui_elastic_pad_right" |