00001 00033 #ifndef LLMIMETYPES_H 00034 #define LLMIMETYPES_H 00035 00036 #include "llstring.h" // because XML parsing lib uses LLString, ugh 00037 #include <map> 00038 00039 class LLMIMETypes 00040 { 00041 public: 00042 static bool parseMIMETypes(const LLString& xml_file_path); 00043 // Loads the MIME string definition XML file, usually 00044 // from the application skins directory 00045 00046 static LLString translate(const LLString& mime_type); 00047 // Returns "QuickTime Movie" from "video/quicktime" 00048 00049 static LLString widgetType(const LLString& mime_type); 00050 // Type of control widgets for this MIME type 00051 // Returns "movie" from "video/quicktime" 00052 00053 static LLString implType(const LLString& mime_type); 00054 // Type of Impl to use for decoding media. 00055 00056 static LLString findIcon(const LLString& mime_type); 00057 // Icon from control widget type for this MIME type 00058 00059 static LLString findToolTip(const LLString& mime_type); 00060 // Tool tip from control widget type for this MIME type 00061 00062 static LLString findPlayTip(const LLString& mime_type); 00063 // Play button tool tip from control widget type for this MIME type 00064 00065 static LLString findDefaultMimeType(const LLString& widget_type); 00066 // Canonical mime type associated with this widget set 00067 00068 static bool findAllowResize(const LLString& mime_type); 00069 // accessor for flag to enable/disable media size edit fields 00070 00071 static bool findAllowLooping(const LLString& mime_type); 00072 // accessor for flag to enable/disable media looping checkbox 00073 00074 public: 00075 struct LLMIMEInfo 00076 { 00077 LLString mLabel; 00078 // friendly label like "QuickTime Movie" 00079 00080 LLString mWidgetType; 00081 // "web" means use web media UI widgets 00082 00083 LLString mImpl; 00084 // which impl to use with this mime type 00085 }; 00086 struct LLMIMEWidgetSet 00087 { 00088 LLString mLabel; 00089 // friendly label like "QuickTime Movie" 00090 00091 LLString mIcon; 00092 // Name of icon asset to display in toolbar 00093 00094 LLString mDefaultMimeType; 00095 // Mime type string to use in absence of a specific one 00096 00097 LLString mToolTip; 00098 // custom tool tip for this mime type 00099 00100 LLString mPlayTip; 00101 // custom tool tip to display for Play button 00102 00103 bool mAllowResize; 00104 // enable/disable media size edit fields 00105 00106 bool mAllowLooping; 00107 // enable/disable media looping checkbox 00108 }; 00109 typedef std::map< LLString, LLMIMEInfo > mime_info_map_t; 00110 typedef std::map< LLString, LLMIMEWidgetSet > mime_widget_set_map_t; 00111 00112 // Public so users can iterate over it 00113 static mime_info_map_t sMap; 00114 static mime_widget_set_map_t sWidgetMap; 00115 private: 00116 }; 00117 00118 #endif