Reduce calls to LLTrans::getString per frame.

Nicky 2013-03-26 20:45:50 +01:00
parent 29be06bbce
commit 240a78f7c0
2 changed files with 29 additions and 3 deletions

View File

@ -435,6 +435,12 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
mEditLandmarkTooltip = LLTrans::getString("LocationCtrlEditLandmarkTooltip");
mButton->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip"));
mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
// <FS:ND> Prevent querying LLTrans each frame
mTooltips.push_back( LLTrans::getString("LocationCtrlGeneralIconTooltip") );
mTooltips.push_back( LLTrans::getString("LocationCtrlAdultIconTooltip") );
mTooltips.push_back( LLTrans::getString("LocationCtrlModerateIconTooltip") );
// </FS:ND>
}
LLLocationInputCtrl::~LLLocationInputCtrl()
@ -990,17 +996,32 @@ void LLLocationInputCtrl::refreshMaturityButton()
{
case SIM_ACCESS_PG:
rating_image = mIconMaturityGeneral;
rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip");
// <FS:ND> Prevent querying LLTrans each frame
// rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip");
rating_tooltip = mTooltips[eGeneral];
// </FS:ND>
break;
case SIM_ACCESS_ADULT:
rating_image = mIconMaturityAdult;
rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip");
// <FS:ND> Prevent querying LLTrans each frame
// rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip");
rating_tooltip = mTooltips[eAdult];
// </FS:ND>
break;
case SIM_ACCESS_MATURE:
rating_image = mIconMaturityModerate;
rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip");
// <FS:ND> Prevent querying LLTrans each frame
// rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip");
rating_tooltip = mTooltips[eModerate];
// </FS:ND>
break;
default:

View File

@ -209,6 +209,11 @@ private:
// <FS:Zi> Pathfinding rebake functions
BOOL rebakeRegionCallback(const LLSD& notification,const LLSD& response);
// </FS:Zi>
// <FS:ND> Prevent querying LLTrans each frame
enum ETooltip{ eGeneral, eAdult, eModerate };
std::vector< std::string > mTooltips;
// </FS:ND>
};
#endif