diff options
| author | Richard Nelson <richard@lindenlab.com> | 2011-08-10 14:15:15 -0700 | 
|---|---|---|
| committer | Richard Nelson <richard@lindenlab.com> | 2011-08-10 14:15:15 -0700 | 
| commit | e630e98253ab226a9af00da75ba8d91c82326aac (patch) | |
| tree | a18f1119b2962b9986c359f2cec4e005a9d1dd4b | |
| parent | e1532afb1267b2012a6fbb9b72b09ab80a85f763 (diff) | |
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
| -rw-r--r-- | indra/llui/llmenubutton.cpp | 11 | ||||
| -rw-r--r-- | indra/llui/llmenubutton.h | 21 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.h | 2 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 21 | ||||
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 73 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_login.xml | 33 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_status_bar.xml | 13 | ||||
| -rw-r--r-- | indra/newview/skins/minimal/xui/en/main_view.xml | 4 | ||||
| -rw-r--r-- | indra/newview/skins/minimal/xui/en/panel_login.xml | 37 | ||||
| -rw-r--r-- | indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml | 2 | ||||
| -rw-r--r-- | indra/newview/skins/minimal/xui/en/panel_status_bar.xml | 15 | 
12 files changed, 140 insertions, 122 deletions
| 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<LLMenuButton> 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<EMenuPosition, MenuPositions> +	{ +		static void declareValues(); +	}; +  	struct Params   	:	public LLInitParam::Block<Params, LLButton::Params>  	{  		// filename for it's toggleable menu  		Optional<std::string>	menu_filename; +		Optional<EMenuPosition>	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<LLUICtrl>("mode_combo"); -	mode_combo.setValue(gSavedSettings.getString("SessionSettingsFile")); -	mode_combo.setCommitCallback(boost::bind(&LLPanelLogin::onModeChange, this, getChild<LLUICtrl>("mode_combo")->getValue(), _2)); -  	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("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<LLUICtrl>("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" /> - <text -  follows="left|bottom" -  font="SansSerifSmall" -  height="15" -  left_pad="10" -  name="mode_selection_text" -  top="20" -  width="130"> -       Mode: - </text> -<combo_box -  follows="left|bottom" +  <menu_button +  left_pad="5" +  top="35" +  width="80"    height="23" -  max_chars="128" +  label="Mode ▼" +  name="mode_menu"      tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." -  top_pad="0" -  name="mode_combo" -  width="110"> -<combo_box.item -  label="Basic" -  name="Basic" -  value="settings_minimal.xml" /> -<combo_box.item -  label="Advanced" -  name="Advanced" -  value="" /> -</combo_box> +  menu_filename="menu_mode_change.xml" +    />    <text    follows="left|bottom"    font="SansSerifSmall" diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index d756dfb7de..4f8a0f3306 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -77,6 +77,17 @@       top="0"       width="55" />    </panel> +  <menu_button +    image_color="0 0 0 0" +    hover_glow_amount="0" +    left_pad="2" +    top="0" +    width="55" +    height="18" +    label="Mode ▼" +    tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." +    menu_filename="menu_mode_change.xml" +    />      <text       type="string"       font="SansSerifSmall" @@ -89,7 +100,7 @@       left_pad="0"       name="TimeText"       tool_tip="Current time (Pacific)" -     width="145"> +     width="70">          24:00 AM PST      </text>      <button diff --git a/indra/newview/skins/minimal/xui/en/main_view.xml b/indra/newview/skins/minimal/xui/en/main_view.xml index 6e8ad9adaf..ec2683880a 100644 --- a/indra/newview/skins/minimal/xui/en/main_view.xml +++ b/indra/newview/skins/minimal/xui/en/main_view.xml @@ -187,9 +187,9 @@         name="status_bar_container"         tab_stop="false"         height="30" -       left="-70" +       left="-120"         top="0" -       width="70" +       width="120"         visible="false"/>    <panel follows="top|bottom"           height="500" diff --git a/indra/newview/skins/minimal/xui/en/panel_login.xml b/indra/newview/skins/minimal/xui/en/panel_login.xml index 3903658e71..516c8d4f92 100644 --- a/indra/newview/skins/minimal/xui/en/panel_login.xml +++ b/indra/newview/skins/minimal/xui/en/panel_login.xml @@ -118,33 +118,16 @@ label="Remember password"    name="connect_btn"    top="35"    width="90" /> -  <text -  follows="left|bottom" -  font="SansSerifSmall" -  height="15" -  left_pad="10" -  name="mode_selection_text" -top="20" -  width="130"> -       Mode: - </text> -<combo_box -  follows="left|bottom" -  height="23" -  max_chars="128" -  top_pad="0" -  tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." -  name="mode_combo" -  width="120"> -<combo_box.item -  label="Basic" -  name="Basic" -  value="settings_minimal.xml" /> -<combo_box.item -  label="Advanced" -  name="Advanced" -  value="" /> -</combo_box> +  <menu_button +left_pad="10" +top="35" +width="80" +height="23" +label="Mode ▼" +name="mode_menu" +tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." +menu_filename="menu_mode_change.xml" +    />  </layout_panel>  <layout_panel  tab_stop="false" diff --git a/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml b/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml index 6dc1a1c9b0..e50911b8d2 100644 --- a/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml @@ -63,7 +63,7 @@ width="31" />       mouse_opaque="false"       name="location_combo"       top_delta="0" -     width="440"> +     width="390">      </location_input>      <icon follows="right"            height="20" diff --git a/indra/newview/skins/minimal/xui/en/panel_status_bar.xml b/indra/newview/skins/minimal/xui/en/panel_status_bar.xml index 6ccd0e938d..52223d5b13 100644 --- a/indra/newview/skins/minimal/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/minimal/xui/en/panel_status_bar.xml @@ -12,7 +12,7 @@   name="status"   top="19"   tab_stop="false" - width="70"> + width="120">      <panel.string       name="packet_loss_tooltip">          Packet Loss @@ -33,6 +33,17 @@       name="buycurrencylabel">          L$ [AMT]      </panel.string> +  <menu_button +    image_color="0 0 0 0" +    hover_glow_amount="0" +    left="2" +    top="7" +    width="50"   +    height="18" +    label="Mode ▼" +    tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." +    menu_filename="menu_mode_change.xml" +    />       <button       follows="right|top"       height="16" @@ -41,7 +52,7 @@       image_pressed="Pause_Press"       image_pressed_selected="Play_Press"       is_toggle="true" -     left="15" +     left="65"       top="7"       name="media_toggle_btn"       tool_tip="Start/Stop All Media (Music, Video, Web pages)" | 
