summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-01-15 10:42:09 -0800
committerGilbert Gonzales <gilbert@lindenlab.com>2013-01-15 10:42:09 -0800
commit028ceaef1441cbd2d87b294c6cfe7193a6b8bbd7 (patch)
tree7b35e8b814e41d1aef77a291249298a60c25a11e /indra
parent0e90e94a4d5cbac2d186f0056821a51078e8d1bd (diff)
parenta49d3b14254fa5cfac3900e86b2287a016eaf9cc (diff)
merging in latest changes
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings_per_account.xml13
-rw-r--r--indra/newview/llfloaterimcontainer.cpp25
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp20
-rw-r--r--indra/newview/llfloaterimsessiontab.h4
-rw-r--r--indra/newview/llfloatertranslationsettings.cpp18
-rw-r--r--indra/newview/llfloatertranslationsettings.h1
-rw-r--r--indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml20
7 files changed, 81 insertions, 20 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 4ff494fbfb..6864328339 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -270,7 +270,18 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>ShowFavoritesOnLogin</key>
+ <key>TranslatingEnabled</key>
+ <map>
+ <key>Comment</key>
+ <string>Translation prefs are set</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+ <key>ShowFavoritesOnLogin</key>
<map>
<key>Comment</key>
<string>Determines whether favorites of last logged in user will be saved on exit from viewer and shown on login screen</string>
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 376144951d..dd7e28dc71 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -894,7 +894,18 @@ void LLFloaterIMContainer::getSelectedUUIDs(uuid_vec_t& selected_uuids)
for (; it != it_end; ++it)
{
conversationItem = static_cast<LLConversationItem *>((*it)->getViewModelItem());
- selected_uuids.push_back(conversationItem->getUUID());
+
+ //When a one-on-one conversation exists, retrieve the participant id from the conversation floater
+ if(conversationItem->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
+ {
+ LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(conversationItem->getUUID());
+ LLUUID participant_id = conversation_floaterp->getOtherParticipantUUID();
+ selected_uuids.push_back(participant_id);
+ }
+ else
+ {
+ selected_uuids.push_back(conversationItem->getUUID());
+ }
}
}
@@ -930,17 +941,7 @@ void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids)
return;
}
- if (conversation_item->getType() == LLConversationItem::CONV_PARTICIPANT)
- {
- getSelectedUUIDs(selected_uuids);
- }
- //When a one-on-one conversation exists, retrieve the participant id from the conversation floater
- else if(conversation_item->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
- {
- LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(conversation_item->getUUID());
- LLUUID participant_id = conversation_floaterp->getOtherParticipantUUID();
- selected_uuids.push_back(participant_id);
- }
+ getSelectedUUIDs(selected_uuids);
}
void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS)
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index d4eb03f95d..06a79836db 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -72,6 +72,12 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id)
boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2));
mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable",
boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2));
+ mEnableCallbackRegistrar.add("Translating.Enabled",
+ boost::bind(&LLFloaterIMSessionTab::isTranslatingEnabled, this, _2));
+ mEnableCallbackRegistrar.add("Translating.On",
+ boost::bind(&LLFloaterIMSessionTab::isTranslationOn, this, _2));
+ mCommitCallbackRegistrar.add("Translating.Toggle",
+ boost::bind(&LLFloaterIMSessionTab::toggleTranslation, this, _2));
// Right click menu handling
mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMSessionTab::checkContextMenuItem, this, _2));
@@ -552,6 +558,10 @@ void LLFloaterIMSessionTab::onIMSessionMenuItemClicked(const LLSD& userdata)
LLFloaterIMSessionTab::processChatHistoryStyleUpdate();
}
+void LLFloaterIMSessionTab::toggleTranslation(const LLSD& userdata)
+{
+ gSavedSettings.setBOOL("TranslateChat", !gSavedSettings.getBOOL("TranslateChat"));
+}
bool LLFloaterIMSessionTab::onIMCompactExpandedMenuItemCheck(const LLSD& userdata)
{
@@ -576,6 +586,16 @@ bool LLFloaterIMSessionTab::onIMShowModesMenuItemEnable(const LLSD& userdata)
return (plain_text && (is_not_names || mIsP2PChat));
}
+bool LLFloaterIMSessionTab::isTranslatingEnabled(const LLSD& userdata)
+{
+ return gSavedPerAccountSettings.getBOOL("TranslatingEnabled");
+}
+
+bool LLFloaterIMSessionTab::isTranslationOn(const LLSD& userdata)
+{
+ return gSavedSettings.getBOOL("TranslateChat");
+}
+
void LLFloaterIMSessionTab::hideOrShowTitle()
{
const LLFloater::Params& default_params = LLFloater::getDefaultParams();
diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h
index 0fa99a46be..05da0f98bc 100644
--- a/indra/newview/llfloaterimsessiontab.h
+++ b/indra/newview/llfloaterimsessiontab.h
@@ -109,8 +109,12 @@ protected:
//
bool onIMShowModesMenuItemCheck(const LLSD& userdata);
bool onIMShowModesMenuItemEnable(const LLSD& userdata);
+ bool isTranslatingEnabled(const LLSD& userdata);
+ bool isTranslationOn(const LLSD& userdata);
static void onSlide(LLFloaterIMSessionTab *self);
+ void toggleTranslation(const LLSD& userdata);
+
// refresh a visual state of the Call button
void updateCallBtnState(bool callIsActive);
diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp
index 6a9236ce0c..33f2c35239 100644
--- a/indra/newview/llfloatertranslationsettings.cpp
+++ b/indra/newview/llfloatertranslationsettings.cpp
@@ -225,11 +225,10 @@ void LLFloaterTranslationSettings::updateControlsEnabledState()
mGoogleVerifyBtn->setEnabled(on && google_selected &&
!mGoogleKeyVerified && !getEnteredGoogleKey().empty());
- mOKBtn->setEnabled(
- !on || (
- (bing_selected && mBingKeyVerified) ||
- (google_selected && mGoogleKeyVerified)
- ));
+ bool service_verified = (bing_selected && mBingKeyVerified) || (google_selected && mGoogleKeyVerified);
+ gSavedPerAccountSettings.setBOOL("TranslatingEnabled", service_verified);
+
+ mOKBtn->setEnabled(!on || service_verified);
}
void LLFloaterTranslationSettings::verifyKey(int service, const std::string& key, bool alert)
@@ -285,7 +284,16 @@ void LLFloaterTranslationSettings::onBtnGoogleVerify()
verifyKey(LLTranslate::SERVICE_GOOGLE, key);
}
}
+void LLFloaterTranslationSettings::onClose(bool app_quitting)
+{
+ std::string service = gSavedSettings.getString("TranslationService");
+ bool bing_selected = service == "bing";
+ bool google_selected = service == "google";
+
+ bool service_verified = (bing_selected && mBingKeyVerified) || (google_selected && mGoogleKeyVerified);
+ gSavedPerAccountSettings.setBOOL("TranslatingEnabled", service_verified);
+}
void LLFloaterTranslationSettings::onBtnOK()
{
gSavedSettings.setBOOL("TranslateChat", mMachineTranslationCB->getValue().asBoolean());
diff --git a/indra/newview/llfloatertranslationsettings.h b/indra/newview/llfloatertranslationsettings.h
index 9b47ad72ed..b9bfd6265a 100644
--- a/indra/newview/llfloatertranslationsettings.h
+++ b/indra/newview/llfloatertranslationsettings.h
@@ -44,6 +44,7 @@ public:
void setBingVerified(bool ok, bool alert);
void setGoogleVerified(bool ok, bool alert);
+ void onClose(bool app_quitting);
private:
std::string getSelectedService() const;
diff --git a/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml b/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml
index 483f24afd0..f2a8b39b04 100644
--- a/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml
+++ b/indra/newview/skins/default/xui/en/menu_im_session_showmodes.xml
@@ -44,7 +44,23 @@
parameter="IMShowNamesForP2PConv" />
<menu_item_check.on_enable
function="IMSession.Menu.ShowModes.Enable"
- parameter="IMShowNamesForP2PConv" />
-
+ parameter="IMShowNamesForP2PConv" />
</menu_item_check>
+ <menu_item_separator layout="topleft" />
+ <menu_item_check name="Translate_chat" label="Translate chat">
+ <menu_item_check.on_click
+ function="Translating.Toggle" />
+ <menu_item_check.on_check
+ function="Translating.On" />
+ <menu_item_check.on_enable
+ function="Translating.Enabled" />
+ </menu_item_check>
+ <menu_item_check name="Translation_settings" label="Translation settings...">
+ <menu_item_check.on_check
+ function="Floater.Visible"
+ parameter="prefs_translation" />
+ <menu_item_check.on_click
+ function="Floater.Toggle"
+ parameter="prefs_translation" />
+ </menu_item_check>
</toggleable_menu>