PageRenderTime 28ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llmimetypes.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 123 lines | 45 code | 27 blank | 51 comment | 0 complexity | a35c229103ecd31432ba592a00be0617 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llmimetypes.h
  3. * @brief Translates a MIME type like "video/quicktime" into a
  4. * localizable user-friendly string like "QuickTime Movie"
  5. *
  6. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LLMIMETYPES_H
  28. #define LLMIMETYPES_H
  29. #include <string>
  30. #include <map>
  31. class LLMIMETypes
  32. {
  33. public:
  34. static bool parseMIMETypes(const std::string& xml_file_path);
  35. // Loads the MIME string definition XML file, usually
  36. // from the application skins directory
  37. static std::string translate(const std::string& mime_type);
  38. // Returns "QuickTime Movie" from "video/quicktime"
  39. static std::string widgetType(const std::string& mime_type);
  40. // Type of control widgets for this MIME type
  41. // Returns "movie" from "video/quicktime"
  42. static std::string implType(const std::string& mime_type);
  43. // Type of Impl to use for decoding media.
  44. static std::string findIcon(const std::string& mime_type);
  45. // Icon from control widget type for this MIME type
  46. static std::string findToolTip(const std::string& mime_type);
  47. // Tool tip from control widget type for this MIME type
  48. static std::string findPlayTip(const std::string& mime_type);
  49. // Play button tool tip from control widget type for this MIME type
  50. static std::string findDefaultMimeType(const std::string& widget_type);
  51. // Canonical mime type associated with this widget set
  52. static const std::string& getDefaultMimeType();
  53. static const std::string& getDefaultMimeTypeTranslation();
  54. static bool findAllowResize(const std::string& mime_type);
  55. // accessor for flag to enable/disable media size edit fields
  56. static bool findAllowLooping(const std::string& mime_type);
  57. // accessor for flag to enable/disable media looping checkbox
  58. static bool isTypeHandled(const std::string& mime_type);
  59. // determines if the specific mime type is handled by the media system
  60. static void reload(void*);
  61. // re-loads the MIME types file from the file path last passed into parseMIMETypes
  62. public:
  63. struct LLMIMEInfo
  64. {
  65. std::string mLabel;
  66. // friendly label like "QuickTime Movie"
  67. std::string mWidgetType;
  68. // "web" means use web media UI widgets
  69. std::string mImpl;
  70. // which impl to use with this mime type
  71. };
  72. struct LLMIMEWidgetSet
  73. {
  74. std::string mLabel;
  75. // friendly label like "QuickTime Movie"
  76. std::string mIcon;
  77. // Name of icon asset to display in toolbar
  78. std::string mDefaultMimeType;
  79. // Mime type string to use in absence of a specific one
  80. std::string mToolTip;
  81. // custom tool tip for this mime type
  82. std::string mPlayTip;
  83. // custom tool tip to display for Play button
  84. BOOL mAllowResize;
  85. // enable/disable media size edit fields
  86. BOOL mAllowLooping;
  87. // enable/disable media looping checkbox
  88. };
  89. typedef std::map< std::string, LLMIMEInfo > mime_info_map_t;
  90. typedef std::map< std::string, LLMIMEWidgetSet > mime_widget_set_map_t;
  91. // Public so users can iterate over it
  92. static mime_info_map_t sMap;
  93. static mime_widget_set_map_t sWidgetMap;
  94. private:
  95. };
  96. #endif