From e630e98253ab226a9af00da75ba8d91c82326aac Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 10 Aug 2011 14:15:15 -0700 Subject: EXP-1028 FIX Move mode switching to logged in UI added mode switching button to status bars for advanced and basic mode, changed login combo box to use menu instead --- indra/llui/llmenubutton.cpp | 11 +++- indra/llui/llmenubutton.h | 21 +++++-- indra/newview/llpanellogin.cpp | 30 --------- indra/newview/llpanellogin.h | 2 - indra/newview/llstartup.cpp | 21 +++---- indra/newview/llviewermenu.cpp | 73 +++++++++++++++++++--- indra/newview/skins/default/xui/en/panel_login.xml | 33 +++------- .../skins/default/xui/en/panel_status_bar.xml | 13 +++- indra/newview/skins/minimal/xui/en/main_view.xml | 4 +- indra/newview/skins/minimal/xui/en/panel_login.xml | 37 +++-------- .../skins/minimal/xui/en/panel_navigation_bar.xml | 2 +- .../skins/minimal/xui/en/panel_status_bar.xml | 15 ++++- 12 files changed, 140 insertions(+), 122 deletions(-) (limited to 'indra') diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index eed0085273..50d59f79f4 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -35,9 +35,16 @@ static LLDefaultChildRegistry::Register r("menu_button"); +void LLMenuButton::MenuPositions::declareValues() +{ + declare("topleft", MP_TOP_LEFT); + declare("topright", MP_TOP_RIGHT); + declare("bottomleft", MP_BOTTOM_LEFT); +} LLMenuButton::Params::Params() -: menu_filename("menu_filename") +: menu_filename("menu_filename"), + position("position", MP_BOTTOM_LEFT) { } @@ -45,7 +52,7 @@ LLMenuButton::Params::Params() LLMenuButton::LLMenuButton(const LLMenuButton::Params& p) : LLButton(p), mIsMenuShown(false), - mMenuPosition(MP_BOTTOM_LEFT) + mMenuPosition(p.position) { std::string menu_filename = p.menu_filename; diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 7b657595da..e2396e7fb2 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -35,21 +35,30 @@ class LLMenuButton : public LLButton { public: + typedef enum e_menu_position + { + MP_TOP_LEFT, + MP_TOP_RIGHT, + MP_BOTTOM_LEFT + } EMenuPosition; + + struct MenuPositions + : public LLInitParam::TypeValuesHelper + { + static void declareValues(); + }; + struct Params : public LLInitParam::Block { // filename for it's toggleable menu Optional menu_filename; + Optional position; Params(); }; - typedef enum e_menu_position - { - MP_TOP_LEFT, - MP_TOP_RIGHT, - MP_BOTTOM_LEFT - } EMenuPosition; + boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 27f341b4f6..bef809f3a7 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -154,10 +154,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } updateLocationCombo(false); - LLUICtrl& mode_combo = getChildRef("mode_combo"); - mode_combo.setValue(gSavedSettings.getString("SessionSettingsFile")); - mode_combo.setCommitCallback(boost::bind(&LLPanelLogin::onModeChange, this, getChild("mode_combo")->getValue(), _2)); - LLComboBox* server_choice_combo = sInstance->getChild("server_combo"); server_choice_combo->setCommitCallback(onSelectServer, NULL); server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1)); @@ -1025,32 +1021,6 @@ void LLPanelLogin::updateLoginPanelLinks() sInstance->getChildView("forgot_password_text")->setVisible( system_grid); } -void LLPanelLogin::onModeChange(const LLSD& original_value, const LLSD& new_value) -{ - if (original_value.asString() != new_value.asString()) - { - LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(&LLPanelLogin::onModeChangeConfirm, this, original_value, new_value, _1, _2)); - } -} - -void LLPanelLogin::onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - switch (option) - { - case 0: - gSavedSettings.getControl("SessionSettingsFile")->set(new_value); - LLAppViewer::instance()->forceQuit(); - break; - case 1: - // revert to original value - getChild("mode_combo")->setValue(original_value); - break; - default: - break; - } -} - std::string canonicalize_username(const std::string& name) { std::string cname = name; diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 11273453ba..b29b3af7ca 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -97,8 +97,6 @@ private: static void onServerComboLostFocus(LLFocusableElement*); static void updateServerCombo(); static void updateStartSLURL(); - void onModeChange(const LLSD& original_value, const LLSD& new_value); - void onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response); static void updateLoginPanelLinks(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b390c933f7..aa908d8cfd 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -720,7 +720,13 @@ bool idle_startup() timeout_count = 0; - initialize_edit_menu(); + // Login screen needs menus for preferences, but we can enter + // this startup phase more than once. + if (gLoginMenuBarView == NULL) + { + initialize_edit_menu(); + init_menus(); + } if (show_connect_box) { @@ -755,19 +761,6 @@ bool idle_startup() LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } - // *NOTE: This is where LLViewerParcelMgr::getInstance() used to get allocated before becoming LLViewerParcelMgr::getInstance(). - - // *NOTE: This is where gHUDManager used to bet allocated before becoming LLHUDManager::getInstance(). - - // *NOTE: This is where gMuteList used to get allocated before becoming LLMuteList::getInstance(). - - // Login screen needs menus for preferences, but we can enter - // this startup phase more than once. - if (gLoginMenuBarView == NULL) - { - init_menus(); - } - gViewerWindow->setNormalControlsVisible( FALSE ); gLoginMenuBarView->setVisible( TRUE ); gLoginMenuBarView->setEnabled( TRUE ); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f74bcafc5c..e5dfa51e7f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -831,7 +831,8 @@ U32 feature_from_string(std::string feature) }; -class LLAdvancedToggleFeature : public view_listener_t{ +class LLAdvancedToggleFeature : public view_listener_t +{ bool handleEvent(const LLSD& userdata) { U32 feature = feature_from_string( userdata.asString() ); @@ -844,18 +845,19 @@ class LLAdvancedToggleFeature : public view_listener_t{ }; class LLAdvancedCheckFeature : public view_listener_t -{bool handleEvent(const LLSD& userdata) { - U32 feature = feature_from_string( userdata.asString() ); - bool new_value = false; - - if ( feature != 0 ) + bool handleEvent(const LLSD& userdata) { - new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature ); - } + U32 feature = feature_from_string( userdata.asString() ); + bool new_value = false; - return new_value; -} + if ( feature != 0 ) + { + new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature ); + } + + return new_value; + } }; void toggle_destination_and_avatar_picker(const LLSD& show) @@ -7774,6 +7776,55 @@ class LLToggleUIHints : public view_listener_t } }; +class LLCheckSessionsSettings : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string expected = userdata.asString(); + return gSavedSettings.getString("SessionSettingsFile") == expected; + } +}; + +class LLChangeMode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string mode = userdata.asString(); + if (mode == "basic") + { + if (gSavedSettings.getString("SessionSettingsFile") != "settings_minimal.xml") + { + LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(onModeChangeConfirm, "settings_minimal.xml", _1, _2)); + } + return true; + } + else if (mode == "advanced") + { + if (gSavedSettings.getString("SessionSettingsFile") != "") + { + LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(onModeChangeConfirm, "", _1, _2)); + } + return true; + } + return false; + } + + static void onModeChangeConfirm(const std::string& new_session_settings_file, const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 0: + gSavedSettings.getControl("SessionSettingsFile")->set(new_session_settings_file); + LLAppViewer::instance()->forceQuit(); + break; + case 1: + default: + break; + } + } +}; + void LLUploadCostCalculator::calculateCost() { S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); @@ -8263,6 +8314,8 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); + view_listener_t::addMenu(new LLCheckSessionsSettings(), "CheckSessionSettings"); + view_listener_t::addMenu(new LLChangeMode(), "ChangeMode"); commit.add("Destination.show", boost::bind(&toggle_destination_and_avatar_picker, 0)); commit.add("Avatar.show", boost::bind(&toggle_destination_and_avatar_picker, 1)); diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 8d0f1437e6..079fb958ec 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -117,33 +117,16 @@ label="Remember password" name="connect_btn" top="35" width="90" /> - - Mode: - - - - - + menu_filename="menu_mode_change.xml" + /> + + width="70"> 24:00 AM PST