hbfloatersoundslist.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /**
  2. * @file hbfloatersoundlist.h
  3. * @brief HBFloaterSoundsList class definition
  4. *
  5. * This class implements a floater where all sounds are listed, allowing
  6. * the user to mute a source or stop any sound.
  7. *
  8. * $LicenseInfo:firstyear=2014&license=viewergpl$
  9. *
  10. * Copyright (c) 2014, Henri Beauchamp.
  11. *
  12. * Second Life Viewer Source Code
  13. * The source code in this file ("Source Code") is provided by Linden Lab
  14. * to you under the terms of the GNU General Public License, version 2.0
  15. * ("GPL"), unless you have obtained a separate licensing agreement
  16. * ("Other License"), formally executed by you and Linden Lab. Terms of
  17. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  18. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  19. *
  20. * There are special exceptions to the terms and conditions of the GPL as
  21. * it is applied to this Source Code. View the full text of the exception
  22. * in the file doc/FLOSS-exception.txt in this software distribution, or
  23. * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  24. *
  25. * By copying, modifying or distributing this software, you acknowledge
  26. * that you have read and understood your obligations described above,
  27. * and agree to abide by those obligations.
  28. *
  29. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  30. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  31. * COMPLETENESS OR PERFORMANCE.
  32. * $/LicenseInfo$
  33. */
  34. #ifndef LL_HBFLOATERSOUNDSLIST_H
  35. #define LL_HBFLOATERSOUNDSLIST_H
  36. #include "llfloater.h"
  37. #include "llmutelist.h"
  38. class LLButton;
  39. class LLFlyoutButton;
  40. class LLCheckBoxCtrl;
  41. class LLMessageSystem;
  42. class LLScrollListCtrl;
  43. class LLVector3d;
  44. class HBFloaterSoundsList final
  45. : public LLFloater,
  46. public LLFloaterSingleton<HBFloaterSoundsList>,
  47. public LLMuteListObserver
  48. {
  49. friend class LLUISingleton<HBFloaterSoundsList,
  50. VisibilityPolicy<LLFloater> >;
  51. protected:
  52. LOG_CLASS(HBFloaterSoundsList);
  53. public:
  54. ~HBFloaterSoundsList() override;
  55. static LLVector3d selectedLocation();
  56. // Used in llviewermessage.cpp to inform us we changed region
  57. static void newRegion();
  58. static void processObjectPropertiesFamily(LLMessageSystem* msg);
  59. // Used as a callback to avatar name resolution, as well as in
  60. // hbviewerautomation.cpp when changing the blocked sounds list.
  61. static void setDirty();
  62. private:
  63. // Open only via LLFloaterSingleton interface, i.e. showInstance() or
  64. // toggleInstance().
  65. HBFloaterSoundsList(const LLSD&);
  66. bool postBuild() override;
  67. void draw() override;
  68. // LLMuteListObserver interface
  69. void onChange() override;
  70. void setButtonsStatus();
  71. void requestInfo(const LLUUID& object_id);
  72. static void onPlaySoundBtn(LLUICtrl* ctrl, void* userdata);
  73. static void onBlockSoundBtn(LLUICtrl* ctrl, void* userdata);
  74. static void onMuteOwnerBtn(void* userdata);
  75. static void onShowSourceBtn(LLUICtrl* ctrl,void* userdata);
  76. static void onMuteObjectBtn(LLUICtrl* ctrl, void* userdata);
  77. static void onDoubleClick(void* userdata);
  78. static void onSelectSound(LLUICtrl*, void* userdata);
  79. enum SOUNDS_COLUMN_ORDER
  80. {
  81. LIST_SOUND = 0,
  82. LIST_OBJECT,
  83. LIST_OWNER,
  84. LIST_SOURCE_ID,
  85. LIST_OBJECT_ID,
  86. LIST_OWNER_ID,
  87. };
  88. private:
  89. LLFlyoutButton* mPlayFlyoutBtn;
  90. LLFlyoutButton* mBlockSoundBtn;
  91. LLButton* mMuteOwnerBtn;
  92. LLFlyoutButton* mShowFlyoutBtn;
  93. LLFlyoutButton* mMuteFlyoutBtn;
  94. LLCheckBoxCtrl* mFreezeCheck;
  95. LLScrollListCtrl* mSoundsList;
  96. LLUUID mTrackingID;
  97. LLVector3d mTrackingLocation;
  98. LLVector3d mSelectedLocation;
  99. F32 mLastUpdate;
  100. bool mIsDirty;
  101. bool mTracking;
  102. std::string mNoneString;
  103. std::string mLoadingString;
  104. std::string mAttachmentString;
  105. uuid_list_t mIgnoredSounds;
  106. uuid_list_t mRequests;
  107. typedef fast_hmap<LLUUID, std::string> names_map_t;
  108. static names_map_t sObjectNames;
  109. typedef fast_hmap<LLUUID, LLUUID> groups_map_t;
  110. static groups_map_t sGroupOwnedObjects;
  111. };
  112. #endif // LL_HBFLOATERSOUNDSLIST_H