PageRenderTime 36ms CodeModel.GetById 19ms app.highlight 13ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/llfloaterpreference.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 260 lines | 158 code | 47 blank | 55 comment | 0 complexity | ba8c3048c12efd0e4088c22480d72478 MD5 | raw file
  1/** 
  2 * @file llfloaterpreference.h
  3 * @brief LLPreferenceCore class definition
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27/*
 28 * App-wide preferences.  Note that these are not per-user,
 29 * because we need to load many preferences before we have
 30 * a login name.
 31 */
 32
 33#ifndef LL_LLFLOATERPREFERENCE_H
 34#define LL_LLFLOATERPREFERENCE_H
 35
 36#include "llfloater.h"
 37#include "llavatarpropertiesprocessor.h"
 38
 39class LLPanelPreference;
 40class LLPanelLCD;
 41class LLPanelDebug;
 42class LLMessageSystem;
 43class LLScrollListCtrl;
 44class LLSliderCtrl;
 45class LLSD;
 46class LLTextBox;
 47
 48typedef enum
 49	{
 50		GS_LOW_GRAPHICS,
 51		GS_MID_GRAPHICS,
 52		GS_HIGH_GRAPHICS,
 53		GS_ULTRA_GRAPHICS
 54		
 55	} EGraphicsSettings;
 56
 57
 58// Floater to control preferences (display, audio, bandwidth, general.
 59class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver
 60{
 61public: 
 62	LLFloaterPreference(const LLSD& key);
 63	~LLFloaterPreference();
 64
 65	void apply();
 66	void cancel();
 67	/*virtual*/ void draw();
 68	/*virtual*/ BOOL postBuild();
 69	/*virtual*/ void onOpen(const LLSD& key);
 70	/*virtual*/	void onClose(bool app_quitting);
 71
 72	// static data update, called from message handler
 73	static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email);
 74
 75	// refresh all the graphics preferences menus
 76	static void refreshEnabledGraphics();
 77	
 78	// translate user's busy response message according to current locale if message is default, otherwise do nothing
 79	static void initBusyResponse();
 80
 81	void processProperties( void* pData, EAvatarProcessorType type );
 82	void processProfileProperties(const LLAvatarData* pAvatarData );
 83	void storeAvatarProperties( const LLAvatarData* pAvatarData );
 84	void saveAvatarProperties( void );
 85
 86protected:	
 87	void		onBtnOK();
 88	void		onBtnCancel();
 89	void		onBtnApply();
 90
 91	void		onClickClearCache();			// Clear viewer texture cache, vfs, and VO cache on next startup
 92	void		onClickBrowserClearCache();		// Clear web history and caches as well as viewer caches above
 93	void		onLanguageChange();
 94	void		onNameTagOpacityChange(const LLSD& newvalue);
 95
 96	// set value of "BusyResponseChanged" in account settings depending on whether busy response
 97	// string differs from default after user changes.
 98	void onBusyResponseChanged();
 99	// if the custom settings box is clicked
100	void onChangeCustom();
101	void updateMeterText(LLUICtrl* ctrl);
102	void onOpenHardwareSettings();
103	// callback for defaults
104	void setHardwareDefaults();
105	// callback for when client turns on shaders
106	void onVertexShaderEnable();
107
108	// callback for commit in the "Single click on land" and "Double click on land" comboboxes.
109	void onClickActionChange();
110	// updates click/double-click action settings depending on controls values
111	void updateClickActionSettings();
112	// updates click/double-click action controls depending on values from settings.xml
113	void updateClickActionControls();
114	
115	// This function squirrels away the current values of the controls so that
116	// cancel() can restore them.	
117	void saveSettings();
118		
119
120public:
121
122	void setCacheLocation(const LLStringExplicit& location);
123
124	void onClickSetCache();
125	void onClickResetCache();
126	void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata);
127	void onSelectSkin();
128	void onClickSetKey();
129	void setKey(KEY key);
130	void onClickSetMiddleMouse();
131	void onClickSetSounds();
132//	void onClickSkipDialogs();
133//	void onClickResetDialogs();
134	void onClickEnablePopup();
135	void onClickDisablePopup();	
136	void resetAllIgnored();
137	void setAllIgnored();
138	void onClickLogPath();	
139	void enableHistory();
140	void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
141	void refreshEnabledState();
142	void disableUnavailableSettings();
143	void onCommitWindowedMode();
144	void refresh();	// Refresh enable/disable
145	// if the quality radio buttons are changed
146	void onChangeQuality(const LLSD& data);
147	
148	void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box);
149	void onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name);
150//	void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator);
151
152	void onCommitParcelMediaAutoPlayEnable();
153	void onCommitMediaEnabled();
154	void onCommitMusicEnabled();
155	void applyResolution();
156	void onChangeMaturity();
157	void onClickBlockList();
158	void onClickProxySettings();
159	void onClickTranslationSettings();
160	void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
161	void getUIColor(LLUICtrl* ctrl, const LLSD& param);
162	
163	void buildPopupLists();
164	static void refreshSkin(void* data);
165private:
166	static std::string sSkin;
167	bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user.
168	bool mGotPersonalInfo;
169	bool mOriginalIMViaEmail;
170	bool mLanguageChanged;
171	bool mAvatarDataInitialized;
172	
173	bool mOriginalHideOnlineStatus;
174	std::string mDirectoryVisibility;
175	
176	LLAvatarData mAvatarProperties;
177};
178
179class LLPanelPreference : public LLPanel
180{
181public:
182	LLPanelPreference();
183	/*virtual*/ BOOL postBuild();
184	
185	virtual ~LLPanelPreference();
186
187	virtual void apply();
188	virtual void cancel();
189	void setControlFalse(const LLSD& user_data);
190	virtual void setHardwareDefaults(){};
191
192	// Disables "Allow Media to auto play" check box only when both
193	// "Streaming Music" and "Media" are unchecked. Otherwise enables it.
194	void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl);
195
196	// This function squirrels away the current values of the controls so that
197	// cancel() can restore them.
198	virtual void saveSettings();
199	
200	class Updater;
201private:
202	//for "Only friends and groups can call or IM me"
203	static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
204	//for "Show my Favorite Landmarks at Login"
205	static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value);
206
207	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
208	control_values_map_t mSavedValues;
209
210	typedef std::map<std::string, LLColor4> string_color_map_t;
211	string_color_map_t mSavedColors;
212
213	Updater* mBandWidthUpdater;
214};
215
216class LLPanelPreferenceGraphics : public LLPanelPreference
217{
218public:
219	BOOL postBuild();
220	void draw();
221	void apply();
222	void cancel();
223	void saveSettings();
224	void setHardwareDefaults();
225protected:
226	bool hasDirtyChilds();
227	void resetDirtyChilds();
228	
229};
230
231class LLFloaterPreferenceProxy : public LLFloater
232{
233public: 
234	LLFloaterPreferenceProxy(const LLSD& key);
235	~LLFloaterPreferenceProxy();
236
237	/// show off our menu
238	static void show();
239	void cancel();
240	
241protected:
242	BOOL postBuild();
243	void onOpen(const LLSD& key);
244	void onClose(bool app_quitting);
245	void saveSettings();
246	void onBtnOk();
247	void onBtnCancel();
248
249	void onChangeSocksSettings();
250
251private:
252	
253	bool mSocksSettingsDirty;
254	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
255	control_values_map_t mSavedValues;
256
257};
258
259
260#endif  // LL_LLPREFERENCEFLOATER_H