summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2010-04-20 11:11:33 +0300
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2010-04-20 11:11:33 +0300
commit1ce1e7f9a121cad473c84fced770837da9e6e55c (patch)
tree3d55075efa3ec41e8e7037de96338a9213537114
parent53e4718a460f3d0c421d93296d35974f95bc77fb (diff)
Fixed EXT-6542(normal) - [HARD CODED] - Land-Info, Medien: none/none needs to be localized
Added "DefaultMimeType" string to strings.xml to make "none/none" mime type localizable. Replaced all occurrences of "none/none" string with call to static method. Reviewed by Vadim Savchuk - https://codereview.productengine.com/secondlife/r/265/ --HG-- branch : product-engine
-rw-r--r--indra/newview/llfloaterauction.cpp3
-rw-r--r--indra/newview/llfloaterurlentry.cpp5
-rw-r--r--indra/newview/llmimetypes.cpp16
-rw-r--r--indra/newview/llmimetypes.h4
-rw-r--r--indra/newview/llpanellandmedia.cpp17
-rw-r--r--indra/newview/llviewermedia.cpp2
-rw-r--r--indra/newview/llviewerparcelmedia.cpp7
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.cpp3
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml4
9 files changed, 46 insertions, 15 deletions
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index 698ccec9c1..679ab4c713 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -46,6 +46,7 @@
#include "llagent.h"
#include "llcombobox.h"
+#include "llmimetypes.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llsavedsettingsglue.h"
@@ -351,7 +352,7 @@ void LLFloaterAuction::doResetParcel()
body["music_url"] = empty;
body["media_url"] = empty;
body["media_desc"] = empty;
- body["media_type"] = std::string("none/none");
+ body["media_type"] = LLMIMETypes::getDefaultMimeType();
body["media_width"] = (S32) 0;
body["media_height"] = (S32) 0;
body["auto_scale"] = (S32) 0;
diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp
index 91d0f0e370..002d417e4c 100644
--- a/indra/newview/llfloaterurlentry.cpp
+++ b/indra/newview/llfloaterurlentry.cpp
@@ -40,6 +40,7 @@
#include "llpanelface.h"
#include "llcombobox.h"
+#include "llmimetypes.h"
#include "llnotificationsutil.h"
#include "llurlhistory.h"
#include "lluictrlfactory.h"
@@ -71,14 +72,14 @@ public:
virtual void error( U32 status, const std::string& reason )
{
- completeAny(status, "none/none");
+ completeAny(status, LLMIMETypes::getDefaultMimeType());
}
void completeAny(U32 status, const std::string& mime_type)
{
// Set empty type to none/none. Empty string is reserved for legacy parcels
// which have no mime type set.
- std::string resolved_mime_type = ! mime_type.empty() ? mime_type : "none/none";
+ std::string resolved_mime_type = ! mime_type.empty() ? mime_type : LLMIMETypes::getDefaultMimeType();
LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mParent.get();
if ( floater_url_entry )
floater_url_entry->headerFetchComplete( status, resolved_mime_type );
diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp
index 235487cf46..7bddc0d84c 100644
--- a/indra/newview/llmimetypes.cpp
+++ b/indra/newview/llmimetypes.cpp
@@ -34,6 +34,7 @@
#include "llviewerprecompiledheaders.h"
#include "llmimetypes.h"
+#include "lltrans.h"
#include "llxmlnode.h"
#include "lluictrlfactory.h"
@@ -49,6 +50,7 @@ std::string sDefaultImpl;
// Returned when we don't know what impl to use
std::string sXMLFilename;
// Squirrel away XML filename so we know how to reset
+std::string DEFAULT_MIME_TYPE = "none/none";
/////////////////////////////////////////////////////////////////////////////
@@ -212,7 +214,7 @@ std::string LLMIMETypes::findIcon(const std::string& mime_type)
// static
std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type)
{
- std::string mime_type = "none/none";
+ std::string mime_type = getDefaultMimeType();
mime_widget_set_map_t::iterator it = sWidgetMap.find(widget_type);
if(it != sWidgetMap.end())
{
@@ -222,6 +224,18 @@ std::string LLMIMETypes::findDefaultMimeType(const std::string& widget_type)
}
// static
+const std::string& LLMIMETypes::getDefaultMimeType()
+{
+ return DEFAULT_MIME_TYPE;
+}
+
+const std::string& LLMIMETypes::getDefaultMimeTypeTranslation()
+{
+ static std::string mime_type = LLTrans::getString("DefaultMimeType");
+ return mime_type;
+}
+
+// static
std::string LLMIMETypes::findToolTip(const std::string& mime_type)
{
std::string tool_tip = "";
diff --git a/indra/newview/llmimetypes.h b/indra/newview/llmimetypes.h
index b217ce7a81..3461769ff3 100644
--- a/indra/newview/llmimetypes.h
+++ b/indra/newview/llmimetypes.h
@@ -66,6 +66,10 @@ public:
static std::string findDefaultMimeType(const std::string& widget_type);
// Canonical mime type associated with this widget set
+ static const std::string& getDefaultMimeType();
+
+ static const std::string& getDefaultMimeTypeTranslation();
+
static bool findAllowResize(const std::string& mime_type);
// accessor for flag to enable/disable media size edit fields
diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp
index 42ad9820a8..e834e229cd 100644
--- a/indra/newview/llpanellandmedia.cpp
+++ b/indra/newview/llpanellandmedia.cpp
@@ -153,7 +153,7 @@ void LLPanelLandMedia::refresh()
std::string mime_type = parcel->getMediaType();
if (mime_type.empty())
{
- mime_type = "none/none";
+ mime_type = LLMIMETypes::getDefaultMimeTypeTranslation();
}
setMediaType(mime_type);
mMediaTypeCombo->setEnabled( can_change_media );
@@ -218,7 +218,7 @@ void LLPanelLandMedia::refresh()
void LLPanelLandMedia::populateMIMECombo()
{
- std::string default_mime_type = "none/none";
+ std::string default_mime_type = LLMIMETypes::getDefaultMimeType();
std::string default_label;
LLMIMETypes::mime_widget_set_map_t::const_iterator it;
for (it = LLMIMETypes::sWidgetMap.begin(); it != LLMIMETypes::sWidgetMap.end(); ++it)
@@ -235,8 +235,7 @@ void LLPanelLandMedia::populateMIMECombo()
mMediaTypeCombo->add(info.mLabel, mime_type);
}
}
- // *TODO: The sort order is based on std::map key, which is
- // ASCII-sorted and is wrong in other languages. TRANSLATE
+
mMediaTypeCombo->add( default_label, default_mime_type, ADD_BOTTOM );
}
@@ -248,7 +247,15 @@ void LLPanelLandMedia::setMediaType(const std::string& mime_type)
std::string media_key = LLMIMETypes::widgetType(mime_type);
mMediaTypeCombo->setValue(media_key);
- childSetText("mime_type", mime_type);
+
+ std::string mime_str = mime_type;
+ if(LLMIMETypes::getDefaultMimeType() == mime_type)
+ {
+ // Instead of showing predefined "none/none" we are going to show something
+ // localizable - "none" for example (see EXT-6542)
+ mime_str = LLMIMETypes::getDefaultMimeTypeTranslation();
+ }
+ childSetText("mime_type", mime_str);
}
void LLPanelLandMedia::setMediaURL(const std::string& media_url)
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 58138d9917..3c0345df90 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2245,7 +2245,7 @@ void LLViewerMediaImpl::navigateInternal()
// This helps in supporting legacy media content where the server the media resides on returns a bogus MIME type
// but the parcel owner has correctly set the MIME type in the parcel media settings.
- if(!mMimeType.empty() && (mMimeType != "none/none"))
+ if(!mMimeType.empty() && (mMimeType != LLMIMETypes::getDefaultMimeType()))
{
std::string plugin_basename = LLMIMETypes::implType(mMimeType);
if(!plugin_basename.empty())
diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp
index b967436df6..202f8822e3 100644
--- a/indra/newview/llviewerparcelmedia.cpp
+++ b/indra/newview/llviewerparcelmedia.cpp
@@ -35,6 +35,7 @@
#include "llagent.h"
#include "llaudioengine.h"
+#include "llmimetypes.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
#include "llviewerregion.h"
@@ -212,7 +213,7 @@ void LLViewerParcelMedia::play(LLParcel* parcel)
}
// Don't ever try to play if the media type is set to "none/none"
- if(stricmp(mime_type.c_str(), "none/none") != 0)
+ if(stricmp(mime_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
{
if(!sMediaImpl)
{
@@ -306,7 +307,7 @@ LLPluginClassMediaOwner::EMediaStatus LLViewerParcelMedia::getStatus()
// static
std::string LLViewerParcelMedia::getMimeType()
{
- return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : "none/none";
+ return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : LLMIMETypes::getDefaultMimeType();
}
//static
@@ -316,7 +317,7 @@ std::string LLViewerParcelMedia::getURL()
if(sMediaImpl.notNull())
url = sMediaImpl->getMediaURL();
- if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), "none/none") != 0)
+ if(stricmp(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaType().c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0)
{
if (url.empty())
url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL();
diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp
index f55d6d89c4..032ad6635a 100644
--- a/indra/newview/llviewerparcelmediaautoplay.cpp
+++ b/indra/newview/llviewerparcelmediaautoplay.cpp
@@ -42,6 +42,7 @@
#include "message.h"
#include "llviewertexturelist.h" // for texture stats
#include "llagent.h"
+#include "llmimetypes.h"
const F32 AUTOPLAY_TIME = 5; // how many seconds before we autoplay
const F32 AUTOPLAY_SIZE = 24*24; // how big the texture must be (pixel area) before we autoplay
@@ -126,7 +127,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
if ((!mPlayed) && // if we've never played
(mTimeInParcel > AUTOPLAY_TIME) && // and if we've been here for so many seconds
(!this_media_url.empty()) && // and if the parcel has media
- (stricmp(this_media_type.c_str(), "none/none") != 0) &&
+ (stricmp(this_media_type.c_str(), LLMIMETypes::getDefaultMimeType().c_str()) != 0) &&
(LLViewerParcelMedia::sMediaImpl.isNull())) // and if the media is not already playing
{
if (this_media_texture_id.notNull()) // and if the media texture is good
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index df4e4153f4..a480266b5a 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3106,5 +3106,7 @@ Abuse Report</string>
<!-- birth date format shared by avatar inspector and profile panels -->
<string name="AvatarBirthDateFormat">[mthnum,datetime,slt]/[day,datetime,slt]/[year,datetime,slt]</string>
+
+ <string name="DefaultMimeType">none/none</string>
-</strings>
+ </strings>