From 8c7db44a2a85f8ea907386bc1d1c74babbae99d8 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Fri, 16 Jul 2010 00:02:43 -0700 Subject: Feature #277: added the grid manager to Preferences > General and changed the start location to a pulldown to match the login screen --- linden/indra/newview/llpanelgeneral.cpp | 62 ++++++++++++++++++++-- linden/indra/newview/llpanelgeneral.h | 2 + linden/indra/newview/llpanellogin.cpp | 2 +- .../xui/en-us/panel_preferences_general.xml | 29 ++++++---- 4 files changed, 79 insertions(+), 16 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llpanelgeneral.cpp b/linden/indra/newview/llpanelgeneral.cpp index 8dfbe49..07c81fd 100644 --- a/linden/indra/newview/llpanelgeneral.cpp +++ b/linden/indra/newview/llpanelgeneral.cpp @@ -42,7 +42,9 @@ #include "llurlsimstring.h" #include "llviewercontrol.h" +#include "floatergridmanager.h" #include "llagent.h" +#include "llpanellogin.h" #include "llviewerregion.h" LLPanelGeneral::LLPanelGeneral() @@ -55,7 +57,34 @@ BOOL LLPanelGeneral::postBuild() LLComboBox* fade_out_combobox = getChild("fade_out_combobox"); fade_out_combobox->setCurrentByIndex(gSavedSettings.getS32("RenderName")); - childSetValue("default_start_location", gSavedSettings.getBOOL("LoginLastLocation") ? "MyLastLocation" : "MyHome"); + LLComboBox* combo = getChild("default_location_combo"); + childSetCommitCallback("default_location_combo", onLocationChanged, this); + combo->setAllowTextEntry(TRUE, 128, FALSE); + + // The XML file loads the combo with the following labels: + // 0 - "My Home" + // 1 - "My Last Location" + // 2 - "" + + BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); + std::string sim_string = LLURLSimString::sInstance.mSimString; + if (!sim_string.empty()) + { + // Replace "" with this region name + combo->remove(2); + combo->add( sim_string ); + combo->setTextEntry(sim_string); + combo->setCurrentByIndex( 2 ); + } + else if (login_last) + { + combo->setCurrentByIndex( 1 ); + } + else + { + combo->setCurrentByIndex( 0 ); + } + childSetValue("show_location_checkbox", gSavedSettings.getBOOL("ShowStartLocation")); childSetValue("show_all_title_checkbox", gSavedSettings.getBOOL("RenderHideGroupTitleAll")); childSetValue("show_my_name_checkbox", gSavedSettings.getBOOL("RenderNameHideSelf")); @@ -103,6 +132,8 @@ BOOL LLPanelGeneral::postBuild() childSetVisible("maturity_desired_combobox", can_choose); childSetVisible("maturity_desired_textbox", !can_choose); + + childSetAction("grid_btn", onClickGrid, this); return TRUE; } @@ -117,7 +148,15 @@ void LLPanelGeneral::apply() LLComboBox* fade_out_combobox = getChild("fade_out_combobox"); gSavedSettings.setS32("RenderName", fade_out_combobox->getCurrentIndex()); - gSavedSettings.setBOOL("LoginLastLocation", childGetValue("default_start_location").asString() == "MyLastLocation"); + LLComboBox* loc_combo = getChild("default_location_combo"); + gSavedSettings.setBOOL("LoginLastLocation", loc_combo->getCurrentIndex() == 1); + if (!loc_combo->getValue().asString().empty() && + loc_combo->getSelectedItemLabel() != "") + { + LLURLSimString::setString(loc_combo->getValue().asString()); + } + LLPanelLogin::refreshLocation(false); + gSavedSettings.setBOOL("ShowStartLocation", childGetValue("show_location_checkbox")); gSavedSettings.setBOOL("RenderHideGroupTitleAll", childGetValue("show_all_title_checkbox")); gSavedSettings.setBOOL("RenderNameHideSelf", childGetValue("show_my_name_checkbox")); @@ -132,8 +171,6 @@ void LLPanelGeneral::apply() gSavedSettings.setBOOL("UIAutoScale", childGetValue("ui_auto_scale")); gSavedSettings.setString("Language", childGetValue("language_combobox")); - LLURLSimString::setString(childGetValue("location_combobox")); - LLComboBox* crash_behavior_combobox = getChild("crash_behavior_combobox"); gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex()); @@ -170,3 +207,20 @@ void LLPanelGeneral::onClickResetUISize(void* user_data) LLPanelGeneral* self = (LLPanelGeneral*)user_data; self->childSetValue("ui_scale_slider", 1.002f); } + +// static +void LLPanelGeneral::onClickGrid(void *) +{ + FloaterGridManager::getInstance()->open(); + FloaterGridManager::getInstance()->center(); +} + +// static +void LLPanelGeneral::onLocationChanged(LLUICtrl* ctrl, void* data) +{ + LLPanelGeneral* self = (LLPanelGeneral*)data; + if (self->getChild("default_location_combo")->getCurrentIndex() == 2) + { + self->getChild("default_location_combo")->setTextEntry(LLURLSimString::sInstance.mSimString); + } +} diff --git a/linden/indra/newview/llpanelgeneral.h b/linden/indra/newview/llpanelgeneral.h index c5a1f63..e85fdf8 100644 --- a/linden/indra/newview/llpanelgeneral.h +++ b/linden/indra/newview/llpanelgeneral.h @@ -49,6 +49,8 @@ public: private: static void onClickResetUISize(void*); + static void onClickGrid(void*); + static void onLocationChanged(LLUICtrl* ctrl, void* data); }; #endif diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index ea84fee..a95272a 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp @@ -721,7 +721,7 @@ void LLPanelLogin::refreshLocation( bool force_visible ) if (LLURLSimString::parse()) { - combo->setCurrentByIndex( 3 ); // BUG? Maybe 2? + combo->setCurrentByIndex( 2 ); combo->setTextEntry(LLURLSimString::sInstance.mSimString); } else diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml index cc87175..6b8f7aa 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_general.xml @@ -2,17 +2,24 @@ - - - My home - - - My last location - - + + + My Home + + + My Last Location + + + <Type region name> + + +