PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. * App-wide preferences. Note that these are not per-user,
  28. * because we need to load many preferences before we have
  29. * a login name.
  30. */
  31. #ifndef LL_LLFLOATERPREFERENCE_H
  32. #define LL_LLFLOATERPREFERENCE_H
  33. #include "llfloater.h"
  34. #include "llavatarpropertiesprocessor.h"
  35. class LLPanelPreference;
  36. class LLPanelLCD;
  37. class LLPanelDebug;
  38. class LLMessageSystem;
  39. class LLScrollListCtrl;
  40. class LLSliderCtrl;
  41. class LLSD;
  42. class LLTextBox;
  43. typedef enum
  44. {
  45. GS_LOW_GRAPHICS,
  46. GS_MID_GRAPHICS,
  47. GS_HIGH_GRAPHICS,
  48. GS_ULTRA_GRAPHICS
  49. } EGraphicsSettings;
  50. // Floater to control preferences (display, audio, bandwidth, general.
  51. class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver
  52. {
  53. public:
  54. LLFloaterPreference(const LLSD& key);
  55. ~LLFloaterPreference();
  56. void apply();
  57. void cancel();
  58. /*virtual*/ void draw();
  59. /*virtual*/ BOOL postBuild();
  60. /*virtual*/ void onOpen(const LLSD& key);
  61. /*virtual*/ void onClose(bool app_quitting);
  62. // static data update, called from message handler
  63. static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email);
  64. // refresh all the graphics preferences menus
  65. static void refreshEnabledGraphics();
  66. // translate user's busy response message according to current locale if message is default, otherwise do nothing
  67. static void initBusyResponse();
  68. void processProperties( void* pData, EAvatarProcessorType type );
  69. void processProfileProperties(const LLAvatarData* pAvatarData );
  70. void storeAvatarProperties( const LLAvatarData* pAvatarData );
  71. void saveAvatarProperties( void );
  72. protected:
  73. void onBtnOK();
  74. void onBtnCancel();
  75. void onBtnApply();
  76. void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup
  77. void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above
  78. void onLanguageChange();
  79. void onNameTagOpacityChange(const LLSD& newvalue);
  80. // set value of "BusyResponseChanged" in account settings depending on whether busy response
  81. // string differs from default after user changes.
  82. void onBusyResponseChanged();
  83. // if the custom settings box is clicked
  84. void onChangeCustom();
  85. void updateMeterText(LLUICtrl* ctrl);
  86. void onOpenHardwareSettings();
  87. // callback for defaults
  88. void setHardwareDefaults();
  89. // callback for when client turns on shaders
  90. void onVertexShaderEnable();
  91. // callback for commit in the "Single click on land" and "Double click on land" comboboxes.
  92. void onClickActionChange();
  93. // updates click/double-click action settings depending on controls values
  94. void updateClickActionSettings();
  95. // updates click/double-click action controls depending on values from settings.xml
  96. void updateClickActionControls();
  97. // This function squirrels away the current values of the controls so that
  98. // cancel() can restore them.
  99. void saveSettings();
  100. public:
  101. void setCacheLocation(const LLStringExplicit& location);
  102. void onClickSetCache();
  103. void onClickResetCache();
  104. void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata);
  105. void onSelectSkin();
  106. void onClickSetKey();
  107. void setKey(KEY key);
  108. void onClickSetMiddleMouse();
  109. void onClickSetSounds();
  110. // void onClickSkipDialogs();
  111. // void onClickResetDialogs();
  112. void onClickEnablePopup();
  113. void onClickDisablePopup();
  114. void resetAllIgnored();
  115. void setAllIgnored();
  116. void onClickLogPath();
  117. void enableHistory();
  118. void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
  119. void refreshEnabledState();
  120. void disableUnavailableSettings();
  121. void onCommitWindowedMode();
  122. void refresh(); // Refresh enable/disable
  123. // if the quality radio buttons are changed
  124. void onChangeQuality(const LLSD& data);
  125. void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box);
  126. void onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name);
  127. // void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator);
  128. void onCommitParcelMediaAutoPlayEnable();
  129. void onCommitMediaEnabled();
  130. void onCommitMusicEnabled();
  131. void applyResolution();
  132. void onChangeMaturity();
  133. void onClickBlockList();
  134. void onClickProxySettings();
  135. void onClickTranslationSettings();
  136. void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
  137. void getUIColor(LLUICtrl* ctrl, const LLSD& param);
  138. void buildPopupLists();
  139. static void refreshSkin(void* data);
  140. private:
  141. static std::string sSkin;
  142. bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user.
  143. bool mGotPersonalInfo;
  144. bool mOriginalIMViaEmail;
  145. bool mLanguageChanged;
  146. bool mAvatarDataInitialized;
  147. bool mOriginalHideOnlineStatus;
  148. std::string mDirectoryVisibility;
  149. LLAvatarData mAvatarProperties;
  150. };
  151. class LLPanelPreference : public LLPanel
  152. {
  153. public:
  154. LLPanelPreference();
  155. /*virtual*/ BOOL postBuild();
  156. virtual ~LLPanelPreference();
  157. virtual void apply();
  158. virtual void cancel();
  159. void setControlFalse(const LLSD& user_data);
  160. virtual void setHardwareDefaults(){};
  161. // Disables "Allow Media to auto play" check box only when both
  162. // "Streaming Music" and "Media" are unchecked. Otherwise enables it.
  163. void updateMediaAutoPlayCheckbox(LLUICtrl* ctrl);
  164. // This function squirrels away the current values of the controls so that
  165. // cancel() can restore them.
  166. virtual void saveSettings();
  167. class Updater;
  168. private:
  169. //for "Only friends and groups can call or IM me"
  170. static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
  171. //for "Show my Favorite Landmarks at Login"
  172. static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value);
  173. typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
  174. control_values_map_t mSavedValues;
  175. typedef std::map<std::string, LLColor4> string_color_map_t;
  176. string_color_map_t mSavedColors;
  177. Updater* mBandWidthUpdater;
  178. };
  179. class LLPanelPreferenceGraphics : public LLPanelPreference
  180. {
  181. public:
  182. BOOL postBuild();
  183. void draw();
  184. void apply();
  185. void cancel();
  186. void saveSettings();
  187. void setHardwareDefaults();
  188. protected:
  189. bool hasDirtyChilds();
  190. void resetDirtyChilds();
  191. };
  192. class LLFloaterPreferenceProxy : public LLFloater
  193. {
  194. public:
  195. LLFloaterPreferenceProxy(const LLSD& key);
  196. ~LLFloaterPreferenceProxy();
  197. /// show off our menu
  198. static void show();
  199. void cancel();
  200. protected:
  201. BOOL postBuild();
  202. void onOpen(const LLSD& key);
  203. void onClose(bool app_quitting);
  204. void saveSettings();
  205. void onBtnOk();
  206. void onBtnCancel();
  207. void onChangeSocksSettings();
  208. private:
  209. bool mSocksSettingsDirty;
  210. typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
  211. control_values_map_t mSavedValues;
  212. };
  213. #endif // LL_LLPREFERENCEFLOATER_H