aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llprefschat.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2011-05-03 18:09:28 -0700
committerMcCabe Maxsted2011-05-04 15:21:09 -0700
commitcc8e7060dfb54900f1600965a78c6f6f9fc564c4 (patch)
tree9b23e53ace5696db2c78867582308f38cba19d71 /linden/indra/newview/llprefschat.cpp
parentBackported crash fix in llhudeffectlookat from gpl'd viewer 2 (diff)
downloadmeta-impy-cc8e7060dfb54900f1600965a78c6f6f9fc564c4.zip
meta-impy-cc8e7060dfb54900f1600965a78c6f6f9fc564c4.tar.gz
meta-impy-cc8e7060dfb54900f1600965a78c6f6f9fc564c4.tar.bz2
meta-impy-cc8e7060dfb54900f1600965a78c6f6f9fc564c4.tar.xz
Besides the numerous label and organizational changes, here are the main points
* Moved numerous options out of the Advanced panel * Moved numerous options out of the General panel * Combined the Network and Web Browser panels * Combined IM, Chat, and Spell checking preferences * Combined 'Show timestamps in IMs' and 'Show timestamps in Local Chat' to one ShowTimestamps setting * Removed UI for 'hide my own group title'. This can still be set in the debug settings * Renamed Popups > Notifications * Renamed Chat Colors > Colors * Renamed 'IMs and Logging' to 'Logging and Privacy' * Moved Colors next to Skins * Added style guide to the top of every preferences panel xui
Diffstat (limited to 'linden/indra/newview/llprefschat.cpp')
-rw-r--r--linden/indra/newview/llprefschat.cpp322
1 files changed, 252 insertions, 70 deletions
diff --git a/linden/indra/newview/llprefschat.cpp b/linden/indra/newview/llprefschat.cpp
index 5f74a25..9490ba2 100644
--- a/linden/indra/newview/llprefschat.cpp
+++ b/linden/indra/newview/llprefschat.cpp
@@ -33,13 +33,20 @@
33 33
34#include "llviewerprecompiledheaders.h" 34#include "llviewerprecompiledheaders.h"
35 35
36#include "llcombobox.h"
37#include "llpanel.h"
38#include "llstylemap.h"
39#include "lluictrlfactory.h"
40
41#include "floatercommandline.h"
42#include "llagent.h"
36#include "llchatbar.h" 43#include "llchatbar.h"
37#include "llfloaterchat.h" 44#include "llfloaterchat.h"
45#include "lgghunspell_wrapper.h"
46#include "lggautocorrectfloater.h"
38#include "llprefschat.h" 47#include "llprefschat.h"
39#include "llviewercontrol.h" 48#include "llviewercontrol.h"
40#include "lluictrlfactory.h" 49#include "llviewermessage.h"
41#include "llradiogroup.h"
42#include "llstylemap.h"
43 50
44class LLPrefsChatImpl : public LLPanel 51class LLPrefsChatImpl : public LLPanel
45{ 52{
@@ -47,44 +54,53 @@ public:
47 LLPrefsChatImpl(); 54 LLPrefsChatImpl();
48 /*virtual*/ ~LLPrefsChatImpl(){}; 55 /*virtual*/ ~LLPrefsChatImpl(){};
49 56
57 /*virtual*/ BOOL postBuild();
58
50 void apply(); 59 void apply();
51 void cancel(); 60 void cancel();
61 void refresh();
62 void setPersonalInfo(bool im_via_email, const std::string& email);
63 void initHelpBtn(const std::string& name, const std::string& xml_alert);
64
65 static void onAutoCorrectButton(void * data);
66 static void onClickHelp(void* data);
67 static void onClickCommandLine(void* data);
68 static void onCommitCheckBox(LLUICtrl* ctrl, void* user_data);
69 static void onSpellAdd(void* data);
70 static void onSpellRemove(void* data);
71 static void onSpellGetMore(void* data);
72 static void onSpellEditCustom(void* data);
73 static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata);
74
75protected:
76 bool mOriginalIMViaEmail;
77 bool mGotPersonalInfo;
52 78
53private: 79private:
54 void refreshValues(); 80 bool mChatChannel;
55 S32 mChatSize;
56 F32 mChatPersist;
57 S32 mChatMaxLines;
58 BOOL mChatFullWidth;
59 BOOL mCloseChatOnReturn;
60 BOOL mArrowKeysMoveAvatar;
61 BOOL mShowTimestamps;
62 BOOL mPlayTypingAnim;
63 BOOL mChatBubbles;
64 BOOL mLocalChatBubbles;
65 BOOL mScriptErrorAsChat;
66 BOOL mChatChannel;
67 F32 mConsoleOpacity;
68 F32 mBubbleOpacity;
69 std::string mTranslateLanguage;
70 BOOL mTranslateChat;
71}; 81};
72 82
73LLPrefsChatImpl::LLPrefsChatImpl() 83LLPrefsChatImpl::LLPrefsChatImpl()
74 : LLPanel(std::string("Chat Panel")) 84 : LLPanel(std::string("Chat Panel")),
85 mChatChannel(false),
86 mOriginalIMViaEmail(false),
87 mGotPersonalInfo(false)
75{ 88{
76 refreshValues(); // initialize member data from saved settings
77
78 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_chat.xml"); 89 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_chat.xml");
90}
91
92BOOL LLPrefsChatImpl::postBuild()
93{
94 requires("send_im_to_email");
95 childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change"));
96
97 // Don't enable these until we get personal data
98 childSetEnabled("send_im_to_email", false);
79 99
80 getChild<LLRadioGroup>("chat_font_size")->setSelectedIndex(gSavedSettings.getS32("ChatFontSize")); 100 getChild<LLComboBox>("chat_font_size")->setValue(gSavedSettings.getS32("ChatFontSize"));
81 childSetValue("fade_chat_time", gSavedSettings.getF32("ChatPersistTime")); 101 childSetValue("fade_chat_time", gSavedSettings.getF32("ChatPersistTime"));
82 childSetValue("max_chat_count", gSavedSettings.getS32("ConsoleMaxLines")); 102 childSetValue("max_chat_count", gSavedSettings.getS32("ConsoleMaxLines"));
83 103
84 childSetValue("arrow_keys_move_avatar_check", gSavedSettings.getBOOL("ArrowKeysMoveAvatar"));
85 childSetValue("show_timestamps_check", gSavedSettings.getBOOL("ChatShowTimestamps"));
86 childSetValue("script_errors_as_chat", gSavedSettings.getBOOL("ScriptErrorsAsChat"));
87
88 childSetValue("bubble_text_chat", gSavedSettings.getBOOL("UseChatBubbles")); 104 childSetValue("bubble_text_chat", gSavedSettings.getBOOL("UseChatBubbles"));
89 childSetValue("local_bubble_text_chat", gSavedSettings.getBOOL("UseLocalChatWithBubbles")); 105 childSetValue("local_bubble_text_chat", gSavedSettings.getBOOL("UseLocalChatWithBubbles"));
90 childSetValue("chat_full_width_check", gSavedSettings.getBOOL("ChatFullWidth")); 106 childSetValue("chat_full_width_check", gSavedSettings.getBOOL("ChatFullWidth"));
@@ -95,59 +111,89 @@ LLPrefsChatImpl::LLPrefsChatImpl()
95 childSetValue("bubble_chat_opacity", gSavedSettings.getF32("ChatBubbleOpacity")); 111 childSetValue("bubble_chat_opacity", gSavedSettings.getF32("ChatBubbleOpacity"));
96 childSetValue("translate_language_combobox", gSavedSettings.getString("TranslateLanguage")); 112 childSetValue("translate_language_combobox", gSavedSettings.getString("TranslateLanguage"));
97 childSetValue("translate_chat", gSavedSettings.getBOOL("TranslateChat")); 113 childSetValue("translate_chat", gSavedSettings.getBOOL("TranslateChat"));
98}
99 114
100void LLPrefsChatImpl::refreshValues()
101{
102 //set values
103 mChatSize = gSavedSettings.getS32("ChatFontSize");
104 mChatPersist = gSavedSettings.getF32("ChatPersistTime");
105 mChatMaxLines = gSavedSettings.getS32("ConsoleMaxLines");
106 mArrowKeysMoveAvatar = gSavedSettings.getBOOL("ArrowKeysMoveAvatar");
107 mShowTimestamps = gSavedSettings.getBOOL("ChatShowTimestamps");
108 mScriptErrorAsChat = gSavedSettings.getBOOL("ScriptErrorsAsChat");
109 mChatBubbles = gSavedSettings.getBOOL("UseChatBubbles");
110 mLocalChatBubbles = gSavedSettings.getBOOL("UseLocalChatWithBubbles");
111 mChatFullWidth = gSavedSettings.getBOOL("ChatFullWidth");
112 mCloseChatOnReturn = gSavedSettings.getBOOL("CloseChatOnReturn");
113 mPlayTypingAnim = gSavedSettings.getBOOL("PlayTypingAnim");
114 mChatChannel = gSavedSettings.getBOOL("ChatChannelSelect"); 115 mChatChannel = gSavedSettings.getBOOL("ChatChannelSelect");
115 mConsoleOpacity = gSavedSettings.getF32("ConsoleBackgroundOpacity"); 116
116 mTranslateLanguage = gSavedSettings.getString("TranslateLanguage"); 117 childSetValue("command_line_check", gSavedSettings.getBOOL("CmdLineChatbarEnabled"));
117 mTranslateChat = gSavedSettings.getBOOL("TranslateChat"); 118 childSetCommitCallback("command_line_check", onCommitCheckBox, this);
118 static F32* sChatBubbleOpacity = rebind_llcontrol<F32>("ChatBubbleOpacity", &gSavedSettings, true); 119 childSetAction("command_line_btn", onClickCommandLine, this);
119 mBubbleOpacity = *sChatBubbleOpacity; 120
121 getChild<LLComboBox>("EmeraldSpellBase")->setCommitCallback(onSpellBaseComboBoxCommit);
122 getChild<LLButton>("EmSpell_EditCustom")->setClickedCallback(onSpellEditCustom, this);
123 getChild<LLButton>("EmSpell_GetMore")->setClickedCallback(onSpellGetMore, this);
124 getChild<LLButton>("EmSpell_Add")->setClickedCallback(onSpellAdd, this);
125 getChild<LLButton>("EmSpell_Remove")->setClickedCallback(onSpellRemove, this);
126
127 getChild<LLButton>("ac_button")->setClickedCallback(onAutoCorrectButton, this);
128 initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck");
129
130 childSetValue("include_im_in_chat_console", gSavedSettings.getBOOL("IMInChatConsole"));
131 childSetValue("include_im_in_chat_history", gSavedSettings.getBOOL("IMInChatHistory"));
132 childSetValue("vertical-imtabs-toggle", gSavedSettings.getBOOL("VerticalIMTabs"));
133
134 refresh();
135
136 return TRUE;
137}
138
139void LLPrefsChatImpl::refresh()
140{
141 if (childGetValue("command_line_check").asBoolean())
142 {
143 childEnable("command_line_btn");
144 }
145 else
146 {
147 childDisable("command_line_btn");
148 }
149
150 LLComboBox* comboBox = getChild<LLComboBox>("EmeraldSpellBase");
151 if (comboBox != NULL)
152 {
153 comboBox->removeall();
154 std::vector<std::string> names = glggHunSpell->getDicts();
155 for (int i = 0; i < (int)names.size(); i++)
156 {
157 comboBox->add(names[i]);
158 }
159 comboBox->setSimple(gSavedSettings.getString("EmeraldSpellBase"));
160 }
161 comboBox = getChild<LLComboBox>("EmSpell_Avail");
162 if (comboBox != NULL)
163 {
164 LLSD selected = comboBox->getSelectedValue();
165 comboBox->removeall();
166 std::vector<std::string> names = glggHunSpell->getAvailDicts();
167 for (int i = 0; i < (int)names.size(); i++)
168 {
169 comboBox->add(names[i]);
170 }
171 comboBox->selectByValue(selected);
172 }
173 comboBox = getChild<LLComboBox>("EmSpell_Installed");
174 if (comboBox != NULL)
175 {
176 LLSD selected = comboBox->getSelectedValue();
177 comboBox->removeall();
178 std::vector<std::string> names = glggHunSpell->getInstalledDicts();
179 for (int i = 0; i < (int)names.size(); i++)
180 {
181 comboBox->add(names[i]);
182 }
183 comboBox->selectByValue(selected);
184 }
120} 185}
121 186
122void LLPrefsChatImpl::cancel() 187void LLPrefsChatImpl::cancel()
123{ 188{
124 gSavedSettings.setS32("ChatFontSize", mChatSize);
125 gSavedSettings.setF32("ChatPersistTime", mChatPersist);
126 gSavedSettings.setS32("ConsoleMaxLines", mChatMaxLines);
127 gSavedSettings.setBOOL("ArrowKeysMoveAvatar", mArrowKeysMoveAvatar);
128 gSavedSettings.setBOOL("ChatShowTimestamps", mShowTimestamps);
129 gSavedSettings.setBOOL("ScriptErrorsAsChat", mScriptErrorAsChat);
130 gSavedSettings.setBOOL("UseChatBubbles", mChatBubbles);
131 gSavedSettings.setBOOL("UseLocalChatWithBubbles", mLocalChatBubbles);
132 gSavedSettings.setBOOL("ChatFullWidth", mChatFullWidth);
133 gSavedSettings.setBOOL("CloseChatOnReturn", mCloseChatOnReturn);
134 gSavedSettings.setBOOL("PlayTypingAnim", mPlayTypingAnim);
135 gSavedSettings.setBOOL("ChatChannelSelect", mChatChannel);
136 gSavedSettings.setF32("ConsoleBackgroundOpacity", mConsoleOpacity);
137 gSavedSettings.setF32("ChatBubbleOpacity", mBubbleOpacity);
138 gSavedSettings.setString("TranslateLanguage", mTranslateLanguage);
139 gSavedSettings.setBOOL("TranslateChat", mTranslateChat);
140} 189}
141 190
142void LLPrefsChatImpl::apply() 191void LLPrefsChatImpl::apply()
143{ 192{
144 gSavedSettings.setS32("ChatFontSize", getChild<LLRadioGroup>("chat_font_size")->getSelectedIndex()); 193 gSavedSettings.setS32("ChatFontSize", getChild<LLComboBox>("chat_font_size")->getValue().asInteger());
145 gSavedSettings.setF32("ChatPersistTime", childGetValue("fade_chat_time").asReal()); 194 gSavedSettings.setF32("ChatPersistTime", childGetValue("fade_chat_time").asReal());
146 gSavedSettings.setS32("ConsoleMaxLines", childGetValue("max_chat_count")); 195 gSavedSettings.setS32("ConsoleMaxLines", childGetValue("max_chat_count"));
147 196
148 gSavedSettings.setBOOL("ArrowKeysMoveAvatar", childGetValue("arrow_keys_move_avatar_check"));
149 gSavedSettings.setBOOL("ChatShowTimestamps", childGetValue("show_timestamps_check"));
150 gSavedSettings.setBOOL("ScriptErrorsAsChat", childGetValue("script_errors_as_chat"));
151 gSavedSettings.setBOOL("UseChatBubbles", childGetValue("bubble_text_chat")); 197 gSavedSettings.setBOOL("UseChatBubbles", childGetValue("bubble_text_chat"));
152 gSavedSettings.setBOOL("UseLocalChatWithBubbles", childGetValue("local_bubble_text_chat")); 198 gSavedSettings.setBOOL("UseLocalChatWithBubbles", childGetValue("local_bubble_text_chat"));
153 gSavedSettings.setBOOL("ChatFullWidth", childGetValue("chat_full_width_check")); 199 gSavedSettings.setBOOL("ChatFullWidth", childGetValue("chat_full_width_check"));
@@ -160,7 +206,7 @@ void LLPrefsChatImpl::apply()
160 gSavedSettings.setString("TranslateLanguage", childGetValue("translate_language_combobox")); 206 gSavedSettings.setString("TranslateLanguage", childGetValue("translate_language_combobox"));
161 gSavedSettings.setBOOL("TranslateChat", childGetValue("translate_chat")); 207 gSavedSettings.setBOOL("TranslateChat", childGetValue("translate_chat"));
162 208
163 BOOL chan_check = childGetValue("toggle_channel_control"); 209 bool chan_check = childGetValue("toggle_channel_control");
164 gSavedSettings.setBOOL("ChatChannelSelect", chan_check); 210 gSavedSettings.setBOOL("ChatChannelSelect", chan_check);
165 if (mChatChannel != chan_check) 211 if (mChatChannel != chan_check)
166 { 212 {
@@ -172,7 +218,138 @@ void LLPrefsChatImpl::apply()
172 mChatChannel = chan_check; 218 mChatChannel = chan_check;
173 } 219 }
174 220
175 refreshValues(); // member values become the official values and cancel becomes a no-op. 221 gSavedSettings.setBOOL("CmdLineChatbarEnabled", childGetValue("command_line_check").asBoolean());
222
223 gSavedSettings.setBOOL("VerticalIMTabs", childGetValue("vertical-imtabs-toggle").asBoolean());
224 gSavedSettings.setBOOL("IMInChatConsole", childGetValue("include_im_in_chat_console").asBoolean());
225 gSavedSettings.setBOOL("IMInChatHistory", childGetValue("include_im_in_chat_history").asBoolean());
226
227 if (mGotPersonalInfo)
228 {
229 bool new_im_via_email = childGetValue("send_im_to_email").asBoolean();
230
231 if (new_im_via_email != mOriginalIMViaEmail)
232 {
233 LLMessageSystem* msg = gMessageSystem;
234 msg->newMessageFast(_PREHASH_UpdateUserInfo);
235 msg->nextBlockFast(_PREHASH_AgentData);
236 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
237 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
238 msg->nextBlockFast(_PREHASH_UserData);
239 msg->addBOOLFast(_PREHASH_IMViaEMail, new_im_via_email);
240 gAgent.sendReliableMessage();
241 }
242 }
243
244 // Spell checking prefs aren't here because Emerald never supported the cancel button. We should fix this -- MC
245}
246
247// Enable and set the value of settings recieved from the sim in AgentInfoReply
248void LLPrefsChatImpl::setPersonalInfo(bool im_via_email, const std::string& email)
249{
250 mGotPersonalInfo = true;
251 mOriginalIMViaEmail = im_via_email;
252
253 childEnable("send_im_to_email");
254 childSetValue("send_im_to_email", im_via_email);
255
256 // Truncate the e-mail address if it's too long (to prevent going off
257 // the edge of the dialog).
258 std::string display_email(email);
259 if(display_email.size() > 30)
260 {
261 display_email.resize(30);
262 display_email += "...";
263 }
264 else if (display_email.empty())
265 {
266 display_email = getString("default_email_used");
267 }
268 childSetLabelArg("send_im_to_email", "[EMAIL]", display_email);
269}
270
271// static
272void LLPrefsChatImpl::onSpellAdd(void* data)
273{
274 LLPrefsChatImpl* panel = (LLPrefsChatImpl*)data;
275 if (panel)
276 {
277 glggHunSpell->addButton(panel->childGetValue("EmSpell_Avail").asString());
278 panel->refresh();
279 }
280}
281
282// static
283void LLPrefsChatImpl::onSpellRemove(void* data)
284{
285 LLPrefsChatImpl* panel = (LLPrefsChatImpl*)data;
286 if (panel)
287 {
288 glggHunSpell->removeButton(panel->childGetValue("EmSpell_Installed").asString());
289 panel->refresh();
290 }
291}
292
293// static
294void LLPrefsChatImpl::onSpellGetMore(void* data)
295{
296 glggHunSpell->getMoreButton(data);
297}
298
299// static
300void LLPrefsChatImpl::onSpellEditCustom(void* data)
301{
302 glggHunSpell->editCustomButton();
303}
304
305// static
306void LLPrefsChatImpl::onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata)
307{
308 LLComboBox* box = (LLComboBox*)ctrl;
309 if (box)
310 {
311 glggHunSpell->newDictSelection(box->getValue().asString());
312 }
313 LLPrefsChatImpl* panel = (LLPrefsChatImpl*)userdata;
314 if (panel)
315 {
316 panel->refresh();
317 }
318}
319
320// static
321void LLPrefsChatImpl::onAutoCorrectButton(void * data)
322{
323 lggAutoCorrectFloaterStart::show(TRUE,data);
324}
325
326// static
327void LLPrefsChatImpl::onClickCommandLine(void* data)
328{
329 FloaterCommandLine::getInstance()->open();
330 FloaterCommandLine::getInstance()->center();
331}
332
333//static
334void LLPrefsChatImpl::onCommitCheckBox(LLUICtrl* ctrl, void* user_data)
335{
336 LLPrefsChatImpl* self = (LLPrefsChatImpl*)user_data;
337 if (self)
338 {
339 self->refresh();
340 }
341}
342
343void LLPrefsChatImpl::initHelpBtn(const std::string& name, const std::string& xml_alert)
344{
345 childSetAction(name, onClickHelp, new std::string(xml_alert));
346}
347
348// static
349void LLPrefsChatImpl::onClickHelp(void* data)
350{
351 std::string* xml_alert = (std::string*)data;
352 LLNotifications::instance().add(*xml_alert);
176} 353}
177 354
178//--------------------------------------------------------------------------- 355//---------------------------------------------------------------------------
@@ -197,6 +374,11 @@ void LLPrefsChat::cancel()
197 impl.cancel(); 374 impl.cancel();
198} 375}
199 376
377void LLPrefsChat::setPersonalInfo(bool im_via_email, const std::string& email)
378{
379 impl.setPersonalInfo(im_via_email, email);
380}
381
200LLPanel* LLPrefsChat::getPanel() 382LLPanel* LLPrefsChat::getPanel()
201{ 383{
202 return &impl; 384 return &impl;