llfloaterpreference.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**
  2. * @file llfloaterpreference.h
  3. * @brief LLPreferenceCore class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, 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. #include "lltabcontainer.h"
  41. class LLButton;
  42. class LLMessageSystem;
  43. class HBPanelGrids;
  44. class LLPrefSkins;
  45. class LLPrefsChat;
  46. class HBPrefsCool;
  47. class LLPrefsGeneral;
  48. class LLPrefsGraphics;
  49. class LLPrefsIM;
  50. class LLPrefsInput;
  51. class LLPrefsMedia;
  52. class LLPrefsNetwork;
  53. class LLPrefsNotifications;
  54. class LLPrefsVoice;
  55. class LLPreferenceCore
  56. {
  57. public:
  58. LLPreferenceCore(LLTabContainer* tab_container, LLButton* default_btn);
  59. ~LLPreferenceCore();
  60. void apply();
  61. void cancel();
  62. LL_INLINE LLTabContainer* getTabContainer() { return mTabContainer; }
  63. void setPersonalInfo(const std::string& visibility, bool im_via_email,
  64. const std::string& email, S32 verified);
  65. static void onTabChanged(void* user_data, bool from_click);
  66. private:
  67. LLTabContainer* mTabContainer;
  68. HBPanelGrids* mPrefsGrids;
  69. LLPrefSkins* mPrefsSkins;
  70. LLPrefsGeneral* mPrefsGeneral;
  71. LLPrefsGraphics* mPrefsGraphics;
  72. LLPrefsMedia* mPrefsMedia;
  73. LLPrefsNetwork* mPrefsNetwork;
  74. LLPrefsChat* mPrefsChat;
  75. HBPrefsCool* mPrefsCool;
  76. LLPrefsVoice* mPrefsVoice;
  77. LLPrefsIM* mPrefsIM;
  78. LLPrefsInput* mPrefsInput;
  79. LLPrefsNotifications* mPrefsNotifications;
  80. };
  81. // Floater to control preferences (display, audio, bandwidth, general.
  82. class LLFloaterPreference final
  83. : public LLFloater,
  84. public LLFloaterSingleton<LLFloaterPreference>
  85. {
  86. friend class LLUISingleton<LLFloaterPreference,
  87. VisibilityPolicy<LLFloater> >;
  88. protected:
  89. LOG_CLASS(LLFloaterPreference);
  90. public:
  91. ~LLFloaterPreference() override;
  92. bool postBuild() override;
  93. void onClose(bool app_quitting) override;
  94. void apply();
  95. void cancel();
  96. static void openInTab(S32 tab);
  97. // Static data update, called from message handler
  98. static void updateUserInfo(const std::string& visibility,
  99. bool im_via_email, const std::string& email,
  100. S32 verified = -1);
  101. // Refreshes all the graphics preferences menus
  102. static void refreshEnabledGraphics();
  103. // Keep this in sync with the tabs order in the floater
  104. enum PrefTabsIndexes {
  105. GENERAL_TAB = 0,
  106. INPUT_AND_CAMERA_TAB,
  107. NETWORK_AND_WEB_TAB,
  108. GRAPHICS_TAB,
  109. AUDIO_AND_MEDIA_TAB,
  110. TEXT_CHAT_TAB,
  111. IM_AND_LOGS_TAB,
  112. VOICE_CHAT_TAB,
  113. NOTIFICATIONS_TAB,
  114. SKINS_TAB,
  115. COOL_FEATURES_TAB,
  116. GRIDS_LIST_TAB,
  117. NUMBER_OF_TABS
  118. };
  119. protected:
  120. // Open only via either openInTab() or the LLFloaterSingleton interface
  121. // (i.e. showInstance() or toggleInstance()).
  122. LLFloaterPreference(const LLSD&);
  123. static void onClickAbout(void*);
  124. static void onBtnOK(void*);
  125. static void onBtnCancel(void*);
  126. static void onBtnApply(void*);
  127. protected:
  128. LLPreferenceCore* mPreferenceCore;
  129. LLButton* mAboutBtn;
  130. LLButton* mOKBtn;
  131. LLButton* mCancelBtn;
  132. LLButton* mApplyBtn;
  133. };
  134. #endif // LL_LLPREFERENCEFLOATER_H