summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2010-06-08 23:30:56 +0300
committerAndrew Dyukov <adyukov@productengine.com>2010-06-08 23:30:56 +0300
commitae43801f44d6c1c23bb6aea17452c7ddcdec65a3 (patch)
tree01903b18173c2dd878d60509019cffe34a364677 /indra/newview/llfloaterpreference.cpp
parent9382433931a9266bafa8dcd797d6f98cb80a7eaf (diff)
EXT-6655 Fixed Made the default busy message repsonse localizable with already existing account settings
- The root of busy response problem is that this text is located in non-localizable xml and, to make things worse, may be changed by user. So usual translation approach is little help here. So busy response was set the following way(EXT-5885)- on first run, string was written there from strings xml and was never changed later without direct user actions. So after changin locale message always remained the same. - To make this string localize each time locale is changed and if it is the same as default message, new setting was added- BusyResponseChanged which is TRUE if user's busy message differ's from default. If it is true, we do nothing when locale changes, otherwise we set default message from current locale as user's busy message. - Old transitional code from DEV-24146 was removed in this diff including unnecessary "BusyModeResponse2" setting(it is not needed because we'll anyway have to set busy message to default after first run of viewer after this fix and now busy response will be stored in "BusyModeResponse"). Warning! If user modified busy response message before this fix, it will be reset to default after first postfix run. Reviewed by Richard Linden at https://codereview.productengine.com/secondlife/r/350/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r--indra/newview/llfloaterpreference.cpp57
1 files changed, 45 insertions, 12 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 5fbbb2c1a8..2299cd719c 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -330,9 +330,28 @@ BOOL LLFloaterPreference::postBuild()
std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
childSetText("cache_location", cache_location);
+ // if floater is opened before login set default localized busy message
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
+ }
+
return TRUE;
}
+void LLFloaterPreference::onBusyResponseChanged()
+{
+ // set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise
+ if(LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString())
+ {
+ gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE );
+ }
+ else
+ {
+ gSavedPerAccountSettings.setBOOL("BusyResponseChanged", FALSE );
+ }
+}
+
LLFloaterPreference::~LLFloaterPreference()
{
// clean up user data
@@ -487,6 +506,22 @@ void LLFloaterPreference::cancel()
void LLFloaterPreference::onOpen(const LLSD& key)
{
+ // this variable and if that follows it are used to properly handle busy mode response message
+ static bool initialized = FALSE;
+ // if user is logged in and we haven't initialized busy_response yet, do it
+ if (!initialized && LLStartUp::getStartupState() == STATE_STARTED)
+ {
+ // Special approach is used for busy response localization, because "BusyModeResponse" is
+ // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized.
+ // To keep track of whether busy response is default or changed by user additional setting BusyResponseChanged
+ // was added into per account settings.
+
+ // initialization should happen once,so setting variable to TRUE
+ initialized = TRUE;
+ // this connection is needed to properly set "BusyResponseChanged" setting when user makes changes in
+ // busy response message.
+ gSavedPerAccountSettings.getControl("BusyModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onBusyResponseChanged, this));
+ }
gAgent.sendAgentUserInfoRequest();
/////////////////////////// From LLPanelGeneral //////////////////////////
@@ -540,6 +575,16 @@ void LLFloaterPreference::onVertexShaderEnable()
refreshEnabledGraphics();
}
+//static
+void LLFloaterPreference::initBusyResponse()
+ {
+ if (!gSavedPerAccountSettings.getBOOL("BusyResponseChanged"))
+ {
+ //LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
+ gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault"));
+ }
+ }
+
void LLFloaterPreference::setHardwareDefaults()
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
@@ -960,18 +1005,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data)
refresh();
}
-// static
-// DEV-24146 - needs to be removed at a later date. jan-2009
-void LLFloaterPreference::cleanupBadSetting()
-{
- if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|")
- {
- llinfos << "cleaning old BusyModeResponse" << llendl;
- //LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
- gSavedPerAccountSettings.setString("BusyModeResponse2", LLTrans::getString("BusyModeResponseDefault"));
- }
-}
-
void LLFloaterPreference::onClickSetKey()
{
LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE);