PageRenderTime 35ms CodeModel.GetById 2ms app.highlight 25ms RepoModel.GetById 2ms 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
  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
 28#ifndef LLMIMETYPES_H
 29#define LLMIMETYPES_H
 30
 31#include <string>
 32#include <map>
 33
 34class LLMIMETypes
 35{
 36public:
 37	static bool parseMIMETypes(const std::string& xml_file_path);
 38		// Loads the MIME string definition XML file, usually
 39		// from the application skins directory
 40
 41	static std::string translate(const std::string& mime_type);
 42		// Returns "QuickTime Movie" from "video/quicktime"
 43
 44	static std::string widgetType(const std::string& mime_type);
 45		// Type of control widgets for this MIME type
 46		// Returns "movie" from "video/quicktime"
 47
 48	static std::string implType(const std::string& mime_type);
 49		// Type of Impl to use for decoding media.
 50
 51	static std::string findIcon(const std::string& mime_type);
 52		// Icon from control widget type for this MIME type
 53
 54	static std::string findToolTip(const std::string& mime_type);
 55		// Tool tip from control widget type for this MIME type
 56
 57	static std::string findPlayTip(const std::string& mime_type);
 58		// Play button tool tip from control widget type for this MIME type
 59
 60	static std::string findDefaultMimeType(const std::string& widget_type);
 61		// Canonical mime type associated with this widget set
 62
 63	static const std::string& getDefaultMimeType();
 64
 65	static const std::string& getDefaultMimeTypeTranslation();
 66
 67	static bool findAllowResize(const std::string& mime_type);
 68		// accessor for flag to enable/disable media size edit fields
 69
 70	static bool findAllowLooping(const std::string& mime_type);
 71		// accessor for flag to enable/disable media looping checkbox
 72
 73	static bool isTypeHandled(const std::string& mime_type);
 74		// determines if the specific mime type is handled by the media system
 75
 76	static void reload(void*);
 77		// re-loads the MIME types file from the file path last passed into parseMIMETypes
 78
 79public:
 80	struct LLMIMEInfo
 81	{
 82		std::string mLabel;
 83			// friendly label like "QuickTime Movie"
 84
 85		std::string mWidgetType;
 86			// "web" means use web media UI widgets
 87
 88		std::string mImpl;
 89			// which impl to use with this mime type
 90	};
 91	struct LLMIMEWidgetSet
 92	{
 93		std::string mLabel;
 94			// friendly label like "QuickTime Movie"
 95
 96		std::string mIcon;
 97			// Name of icon asset to display in toolbar
 98
 99		std::string mDefaultMimeType;
100			// Mime type string to use in absence of a specific one
101
102		std::string mToolTip;
103			// custom tool tip for this mime type
104
105		std::string mPlayTip;
106			// custom tool tip to display for Play button
107
108		BOOL mAllowResize;
109			// enable/disable media size edit fields
110
111		BOOL mAllowLooping;
112			// enable/disable media looping checkbox
113	};
114	typedef std::map< std::string, LLMIMEInfo > mime_info_map_t;
115	typedef std::map< std::string, LLMIMEWidgetSet > mime_widget_set_map_t;
116
117	// Public so users can iterate over it
118	static mime_info_map_t sMap;
119	static mime_widget_set_map_t sWidgetMap;
120private:
121};
122
123#endif