Commits

richard_linden committed 7231ef3

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

  • Participants
  • Parent commits fb97eb2

Comments (0)

Files changed (12)

indra/llui/llmenubutton.cpp

 
 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)
 {
 }
 
 LLMenuButton::LLMenuButton(const LLMenuButton::Params& p)
 :	LLButton(p),
 	mIsMenuShown(false),
-	mMenuPosition(MP_BOTTOM_LEFT)
+	mMenuPosition(p.position)
 {
 	std::string menu_filename = p.menu_filename;
 

indra/llui/llmenubutton.h

 : public LLButton
 {
 public:
-	struct Params 
-	:	public LLInitParam::Block<Params, LLButton::Params>
-	{
-		// filename for it's toggleable menu
-		Optional<std::string>	menu_filename;
-	
-		Params();
-	};
-
 	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();
+	};
+
+
 	
 	boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
 

indra/newview/llpanellogin.cpp

 	}
 	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));
 	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;

indra/newview/llpanellogin.h

 	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();
 

indra/newview/llstartup.cpp

 
 		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)
 		{
 			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 );

indra/newview/llviewermenu.cpp

 };
 
 
-class LLAdvancedToggleFeature : public view_listener_t{
+class LLAdvancedToggleFeature : public view_listener_t
+{
 	bool handleEvent(const LLSD& userdata)
 	{
 		U32 feature = feature_from_string( userdata.asString() );
 };
 
 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 )
-	{
-		new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature );
-	}
-
-	return new_value;
-}
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		U32 feature = feature_from_string( userdata.asString() );
+		bool new_value = false;
+
+		if ( feature != 0 )
+		{
+			new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature );
+		}
+
+		return new_value;
+	}
 };
 
 void toggle_destination_and_avatar_picker(const LLSD& show)
 	}
 };
 
+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();
 	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));

indra/newview/skins/default/xui/en/panel_login.xml

   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"

indra/newview/skins/default/xui/en/panel_status_bar.xml

      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"
      left_pad="0"
      name="TimeText"
      tool_tip="Current time (Pacific)"
-     width="145">
+     width="70">
         24:00 AM PST
     </text>
     <button

indra/newview/skins/minimal/xui/en/main_view.xml

        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"

indra/newview/skins/minimal/xui/en/panel_login.xml

   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"

indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml

      mouse_opaque="false"
      name="location_combo"
      top_delta="0"
-     width="440">
+     width="390">
     </location_input>
     <icon follows="right"
           height="20"

indra/newview/skins/minimal/xui/en/panel_status_bar.xml

  name="status"
  top="19"
  tab_stop="false"
- width="70">
+ width="120">
     <panel.string
      name="packet_loss_tooltip">
         Packet Loss
      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"
      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)"