diff options
Diffstat (limited to 'linden/indra/newview/llpanelgeneral.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgeneral.cpp | 238 |
1 files changed, 51 insertions, 187 deletions
diff --git a/linden/indra/newview/llpanelgeneral.cpp b/linden/indra/newview/llpanelgeneral.cpp index 6166ba5..f370116 100644 --- a/linden/indra/newview/llpanelgeneral.cpp +++ b/linden/indra/newview/llpanelgeneral.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2001-2008, Linden Research, Inc. | 7 | * Copyright (c) 2001-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -31,75 +31,15 @@ | |||
31 | 31 | ||
32 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
33 | 33 | ||
34 | //file include | ||
34 | #include "llpanelgeneral.h" | 35 | #include "llpanelgeneral.h" |
35 | 36 | ||
36 | // linden library includes | ||
37 | #include "llerror.h" | ||
38 | #include "llrect.h" | ||
39 | #include "llfontgl.h" | ||
40 | #include "message.h" | ||
41 | #include "lluictrlfactory.h" | ||
42 | |||
43 | // project includes | 37 | // project includes |
44 | #include "llagent.h" | ||
45 | #include "llviewerwindow.h" | ||
46 | #include "llcolorswatch.h" | 38 | #include "llcolorswatch.h" |
47 | #include "llcombobox.h" | 39 | #include "llcombobox.h" |
48 | #include "llconsole.h" | 40 | #include "lluictrlfactory.h" |
49 | #include "lllineeditor.h" | ||
50 | #include "llpanellogin.h" | ||
51 | #include "llnetmap.h" | ||
52 | #include "llresmgr.h" | ||
53 | #include "llspinctrl.h" | ||
54 | #include "lltextbox.h" | ||
55 | #include "llui.h" | ||
56 | #include "llurlsimstring.h" | 41 | #include "llurlsimstring.h" |
57 | #include "llviewercontrol.h" | 42 | #include "llviewercontrol.h" |
58 | #include "llurlsimstring.h" | ||
59 | |||
60 | #include "llcheckboxctrl.h" | ||
61 | #include "llradiogroup.h" | ||
62 | // | ||
63 | // Imported globals | ||
64 | // | ||
65 | |||
66 | void set_crash_behavior(LLUICtrl* ctrl, void* data); | ||
67 | void set_start_location(LLUICtrl* ctrl, void* data); | ||
68 | |||
69 | |||
70 | // | ||
71 | // Globals | ||
72 | // | ||
73 | |||
74 | // | ||
75 | // Static functions | ||
76 | // | ||
77 | static void set_render_name_fade_out(LLUICtrl* ctrl, void* data) | ||
78 | { | ||
79 | LLComboBox* combo = (LLComboBox*)ctrl; | ||
80 | if (!combo) return; | ||
81 | gSavedSettings.setS32("RenderName", combo->getCurrentIndex() ); | ||
82 | } | ||
83 | |||
84 | void set_crash_behavior(LLUICtrl* ctrl, void* data) | ||
85 | { | ||
86 | gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, ((LLComboBox*) ctrl)->getCurrentIndex()); | ||
87 | } | ||
88 | |||
89 | void set_language(LLUICtrl* ctrl, void* data) | ||
90 | { | ||
91 | gSavedSettings.setString("Language", ctrl->getValue().asString()); | ||
92 | } | ||
93 | |||
94 | void LLPanelGeneral::set_start_location(LLUICtrl* ctrl, void* data) | ||
95 | { | ||
96 | LLURLSimString::setString(ctrl->getValue().asString()); | ||
97 | } | ||
98 | |||
99 | void LLPanelGeneral::set_specific_start_location(LLLineEditor* line_editor, void* data) | ||
100 | { | ||
101 | LLURLSimString::setString(line_editor->getValue().asString()); | ||
102 | } | ||
103 | 43 | ||
104 | LLPanelGeneral::LLPanelGeneral() | 44 | LLPanelGeneral::LLPanelGeneral() |
105 | { | 45 | { |
@@ -108,51 +48,33 @@ LLPanelGeneral::LLPanelGeneral() | |||
108 | 48 | ||
109 | BOOL LLPanelGeneral::postBuild() | 49 | BOOL LLPanelGeneral::postBuild() |
110 | { | 50 | { |
111 | childSetCommitCallback("fade_out_combobox", set_render_name_fade_out); | 51 | LLComboBox* fade_out_combobox = getChild<LLComboBox>("fade_out_combobox"); |
112 | childSetAction("reset_ui_size", onClickResetUISize, this); | 52 | fade_out_combobox->setCurrentByIndex(gSavedSettings.getS32("RenderName")); |
113 | 53 | ||
114 | std::string region_name_prompt = getString("region_name_prompt"); | 54 | childSetValue("default_start_location", gSavedSettings.getBOOL("LoginLastLocation") ? "MyLastLocation" : "MyHome"); |
115 | 55 | childSetValue("show_location_checkbox", gSavedSettings.getBOOL("ShowStartLocation")); | |
116 | 56 | childSetValue("show_all_title_checkbox", gSavedSettings.getBOOL("RenderHideGroupTitleAll")); | |
117 | // location combobox | 57 | childSetValue("language_is_public", gSavedSettings.getBOOL("LanguageIsPublic")); |
118 | LLComboBox* combo = getChild<LLComboBox>( "location_combobox"); | 58 | |
119 | if (combo) | 59 | childSetValue("show_my_name_checkbox", gSavedSettings.getBOOL("RenderNameHideSelf")); |
120 | { | 60 | childSetValue("small_avatar_names_checkbox", gSavedSettings.getBOOL("SmallAvatarNames")); |
121 | if (!LLURLSimString::sInstance.mSimString.empty()) | 61 | childSetValue("show_my_title_checkbox", gSavedSettings.getBOOL("RenderHideGroupTitle")); |
122 | { | 62 | childSetValue("afk_timeout_spinner", gSavedSettings.getF32("AFKTimeout")); |
123 | combo->setTextEntry(LLURLSimString::sInstance.mSimString); | 63 | childSetValue("rotate_mini_map_checkbox", gSavedSettings.getBOOL("MiniMapRotate")); |
124 | } | 64 | childSetValue("notify_money_change_checkbox", gSavedSettings.getBOOL("NotifyMoneyChange")); |
125 | 65 | childSetValue("use_system_color_picker_checkbox", gSavedSettings.getBOOL("UseDefaultColorPicker")); | |
126 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); | 66 | childSetValue("show_search_panel", gSavedSettings.getBOOL("ShowSearchBar")); |
127 | if (!LLURLSimString::sInstance.mSimString.empty()) | 67 | |
128 | { | 68 | getChild<LLColorSwatchCtrl>("effect_color_swatch")->set(gSavedSettings.getColor4("EffectColor")); |
129 | combo->add( LLURLSimString::sInstance.mSimString ); | 69 | |
130 | combo->setCurrentByIndex( 2 ); | 70 | childSetValue("ui_scale_slider", gSavedSettings.getF32("UIScaleFactor")); |
131 | } | 71 | childSetValue("ui_auto_scale", gSavedSettings.getBOOL("UIAutoScale")); |
132 | else | 72 | |
133 | { | 73 | LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox"); |
134 | combo->add( region_name_prompt ); | 74 | crash_behavior_combobox->setCurrentByIndex(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING)); |
135 | combo->setCurrentByIndex( login_last ? 1 : 0 ); | ||
136 | } | ||
137 | combo->setCommitCallback( &set_start_location ); | ||
138 | combo->setTextEntryCallback( &set_specific_start_location ); | ||
139 | } | ||
140 | |||
141 | // Show location on login screen | ||
142 | childSetCommitCallback("show_location_checkbox", &LLPanelGeneral::clickShowStartLocation); | ||
143 | |||
144 | combo = getChild<LLComboBox>( "crash_behavior_combobox"); | ||
145 | if (combo) | ||
146 | { | ||
147 | combo->setCurrentByIndex( gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) ); | ||
148 | combo->setCommitCallback( &set_crash_behavior ); | ||
149 | } | ||
150 | 75 | ||
151 | childSetCommitCallback("language_combobox", set_language ); | ||
152 | childSetValue("language_combobox", gSavedSettings.getString("Language")); | 76 | childSetValue("language_combobox", gSavedSettings.getString("Language")); |
153 | 77 | ||
154 | refresh(); | ||
155 | |||
156 | return TRUE; | 78 | return TRUE; |
157 | } | 79 | } |
158 | 80 | ||
@@ -161,92 +83,34 @@ LLPanelGeneral::~LLPanelGeneral() | |||
161 | // Children all cleaned up by default view destructor. | 83 | // Children all cleaned up by default view destructor. |
162 | } | 84 | } |
163 | 85 | ||
164 | void LLPanelGeneral::refresh() | ||
165 | { | ||
166 | LLPanel::refresh(); | ||
167 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); | ||
168 | LLComboBox* combo = getChild<LLComboBox>( "location_combobox"); | ||
169 | if (combo) | ||
170 | { | ||
171 | if (!LLURLSimString::sInstance.mSimString.empty()) | ||
172 | { | ||
173 | combo->setCurrentByIndex( 2 ); | ||
174 | } | ||
175 | else | ||
176 | { | ||
177 | combo->setCurrentByIndex( login_last ? 1 : 0 ); | ||
178 | } | ||
179 | //save current settings in case cancel is clicked | ||
180 | mLoginLocation = combo->getValue().asString(); | ||
181 | } | ||
182 | |||
183 | mOldCrashBehavior = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); | ||
184 | combo = getChild<LLComboBox>( "crash_behavior_combobox"); | ||
185 | if (combo) | ||
186 | { | ||
187 | combo->setCurrentByIndex( mOldCrashBehavior ); | ||
188 | } | ||
189 | |||
190 | mRenderName = gSavedSettings.getS32("RenderName"); | ||
191 | combo = getChild<LLComboBox>("fade_out_combobox"); | ||
192 | if (combo) | ||
193 | { | ||
194 | combo->setCurrentByIndex( mRenderName ); | ||
195 | } | ||
196 | |||
197 | mRenderNameHideSelf = gSavedSettings.getBOOL("RenderNameHideSelf"); | ||
198 | mSmallAvatarNames = gSavedSettings.getBOOL("SmallAvatarNames"); | ||
199 | mRenderHideGroupTitle = gSavedSettings.getBOOL("RenderHideGroupTitle"); | ||
200 | mChatOnlineNotification = gSavedSettings.getBOOL("ChatOnlineNotification"); | ||
201 | mAFKTimeout = gSavedSettings.getF32("AFKTimeout"); | ||
202 | mMiniMapRotate = gSavedSettings.getBOOL("MiniMapRotate"); | ||
203 | mMiniMapTeleport = gSavedSettings.getBOOL("MiniMapTeleport"); | ||
204 | mNotifyMoney = gSavedSettings.getBOOL("NotifyMoneyChange"); | ||
205 | mUseDefaultColor = gSavedSettings.getBOOL("UseDefaultColorPicker"); | ||
206 | mEffectColor = gSavedSettings.getColor4("EffectColor"); | ||
207 | mShowSearch = gSavedSettings.getBOOL("ShowSearchBar"); | ||
208 | |||
209 | mUIScaleFactor = gSavedSettings.getF32("UIScaleFactor"); | ||
210 | mUIAutoScale = gSavedSettings.getBOOL("UIAutoScale"); | ||
211 | |||
212 | mLanguage = gSavedSettings.getString("Language"); | ||
213 | } | ||
214 | |||
215 | void LLPanelGeneral::apply() | 86 | void LLPanelGeneral::apply() |
216 | { | 87 | { |
217 | } | 88 | LLComboBox* fade_out_combobox = getChild<LLComboBox>("fade_out_combobox"); |
218 | 89 | gSavedSettings.setS32("RenderName", fade_out_combobox->getCurrentIndex()); | |
219 | void LLPanelGeneral::cancel() | ||
220 | { | ||
221 | gSavedSettings.setS32("RenderName", mRenderName); | ||
222 | gSavedSettings.setBOOL("RenderNameHideSelf", mRenderNameHideSelf ); | ||
223 | gSavedSettings.setBOOL("SmallAvatarNames", mSmallAvatarNames ); | ||
224 | gSavedSettings.setBOOL("RenderHideGroupTitle", mRenderHideGroupTitle ); | ||
225 | gSavedSettings.setBOOL("ChatOnlineNotification", mChatOnlineNotification ); | ||
226 | gSavedSettings.setF32("AFKTimeout", mAFKTimeout ); | ||
227 | gSavedSettings.setBOOL("MiniMapRotate", mMiniMapRotate ); | ||
228 | gSavedSettings.setBOOL("MiniMapTeleport", mMiniMapTeleport); | ||
229 | gSavedSettings.setBOOL("NotifyMoneyChange", mNotifyMoney ); | ||
230 | gSavedSettings.setBOOL("UseDefaultColorPicker", mUseDefaultColor ); | ||
231 | gSavedSettings.setBOOL("ShowSearchBar", mShowSearch); | ||
232 | gSavedSettings.setColor4("EffectColor", mEffectColor ); | ||
233 | gSavedSettings.setF32("UIScaleFactor", mUIScaleFactor); | ||
234 | gSavedSettings.setBOOL("UIAutoScale", mUIAutoScale); | ||
235 | gSavedSettings.setString("Language", mLanguage); | ||
236 | 90 | ||
237 | LLURLSimString::setString(mLoginLocation); | 91 | gSavedSettings.setBOOL("LoginLastLocation", childGetValue("default_start_location").asString() == "MyLastLocation"); |
238 | 92 | gSavedSettings.setBOOL("ShowStartLocation", childGetValue("show_location_checkbox")); | |
239 | gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, mOldCrashBehavior); | 93 | gSavedSettings.setBOOL("RenderHideGroupTitleAll", childGetValue("show_all_title_checkbox")); |
94 | gSavedSettings.setBOOL("LanguageIsPublic", childGetValue("language_is_public")); | ||
95 | gSavedSettings.setBOOL("RenderNameHideSelf", childGetValue("show_my_name_checkbox")); | ||
96 | gSavedSettings.setBOOL("SmallAvatarNames", childGetValue("small_avatar_names_checkbox")); | ||
97 | gSavedSettings.setBOOL("RenderHideGroupTitle", childGetValue("show_my_title_checkbox")); | ||
98 | gSavedSettings.setF32("AFKTimeout", childGetValue("afk_timeout_spinner").asReal()); | ||
99 | gSavedSettings.setBOOL("MiniMapRotate", childGetValue("rotate_mini_map_checkbox")); | ||
100 | gSavedSettings.setBOOL("NotifyMoneyChange", childGetValue("notify_money_change_checkbox")); | ||
101 | gSavedSettings.setBOOL("UseDefaultColorPicker", childGetValue("use_system_color_picker_checkbox")); | ||
102 | gSavedSettings.setBOOL("ShowSearchBar", childGetValue("show_search_panel")); | ||
103 | gSavedSettings.setColor4("EffectColor", childGetValue("effect_color_swatch")); | ||
104 | gSavedSettings.setF32("UIScaleFactor", childGetValue("ui_scale_slider").asReal()); | ||
105 | gSavedSettings.setBOOL("UIAutoScale", childGetValue("ui_auto_scale")); | ||
106 | gSavedSettings.setString("Language", childGetValue("language_combobox")); | ||
107 | |||
108 | LLURLSimString::setString(childGetValue("location_combobox")); | ||
109 | |||
110 | LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox"); | ||
111 | gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex()); | ||
240 | } | 112 | } |
241 | 113 | ||
242 | void LLPanelGeneral::clickShowStartLocation(LLUICtrl*, void* user_data) | 114 | void LLPanelGeneral::cancel() |
243 | { | ||
244 | LLPanelLogin::refreshLocation( false ); // in case LLPanelLogin is visible | ||
245 | } | ||
246 | |||
247 | // static | ||
248 | void LLPanelGeneral::onClickResetUISize(void* user_data) | ||
249 | { | 115 | { |
250 | gSavedSettings.setF32("UIScaleFactor", 1.0f); | ||
251 | gViewerWindow->reshape(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); | ||
252 | } | 116 | } |