llfloaterpreference.h
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:5k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llfloaterpreference.h
  3.  * @brief LLPreferenceCore class definition
  4.  *
  5.  * $LicenseInfo:firstyear=2002&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2002-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. /*
  33.  * App-wide preferences.  Note that these are not per-user,
  34.  * because we need to load many preferences before we have
  35.  * a login name.
  36.  */
  37. #ifndef LL_LLFLOATERPREFERENCE_H
  38. #define LL_LLFLOATERPREFERENCE_H
  39. #include "llfloater.h"
  40. class LLPanelPreference;
  41. class LLPanelLCD;
  42. class LLPanelDebug;
  43. class LLMessageSystem;
  44. class LLScrollListCtrl;
  45. class LLSliderCtrl;
  46. class LLSD;
  47. class LLTextBox;
  48. typedef enum
  49. {
  50. GS_LOW_GRAPHICS,
  51. GS_MID_GRAPHICS,
  52. GS_HIGH_GRAPHICS,
  53. GS_ULTRA_GRAPHICS
  54. } EGraphicsSettings;
  55. // Floater to control preferences (display, audio, bandwidth, general.
  56. class LLFloaterPreference : public LLFloater
  57. {
  58. public: 
  59. LLFloaterPreference(const LLSD& key);
  60. ~LLFloaterPreference();
  61. void apply();
  62. void cancel();
  63. /*virtual*/ void draw();
  64. /*virtual*/ BOOL postBuild();
  65. /*virtual*/ void onOpen(const LLSD& key);
  66. /*virtual*/ void onClose(bool app_quitting);
  67. // static data update, called from message handler
  68. static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email);
  69. // refresh all the graphics preferences menus
  70. static void refreshEnabledGraphics();
  71. protected:
  72. void onBtnOK();
  73. void onBtnCancel();
  74. void onBtnApply();
  75. void onClickBrowserClearCache();
  76. // if the custom settings box is clicked
  77. void onChangeCustom();
  78. void updateMeterText(LLUICtrl* ctrl);
  79. void onOpenHardwareSettings();
  80. /// callback for defaults
  81. void setHardwareDefaults();
  82. // callback for when client turns on shaders
  83. void onVertexShaderEnable();
  84. // This function squirrels away the current values of the controls so that
  85. // cancel() can restore them.
  86. void saveSettings();
  87. public:
  88. void onClickSetCache();
  89. void onClickResetCache();
  90. void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata);
  91. void onSelectSkin();
  92. void onClickSetKey();
  93. void setKey(KEY key);
  94. void onClickSetMiddleMouse();
  95. // void onClickSkipDialogs();
  96. // void onClickResetDialogs();
  97. void onClickEnablePopup();
  98. void onClickDisablePopup();
  99. void resetAllIgnored();
  100. void setAllIgnored();
  101. void onClickLogPath();
  102. void enableHistory();
  103. void setPersonalInfo(const std::string& visibility, bool im_via_email, const std::string& email);
  104. void refreshEnabledState();
  105. void disableUnavailableSettings();
  106. void onCommitWindowedMode();
  107. void refresh(); // Refresh enable/disable
  108. // if the quality radio buttons are changed
  109. void onChangeQuality(const LLSD& data);
  110. void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box);
  111. void onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name);
  112. // void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator);
  113. void onCommitParcelMediaAutoPlayEnable();
  114. void onCommitMediaEnabled();
  115. void onCommitMusicEnabled();
  116. void applyResolution();
  117. void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
  118. void getUIColor(LLUICtrl* ctrl, const LLSD& param);
  119. void buildPopupLists();
  120. static void refreshSkin(void* data);
  121. static void cleanupBadSetting();
  122. private:
  123. static std::string sSkin;
  124. bool mGotPersonalInfo;
  125. bool mOriginalIMViaEmail;
  126. bool mOriginalHideOnlineStatus;
  127. std::string mDirectoryVisibility;
  128. };
  129. class LLPanelPreference : public LLPanel
  130. {
  131. public:
  132. LLPanelPreference();
  133. /*virtual*/ BOOL postBuild();
  134. virtual void apply();
  135. virtual void cancel();
  136. void setControlFalse(const LLSD& user_data);
  137. virtual void setHardwareDefaults(){};
  138. // This function squirrels away the current values of the controls so that
  139. // cancel() can restore them.
  140. virtual void saveSettings();
  141. private:
  142. //for "Only friends and groups can call or IM me"
  143. static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
  144. typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
  145. control_values_map_t mSavedValues;
  146. typedef std::map<std::string, LLColor4> string_color_map_t;
  147. string_color_map_t mSavedColors;
  148. };
  149. class LLPanelPreferenceGraphics : public LLPanelPreference
  150. {
  151. public:
  152. BOOL postBuild();
  153. void draw();
  154. void apply();
  155. void cancel();
  156. void saveSettings();
  157. void setHardwareDefaults();
  158. protected:
  159. bool hasDirtyChilds();
  160. void resetDirtyChilds();
  161. };
  162. #endif  // LL_LLPREFERENCEFLOATER_H