Ejemplo n.º 1
0
void StringTranslation::EraseLocalized(const std::string &id)
{
	std::vector<std::string> keys;
	std::map<std::string,std::string> vals;

	if(m_localizedloaded==true)
	{
		m_localized.GetKeys(keys);

		for(std::vector<std::string>::const_iterator i=keys.begin(); i!=keys.end(); i++)
		{
			if((*i)!=id)
			{
				vals[(*i)]=GetLocalized((*i),"");
			}
		}

		m_localized.clear();

		for(std::map<std::string,std::string>::const_iterator i=vals.begin(); i!=vals.end(); i++)
		{
			SetLocalized((*i).first,(*i).second);
		}

	}
}
Ejemplo n.º 2
0
void CGUIDialogBoxBase::SetHeading(CVariant heading)
{
  std::string label = GetLocalized(heading);
  CSingleLock lock(m_section);
  if (label != m_strHeading)
  {
    m_strHeading = label;
    SetInvalid();
  }
}
Ejemplo n.º 3
0
void CGUIDialogBoxBase::SetText(CVariant text)
{
  std::string label = GetLocalized(text);
  CSingleLock lock(m_section);
  StringUtils::Trim(label, "\n");
  if (label != m_text)
  {
    m_text = label;
    SetInvalid();
  }
}
Ejemplo n.º 4
0
void CGUIDialogBoxBase::SetLine(unsigned int iLine, CVariant line)
{
  std::string label = GetLocalized(line);
  CSingleLock lock(m_section);
  std::vector<std::string> lines = StringUtils::Split(m_text, '\n');
  if (iLine >= lines.size())
    lines.resize(iLine+1);
  lines[iLine] = label;
  std::string text = StringUtils::Join(lines, "\n");
  SetText(text);
}
Ejemplo n.º 5
0
void CGUIDialogBoxBase::SetChoice(int iButton, const CVariant &choice) // iButton == 0 for no, 1 for yes
{
  if (iButton < 0 || iButton >= DIALOG_MAX_CHOICES)
    return;

  std::string label = GetLocalized(choice);
  CSingleLock lock(m_section);
  if (label != m_strChoices[iButton])
  {
    m_strChoices[iButton] = label;
    SetInvalid();
  }
}