void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character
{
  CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT));
  if (pEdit)
  {
    CStdStringW edit = m_strEdit;
    if (m_hiddenInput)
    { // convert to *'s
      edit.Empty();
      if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > CTimeUtils::GetFrameTime() && m_strEdit.size())
      { // using the remove to input, so display the last key input
        edit.append(m_strEdit.size() - 1, L'*');
        edit.append(1, m_strEdit[m_strEdit.size() - 1]);
      }
      else
        edit.append(m_strEdit.size(), L'*');
    }
    // convert back to utf8
    CStdString utf8Edit;
    g_charsetConverter.wToUTF8(edit, utf8Edit);
    pEdit->SetLabel(utf8Edit);
    // Send off a search message
    unsigned int now = CTimeUtils::GetFrameTime();
    // don't send until the REMOTE_SMS_DELAY has passed
    if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now)
      return;

    if (m_pCharCallback)
      m_pCharCallback(this, utf8Edit);
  }
}
示例#2
0
void CGUIDialogKeyboard::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character
{
  CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT));
  if (pEdit)
  {
    CStdStringW edit = m_strEdit;
    if (m_hiddenInput)
    { // convert to *'s
      edit.Empty();
      if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > timeGetTime() && m_strEdit.size())
      { // using the remove to input, so display the last key input
        edit.append(m_strEdit.size() - 1, L'*');
        edit.append(1, m_strEdit[m_strEdit.size() - 1]);
      }
      else
        edit.append(m_strEdit.size(), L'*');
    }
    // convert back to utf8
    CStdString utf8Edit;
    g_charsetConverter.wToUTF8(edit, utf8Edit);
    pEdit->SetLabel(utf8Edit);
    // Send off a search message if it's been SEARCH_DELAY since last search.
    DWORD now = timeGetTime();
    if (!m_lastSearchUpdate || m_lastSearchUpdate + SEARCH_DELAY >= now)
      m_lastSearchUpdate = now; // update is called when we haven't passed our search delay, so reset it
    if (m_lastSearchUpdate + SEARCH_DELAY < now)
    {
      // don't send until the REMOTE_SMS_DELAY has passed
      if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now)
        return;
      m_lastSearchUpdate = 0;
      if (m_filtering == FILTERING_CURRENT)
      { // send our filter message
        CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_FILTER_ITEMS);
        message.SetStringParam(utf8Edit);
        g_graphicsContext.SendMessage(message);
      }
      if (m_filtering == FILTERING_SEARCH)
      { // send our search message
        CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_SEARCH_UPDATE);
        message.SetStringParam(utf8Edit);
        g_graphicsContext.SendMessage(message);
      }
    }
  }
}
void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character
{
  CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT));
  if (pEdit)
  {
    CStdStringW edit = m_strEdit;
    pEdit->SetHighlight(0, 0);
    pEdit->SetSelection(0, 0);
    if (m_hiddenInput)
    { // convert to *'s
      edit.Empty();
      if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > CTimeUtils::GetFrameTime() && m_iCursorPos > 0)
      { // using the remove to input, so display the last key input
        edit.append(m_iCursorPos - 1, L'*');
        edit.append(1, m_strEdit[m_iCursorPos - 1]);
      }
      else
        edit.append(m_strEdit.size(), L'*');
    }
    else if (!m_strEditing.IsEmpty())
    {
      edit.Insert(m_iCursorPos, m_strEditing);
      pEdit->SetHighlight(m_iCursorPos, m_iCursorPos + m_strEditing.size());
      if (m_iEditingLength > 0)
        pEdit->SetSelection(m_iCursorPos + m_iEditingOffset, m_iCursorPos + m_iEditingOffset + m_iEditingLength);
    }
    // convert back to utf8
    CStdString utf8Edit;
    g_charsetConverter.wToUTF8(edit, utf8Edit);
    pEdit->SetLabel(utf8Edit);
    // Send off a search message
    unsigned int now = CTimeUtils::GetFrameTime();
    // don't send until the REMOTE_SMS_DELAY has passed
    if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now)
      return;

    if (m_pCharCallback)
    {
      // do not send editing text comes from system input method
      if (!m_hiddenInput && !m_strEditing.IsEmpty())
        g_charsetConverter.wToUTF8(m_strEdit, utf8Edit);
      m_pCharCallback(this, utf8Edit);
    }
  }
}
示例#4
0
文件: HTMLUtil.cpp 项目: DJMatty/xbmc
void CHTMLUtil::ConvertHTMLToW(const CStdStringW& strHTML, CStdStringW& strStripped)
{
  if (strHTML.size() == 0)
  {
    strStripped.Empty();
    return ;
  }
  int iPos = 0;
  strStripped = strHTML;
  while (mappings[iPos].html)
  {
    strStripped.Replace(mappings[iPos].html,CStdStringW(1, mappings[iPos].w));
    iPos++;
  }

  iPos = strStripped.Find(L"&#");
  while (iPos > 0 && iPos < (int)strStripped.size()-4)
  {
    int iStart = iPos + 1;
    iPos += 2;
    CStdStringW num;
    int base = 10;
    if (strStripped[iPos+1] == L'x')
    {
      base = 16;
      iPos++;
    }

    int i=iPos;
    while ( iPos < (int)strStripped.size() && 
           (base==16?iswxdigit(strStripped[iPos]):iswdigit(strStripped[iPos])))
      iPos++; 

    num = strStripped.Mid(i,iPos-i);
    wchar_t val = (wchar_t)wcstol(num.c_str(),NULL,base);
    if (base == 10)
      num.Format(L"&#%ls;",num.c_str());
    else
      num.Format(L"&#x%ls;",num.c_str());

    strStripped.Replace(num,CStdStringW(1,val));
    iPos = strStripped.Find(L"&#", iStart);
  }
}
示例#5
0
void CGUIDialogKeyboard::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character
{
  CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT));
  if (pEdit)
  {
    CStdStringW edit = m_strEdit;
    if (m_hiddenInput)
    { // convert to *'s
      edit.Empty();
      if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > CTimeUtils::GetFrameTime() && m_strEdit.size())
      { // using the remove to input, so display the last key input
        edit.append(m_strEdit.size() - 1, L'*');
        edit.append(1, m_strEdit[m_strEdit.size() - 1]);
      }
      else
        edit.append(m_strEdit.size(), L'*');
    }
    // convert back to utf8
    CStdString utf8Edit;
    g_charsetConverter.wToUTF8(edit, utf8Edit);
    pEdit->SetLabel(utf8Edit);
    // Send off a search message
    unsigned int now = CTimeUtils::GetFrameTime();
    // don't send until the REMOTE_SMS_DELAY has passed
    if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now)
      return;
    if (m_filtering == FILTERING_CURRENT)
    { // send our filter message
      CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetID(), 0, GUI_MSG_FILTER_ITEMS);
      message.SetStringParam(utf8Edit);
      g_windowManager.SendMessage(message);
    }

    if (m_filtering == FILTERING_SEARCH)
      SendSearchMessage();
  }
}
示例#6
0
DWORD GetLongPathName (CStdStringW strShortPath, CStdStringW &strLongPath)
{
	int iFound = strShortPath.ReverseFind (L'\\');

	if (iFound > 1)
	{
		// recurse to peel off components
		//
		if (GetLongPathName(strShortPath.Left (iFound), strLongPath) > 0)
		{
			strLongPath += L'\\';
				
				if (strShortPath.Right(1) != L"\\")
				{
					HANDLE hFind;

					if (g_bIsNT)
					{
						WIN32_FIND_DATAW findData;
						
						// append the long component name to the path
						//
						if (INVALID_HANDLE_VALUE != (hFind = ::FindFirstFileW (strShortPath, &findData)))
						{
							strLongPath += findData.cFileName;
							::FindClose (hFind);
						}
						else
						{
							// if FindFirstFile fails, return the error code
							//
							strLongPath.Empty();
							return 0;
						}
					}
					else
					{
						WIN32_FIND_DATAA findData;
						
						// append the long component name to the path
						//
						if (INVALID_HANDLE_VALUE != (hFind = ::FindFirstFileA (CStdStringA (strShortPath), &findData)))
						{
							strLongPath += findData.cFileName;
							::FindClose (hFind);
						}
						else
						{
							// if FindFirstFile fails, return the error code
							//
							strLongPath.Empty();
							return 0;
						}
					}
				}
		}
	}
	else
	{
		strLongPath = strShortPath;
	}
	
	return strLongPath.GetLength();
}