Beispiel #1
0
bool CGUIWindowPrograms::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
  CFileItemPtr item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : CFileItemPtr();

  if (item && m_vecItems->IsVirtualDirectoryRoot())
  {
    if (CGUIDialogContextMenu::OnContextButton("programs", item, button))
    {
      Update("");
      return true;
    }
  }
  switch (button)
  {
  case CONTEXT_BUTTON_RENAME:
    {
      CStdString strDescription;
      CShortcut cut;
      if (item->IsShortCut())
      {
        cut.Create(item->GetPath());
        strDescription = cut.m_strLabel;
      }
      else
        strDescription = item->GetLabel();

      if (CGUIDialogKeyboard::ShowAndGetInput(strDescription, g_localizeStrings.Get(16008), false))
      {
        if (item->IsShortCut())
        {
          cut.m_strLabel = strDescription;
          cut.Save(item->GetPath());
        }
        else
        {
          // SetXBEDescription will truncate to 40 characters.
          //CUtil::SetXBEDescription(item->GetPath(),strDescription);
          //m_database.SetDescription(item->GetPath(),strDescription);
        }
        Update(m_vecItems->GetPath());
      }
      return true;
    }

  case CONTEXT_BUTTON_GOTO_ROOT:
    Update("");
    return true;

  case CONTEXT_BUTTON_LAUNCH:
    OnClick(itemNumber);
    return true;

  case CONTEXT_BUTTON_INFO:
    OnInfo(itemNumber);
    return true;

  default:
    break;
  }
  return CGUIMediaWindow::OnContextButton(itemNumber, button);
}
Beispiel #2
0
bool CGUIWindowPrograms::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
  CFileItemPtr item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : CFileItemPtr();

  if (item && m_vecItems->IsVirtualDirectoryRoot())
  {
    if (CGUIDialogContextMenu::OnContextButton("programs", item, button))
    {
      Update("");
      return true;
    }
  }
  switch (button)
  {
  case CONTEXT_BUTTON_RENAME:
    {
      CStdString strDescription;
      CShortcut cut;
      if (item->IsShortCut())
      {
        cut.Create(item->GetPath());
        strDescription = cut.m_strLabel;
      }
      else
        strDescription = item->GetLabel();

      if (CGUIDialogKeyboard::ShowAndGetInput(strDescription, g_localizeStrings.Get(16008), false))
      {
        if (item->IsShortCut())
        {
          cut.m_strLabel = strDescription;
          cut.Save(item->GetPath());
        }
        else
        {
          // SetXBEDescription will truncate to 40 characters.
          CUtil::SetXBEDescription(item->GetPath(),strDescription);
          m_database.SetDescription(item->GetPath(),strDescription);
        }
        Update(m_vecItems->GetPath());
      }
      return true;
    }

  case CONTEXT_BUTTON_TRAINER_OPTIONS:
    {
      DWORD dwTitleId = CUtil::GetXbeID(item->GetPath());
      if (CGUIDialogTrainerSettings::ShowForTitle(dwTitleId,&m_database))
        Update(m_vecItems->GetPath());
      return true;
    }

  case CONTEXT_BUTTON_SCAN_TRAINERS:
    {
      PopulateTrainersList();
      Update(m_vecItems->GetPath());
      return true;
    }

  case CONTEXT_BUTTON_SETTINGS:
    g_windowManager.ActivateWindow(WINDOW_SETTINGS_MYPROGRAMS);
    return true;

  case CONTEXT_BUTTON_GOTO_ROOT:
    Update("");
    return true;

  case CONTEXT_BUTTON_LAUNCH:
    OnClick(itemNumber);
    return true;

  case CONTEXT_BUTTON_SYNOPSIS:
    {
	  if (CFile::Exists("special://xbmc/system/scripts/XBMC4Gamers Extras/Synopsis/default.py"))
	  {
        CBuiltins::Execute("runscript(special://xbmc/system/scripts/XBMC4Gamers Extras/Synopsis/default.py)");
      }
	  else
	  {
        CBuiltins::Execute("runscript(special://xbmc/system/scripts/Synopsis/default.py)");
	  }
	  CBuiltins::Execute("ActivateWindow(1101)");
      return true;
    }
  case CONTEXT_BUTTON_GAMESAVES:
    {
      CStdString strTitleID;
      CStdString strGameSavepath;
      strTitleID.Format("%08X",CUtil::GetXbeID(item->GetPath()));
      URIUtils::AddFileToFolder("E:\\udata\\",strTitleID,strGameSavepath);
      g_windowManager.ActivateWindow(WINDOW_GAMESAVES,strGameSavepath);
      return true;
    }
  case CONTEXT_BUTTON_LAUNCH_IN:
    OnChooseVideoModeAndLaunch(itemNumber);
    return true;
  default:
    break;
  }
  return CGUIMediaWindow::OnContextButton(itemNumber, button);
}