当前位置: 首页>>代码示例>>C++>>正文


C++ CContextButtons::Add方法代码示例

本文整理汇总了C++中CContextButtons::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CContextButtons::Add方法的具体用法?C++ CContextButtons::Add怎么用?C++ CContextButtons::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CContextButtons的用法示例。


在下文中一共展示了CContextButtons::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMessage

bool CGUIWindowPVRRecordings::OnMessage(CGUIMessage &message)
{
  bool bReturn = false;
  switch (message.GetMessage())
  {
    case GUI_MSG_CLICKED:
      if (message.GetSenderId() == m_viewControl.GetCurrentControl())
      {
        int iItem = m_viewControl.GetSelectedItem();
        if (iItem >= 0 && iItem < m_vecItems->Size())
        {
          switch (message.GetParam1())
          {
            case ACTION_SELECT_ITEM:
            case ACTION_MOUSE_LEFT_CLICK:
            case ACTION_PLAY:
            {
              CFileItemPtr pItem = m_vecItems->Get(iItem);
              std::string resumeString = GetResumeString(*pItem);
              if (!resumeString.empty())
              {
                CContextButtons choices;
                choices.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
                choices.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021);
                int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
                if (choice > 0)
                  OnContextButtonPlay(pItem.get(), (CONTEXT_BUTTON)choice);
                bReturn = true;
              }
              break;
            }
            case ACTION_CONTEXT_MENU:
            case ACTION_MOUSE_RIGHT_CLICK:
              OnPopupMenu(iItem);
              bReturn = true;
              break;
            case ACTION_SHOW_INFO:
              ShowRecordingInfo(m_vecItems->Get(iItem).get());
              bReturn = true;
              break;
            case ACTION_DELETE_ITEM:
              ActionDeleteRecording(m_vecItems->Get(iItem).get());
              bReturn = true;
              break;
            default:
              bReturn = false;
              break;
          }
        }
      }
      else if (message.GetSenderId() == CONTROL_BTNGROUPITEMS)
      {
        CGUIRadioButtonControl *radioButton = (CGUIRadioButtonControl*) GetControl(CONTROL_BTNGROUPITEMS);
        g_PVRRecordings->SetGroupItems(radioButton->IsSelected());
        Refresh(true);
      }
      break;
    case GUI_MSG_REFRESH_LIST:
      switch(message.GetParam1())
      {
        case ObservableMessageTimers:
        case ObservableMessageCurrentItem:
        {
          if (IsActive())
            SetInvalid();
          bReturn = true;
          break;
        }
        case ObservableMessageRecordings:
        case ObservableMessageTimersReset:
        {
          if (IsActive())
            Refresh(true);
          bReturn = true;
          break;
        }
      }
      break;
  }

  return bReturn || CGUIWindowPVRBase::OnMessage(message);
}
开发者ID:Jmend25,项目名称:boxeebox-xbmc,代码行数:82,代码来源:GUIWindowPVRRecordings.cpp

示例2: GetContextButtons

void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
  CFileItemPtr item;
  if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
    item = m_vecItems->Get(itemNumber);

  if (item)
  {
    // are we in the playlists location?
    bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
                       m_vecItems->m_strPath.Equals("special://musicplaylists/");

    if (m_vecItems->IsVirtualDirectoryRoot())
    {
      // get the usual music shares, and anything for all media windows
      CGUIDialogContextMenu::GetContextButtons("music", item, buttons);
      // enable Rip CD an audio disc
      if (CDetectDVDMedia::IsDiscInDrive() && item->IsCDDA())
      {
        // those cds can also include Audio Tracks: CDExtra and MixedMode!
        CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
        if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
          buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
      }
      CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
    }
    else
    {
      CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
      if (item->GetPropertyBOOL("pluginreplacecontextitems"))
        return;
      if (!item->IsPlayList())
      {
        if (item->IsAudio() && !item->IsLastFM() && !item->IsShoutCast())
          buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
        else if (!item->IsParentFolder() && !item->IsLastFM() && !item->IsShoutCast() &&
                 !item->m_strPath.Left(3).Equals("new") && item->m_bIsFolder)
        {
#if 0
          if (m_musicdatabase.GetAlbumIdByPath(item->m_strPath) > -1)
#endif
            buttons.Add(CONTEXT_BUTTON_INFO, 13351); // Album Info
        }
      }

      // enable Rip CD Audio or Track button if we have an audio disc
      if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA())
      {
        // those cds can also include Audio Tracks: CDExtra and MixedMode!
        CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
        if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
          buttons.Add(CONTEXT_BUTTON_RIP_TRACK, 610);
      }

      // enable CDDB lookup if the current dir is CDDA
      if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA() &&
         (g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
      {
        buttons.Add(CONTEXT_BUTTON_CDDB, 16002);
      }

      if (!item->IsParentFolder() && !item->IsReadOnly())
      {
        // either we're at the playlist location or its been explicitly allowed
        if (inPlaylists || g_guiSettings.GetBool("filelists.allowfiledeletion"))
        {
          buttons.Add(CONTEXT_BUTTON_DELETE, 117);
          buttons.Add(CONTEXT_BUTTON_RENAME, 118);
        }
      }
    }

    // Add the scan button(s)
    CGUIDialogMusicScan *pScanDlg = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
    if (g_guiSettings.GetBool("musiclibrary.enabled") && pScanDlg)
    {
      if (pScanDlg->IsScanning())
        buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
      else if (!inPlaylists && !m_vecItems->IsInternetStream()           &&
               !item->IsLastFM() && !item->IsShoutCast()                 &&
               !item->m_strPath.Equals("add") && !item->IsParentFolder() &&
              (g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
      {
        buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
      }
    }
  }
  if (!m_vecItems->IsVirtualDirectoryRoot())
    buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
  CGUIWindowMusicBase::GetNonContextButtons(buttons);
}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:91,代码来源:GUIWindowMusicSongs.cpp

示例3: GetContextButtons

void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFileItemPtr& item, CContextButtons &buttons)
{
  // Next, Add buttons to the ContextMenu that should ONLY be visible for sources and not autosourced items
  CMediaSource *share = GetShare(type, item.get());

  if (CServiceBroker::GetProfileManager().GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser)
  {
    if (share)
    {
      // Note. from now on, remove source & disable plugin should mean the same thing
      //! @todo might be smart to also combine editing source & plugin settings into one concept/dialog
      // Note. Temporarily disabled ability to remove plugin sources until installer is operational

      CURL url(share->strPath);
      bool isAddon = ADDON::TranslateContent(url.GetProtocol()) != CONTENT_NONE;
      if (!share->m_ignore && !isAddon)
        buttons.Add(CONTEXT_BUTTON_EDIT_SOURCE, 1027); // Edit Source
      if (type != "video")
        buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // Set as Default
      if (!share->m_ignore && !isAddon)
        buttons.Add(CONTEXT_BUTTON_REMOVE_SOURCE, 522); // Remove Source

      buttons.Add(CONTEXT_BUTTON_SET_THUMB, 20019);
    }
    if (!GetDefaultShareNameByType(type).empty())
      buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // Clear Default
  }
  if (share && LOCK_MODE_EVERYONE != CServiceBroker::GetProfileManager().GetMasterProfile().getLockMode())
  {
    if (share->m_iHasLock == 0 && (CServiceBroker::GetProfileManager().GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser))
      buttons.Add(CONTEXT_BUTTON_ADD_LOCK, 12332);
    else if (share->m_iHasLock == 1)
      buttons.Add(CONTEXT_BUTTON_REMOVE_LOCK, 12335);
    else if (share->m_iHasLock == 2)
    {
      buttons.Add(CONTEXT_BUTTON_REMOVE_LOCK, 12335);

      bool maxRetryExceeded = false;
      if (CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES) != 0)
        maxRetryExceeded = (share->m_iBadPwdCount >= CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES));

      if (maxRetryExceeded)
        buttons.Add(CONTEXT_BUTTON_RESET_LOCK, 12334);
      else
        buttons.Add(CONTEXT_BUTTON_CHANGE_LOCK, 12356);
    }
  }
  if (share && !g_passwordManager.bMasterUser && item->m_iHasLock == 1)
    buttons.Add(CONTEXT_BUTTON_REACTIVATE_LOCK, 12353);
}
开发者ID:idekker,项目名称:xbmc,代码行数:50,代码来源:GUIDialogContextMenu.cpp

示例4: GetNonContextButtons

void CGUIWindowMusicBase::GetNonContextButtons(CContextButtons &buttons)
{
  if (CServiceBroker::GetADSP().IsProcessing())
    buttons.Add(CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS, 15047);
}
开发者ID:Hendrik7,项目名称:xbmc,代码行数:5,代码来源:GUIWindowMusicBase.cpp

示例5: GetContextButtons

void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
  CFileItemPtr item;
  if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
    item = m_vecItems->Get(itemNumber);

  CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);

  if (item && item->GetPropertyBOOL("pluginreplacecontextitems"))
    return;

  CVideoDatabaseDirectory dir;
  NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->m_strPath);

  if (!item)
  {
    CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
    if (pScanDlg && pScanDlg->IsScanning())
      buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
    else
      buttons.Add(CONTEXT_BUTTON_UPDATE_LIBRARY, 653);
  }
  else if (m_vecItems->m_strPath.Equals("sources://video/"))
  {
    // get the usual shares
    CGUIDialogContextMenu::GetContextButtons("video", item, buttons);
    // add scan button somewhere here
    CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
    if (pScanDlg && pScanDlg->IsScanning())
      buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);  // Stop Scanning
    if (!item->IsDVD() && item->m_strPath != "add" &&
        (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
    {
      CVideoDatabase database;
      database.Open();
      ADDON::ScraperPtr info = database.GetScraperForPath(item->m_strPath);

      if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
      {
        if (!item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath())
        {
          if (info && info->Content() != CONTENT_NONE)
            buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
          else
            buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
        }
      }

      if (info && (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning())))
        buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
    }
  }
  else
  {
    ADDON::ScraperPtr info;
    VIDEO::SScanSettings settings;
    GetScraperForItem(item.get(), info, settings);

    if (info && info->Content() == CONTENT_TVSHOWS)
      buttons.Add(CONTEXT_BUTTON_INFO, item->m_bIsFolder ? 20351 : 20352);
    else if (info && info->Content() == CONTENT_MUSICVIDEOS)
      buttons.Add(CONTEXT_BUTTON_INFO,20393);
    else if (!item->m_bIsFolder && !item->m_strPath.Left(19).Equals("newsmartplaylist://"))
      buttons.Add(CONTEXT_BUTTON_INFO, 13346);

    if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strArtist.IsEmpty())
    {
      CMusicDatabase database;
      database.Open();
      if (database.GetArtistByName(item->GetVideoInfoTag()->m_strArtist) > -1)
        buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
    }
    if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0)
    {
      CMusicDatabase database;
      database.Open();
      if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
        buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
    }
    if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0 &&
        item->GetVideoInfoTag()->m_strArtist.size() > 0                           &&
        item->GetVideoInfoTag()->m_strTitle.size() > 0)
    {
      CMusicDatabase database;
      database.Open();
      if (database.GetSongByArtistAndAlbumAndTitle(item->GetVideoInfoTag()->m_strArtist,
                                                   item->GetVideoInfoTag()->m_strAlbum,
                                                   item->GetVideoInfoTag()->m_strTitle) > -1)
      {
        buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20398);
      }
    }
    if (!item->IsParentFolder())
    {
      // can we update the database?
      if (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
      {
        if (node == NODE_TYPE_TITLE_TVSHOWS)
        {
          CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
//.........这里部分代码省略.........
开发者ID:mmrvka,项目名称:xbmc,代码行数:101,代码来源:GUIWindowVideoNav.cpp

示例6: ChooseGameClientDialog

bool CRetroPlayerDialogs::ChooseGameClientDialog(const vector<string> &clientIds, const CFileItem &file, GameClientPtr &result)
{
  CLog::Log(LOGDEBUG, "RetroPlayer: Multiple clients found: %s", StringUtils::Join(clientIds, ", ").c_str());

  // Turn ID strings into game client pointers (std::map enables sorting by name)
  map<string, GameClientPtr> clients;
  for (vector<string>::const_iterator it = clientIds.begin(); it != clientIds.end(); ++it)
  {
    AddonPtr addon;
    GameClientPtr gc;
    if (CAddonMgr::Get().GetAddon(*it, addon, ADDON_GAMEDLL))
    {
      gc = boost::dynamic_pointer_cast<CGameClient>(addon);
      if (gc)
      {
        string strName = gc->Name();
        // Make lower case for sorting purposes
        StringUtils::ToLower(strName);
        clients[strName] = gc;
      }
    }
  }

  // CContextButtons doesn't support keying by string, only int, so use a
  // parallel array to track the string values (client name)
  CContextButtons choicesInt;
  unsigned int i = 0;

  vector<string> choicesStr;
  choicesStr.reserve(clients.size());

  for (map<string, GameClientPtr>::const_iterator it = clients.begin(); it != clients.end(); ++it)
  {
    string strName = it->second->Name();
    choicesInt.Add(i++, strName);
    // Remember, our map keys are lower case
    StringUtils::ToLower(strName);
    choicesStr.push_back(strName);
  }

  // i becomes the index of the final item (choice to go to the add-on manager)
  const unsigned int iAddonMgr = i;
  choicesInt.Add(iAddonMgr, 24025); // "Manage emulators..."

  int btnid = CGUIDialogContextMenu::ShowAndGetChoice(choicesInt);
  if (btnid < 0 || btnid > (int)iAddonMgr)
  {
    CLog::Log(LOGDEBUG, "RetroPlayer: User cancelled game client selection");
    return false;
  }
  else if (btnid == (int)iAddonMgr)
  {
    // Queue the file so that if a compatible game client is installed, the
    // user will be asked to launch the file.
    CGameManager::Get().SetAutoLaunch(file);

    CLog::Log(LOGDEBUG, "RetroPlayer: User chose to go to the add-on manager");
    CStdStringArray params;
    params.push_back("addons://all/xbmc.gameclient");
    g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params);
    return false;
  }
  else
  {
    result = clients[choicesStr[btnid]];
    CLog::Log(LOGDEBUG, "RetroPlayer: Using %s", result->ID().c_str());
  }

  return true;
}
开发者ID:pixl-project,项目名称:xbmc,代码行数:70,代码来源:RetroPlayerDialogs.cpp

示例7: OnPopupMenu

void CGUIWindowFileManager::OnPopupMenu(int list, int item, bool bContextDriven /* = true */)
{
  if (list < 0 || list >= 2) return ;
  bool bDeselect = SelectItem(list, item);
  // calculate the position for our menu
  float posX = 200;
  float posY = 100;
  const CGUIControl *pList = GetControl(CONTROL_LEFT_LIST + list);
  if (pList)
  {
    posX = pList->GetXPosition() + pList->GetWidth() / 2;
    posY = pList->GetYPosition() + pList->GetHeight() / 2;
  }

  CFileItemPtr pItem = m_vecItems[list]->Get(item);
  if (!pItem.get())
    return;

  if (m_Directory[list]->IsVirtualDirectoryRoot())
  {
    if (item < 0)
    { // TODO: We should add the option here for shares to be added if there aren't any
      return ;
    }

    // and do the popup menu
    if (CGUIDialogContextMenu::SourcesMenu("files", pItem, posX, posY))
    {
      m_rootDir.SetSources(*CMediaSourceSettings::Get().GetSources("files"));
      if (m_Directory[1 - list]->IsVirtualDirectoryRoot())
        Refresh();
      else
        Refresh(list);
      return ;
    }
    pItem->Select(false);
    return ;
  }
  // popup the context menu

  bool showEntry = false;
  if (item >= m_vecItems[list]->Size()) item = -1;
  if (item >= 0)
    showEntry=(!pItem->IsParentFolder() || (pItem->IsParentFolder() && m_vecItems[list]->GetSelectedCount()>0));

  // determine available players
  VECPLAYERCORES vecCores;
  CPlayerCoreFactory::Get().GetPlayers(*pItem, vecCores);

  // add the needed buttons
  CContextButtons choices;
  if (item >= 0)
  {
    //The ".." item is not selectable. Take that into account when figuring out if all items are selected
    int notSelectable = CSettings::Get().GetBool("filelists.showparentdiritems") ? 1 : 0;
    if (NumSelected(list) <  m_vecItems[list]->Size() - notSelectable)
      choices.Add(1, 188); // SelectAll
    if (!pItem->IsParentFolder())
      choices.Add(2,  XFILE::CFavouritesDirectory::IsFavourite(pItem.get(), GetID()) ? 14077 : 14076); // Add/Remove Favourite
    if (vecCores.size() > 1)
      choices.Add(3, 15213); // Play Using...
    if (CanRename(list) && !pItem->IsParentFolder())
      choices.Add(4, 118); // Rename
    if (CanDelete(list) && showEntry)
      choices.Add(5, 117); // Delete
    if (CanCopy(list) && showEntry)
      choices.Add(6, 115); // Copy
    if (CanMove(list) && showEntry)
      choices.Add(7, 116); // Move
  }
  if (CanNewFolder(list))
    choices.Add(8, 20309); // New Folder
  if (item >= 0 && pItem->m_bIsFolder && !pItem->IsParentFolder())
    choices.Add(9, 13393); // Calculate Size
  choices.Add(11, 20128); // Go To Root
  choices.Add(12, 523);     // switch media
  if (CJobManager::GetInstance().IsProcessing("filemanager"))
    choices.Add(13, 167);

  int btnid = CGUIDialogContextMenu::ShowAndGetChoice(choices);
  if (btnid == 1)
  {
    OnSelectAll(list);
    bDeselect=false;
  }
  if (btnid == 2)
  {
    XFILE::CFavouritesDirectory::AddOrRemove(pItem.get(), GetID());
    return;
  }
  if (btnid == 3)
  {
    VECPLAYERCORES vecCores;
    CPlayerCoreFactory::Get().GetPlayers(*pItem, vecCores);
    g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
    if (g_application.m_eForcedNextPlayer != EPC_NONE)
      OnStart(pItem.get());
  }
  if (btnid == 4)
    OnRename(list);
//.........这里部分代码省略.........
开发者ID:ace20022,项目名称:kodi-cmake,代码行数:101,代码来源:GUIWindowFileManager.cpp

示例8: OnPopupMenu

bool CGUIDialogAudioDSPManager::OnPopupMenu(int iItem, int listType)
{
  // popup the context menu
  // grab our context menu
  CContextButtons buttons;
  int listSize = 0;
  CFileItemPtr pItem;

  if (listType == LIST_ACTIVE)
  {
    listSize = m_activeItems[m_iCurrentType]->Size();
    pItem = m_activeItems[m_iCurrentType]->Get(iItem);
  }
  else if (listType == LIST_AVAILABLE)
  {
    listSize = m_availableItems[m_iCurrentType]->Size();
    pItem = m_availableItems[m_iCurrentType]->Get(iItem);
  }

  if (!pItem)
  {
    return false;
  }

  // mark the item
  if (iItem >= 0 && iItem < listSize)
  {
    pItem->Select(true);
  }
  else
  {
    return false;
  }

  if (listType == LIST_ACTIVE)
  {
    if (listSize > 1)
    {
      buttons.Add(CONTEXT_BUTTON_MOVE, 116);              /* Move mode up or down */
    }
    buttons.Add(CONTEXT_BUTTON_ACTIVATE, 24021);          /* Used to deactivate addon process type */
  }
  else if (listType == LIST_AVAILABLE)
  {
    if (m_activeItems[m_iCurrentType]->Size() > 0 && (m_iCurrentType == AE_DSP_MODE_TYPE_INPUT_RESAMPLE || m_iCurrentType == AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE))
    {
      buttons.Add(CONTEXT_BUTTON_ACTIVATE, 15080);        /* Used to swap addon resampling process type */
    }
    else
    {
      buttons.Add(CONTEXT_BUTTON_ACTIVATE, 24022);        /* Used to activate addon process type */
    }
  }

  if (pItem->GetProperty("SettingsDialog").asInteger() != 0)
  {
    buttons.Add(CONTEXT_BUTTON_SETTINGS, 15078);          /* Used to activate addon process type help description*/
  }

  if (pItem->GetProperty("Help").asInteger() > 0)
  {
    buttons.Add(CONTEXT_BUTTON_HELP, 15062);              /* Used to activate addon process type help description*/
  }

  int choice = CGUIDialogContextMenu::ShowAndGetChoice(buttons);

  // deselect our item
  if (iItem >= 0 && iItem < listSize)
  {
    pItem->Select(false);
  }

  if (choice < 0)
  {
    return false;
  }

  return OnContextButton(iItem, (CONTEXT_BUTTON)choice, listType);
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:79,代码来源:GUIDialogAudioDSPManager.cpp

示例9: InstallGameClient

std::string CGUIDialogSelectGameClient::InstallGameClient(const GameClientVector& installable)
{
  using namespace ADDON;

  std::string gameClient;

  //! @todo Switch to add-on browser when more emulators have icons
  /*
  std::string chosenClientId;
  if (CGUIWindowAddonBrowser::SelectAddonID(ADDON_GAMEDLL, chosenClientId, false, true, false, true, false) >= 0 && !chosenClientId.empty())
  {
    CLog::Log(LOGDEBUG, "Select game client dialog: User installed %s", chosenClientId.c_str());
    AddonPtr addon;
    if (CAddonMgr::GetInstance().GetAddon(chosenClientId, addon, ADDON_GAMEDLL))
      gameClient = addon->ID();

    if (gameClient.empty())
      CLog::Log(LOGERROR, "Select game client dialog: Failed to get addon %s", chosenClientId.c_str());
  }
  */

  CContextButtons choiceButtons;

  // Add emulators
  int i = 0;
  for (const GameClientPtr& gameClient : installable)
    choiceButtons.Add(i++, gameClient->Name());

  // Add button to browser all emulators
  const int iAddonBrowser = i++;
  choiceButtons.Add(iAddonBrowser, 35255); // "Browse all emulators"

  // Do modal
  int result = CGUIDialogContextMenu::ShowAndGetChoice(choiceButtons);

  if (0 <= result && result < static_cast<int>(installable.size()))
  {
    std::string gameClientId = installable[result]->ID();
    CLog::Log(LOGDEBUG, "Select game client dialog: Installing %s", gameClientId.c_str());
    AddonPtr installedAddon;
    if (CAddonInstaller::GetInstance().InstallModal(gameClientId, installedAddon, false))
    {
      CLog::Log(LOGDEBUG, "Select game client dialog: Successfully installed %s", installedAddon->ID().c_str());

      // if the addon is disabled we need to enable it
      if (CAddonMgr::GetInstance().IsAddonDisabled(installedAddon->ID()))
        CAddonMgr::GetInstance().EnableAddon(installedAddon->ID());

      gameClient = installedAddon->ID();
    }
    else
    {
      CLog::Log(LOGERROR, "Select game client dialog: Failed to install %s", gameClientId.c_str());
      // "Error"
      // "Failed to install add-on."
      HELPERS::ShowOKDialogText(257, 35256);
    }
  }
  else if (result == iAddonBrowser)
  {
    ActivateAddonBrowser();
  }
  else
  {
    CLog::Log(LOGDEBUG, "Select game client dialog: User cancelled game client installation");
  }

  return gameClient;
}
开发者ID:rbuehlma,项目名称:xbmc,代码行数:69,代码来源:GUIDialogSelectGameClient.cpp

示例10: GetContextButtons

void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
  if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
    return;
  CFileItemPtr pItem = m_vecItems->Get(itemNumber);

  buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 19000);         /* switch channel */

  if (pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->HasRecording())
    buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 19687);      /* play recording */

  CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(pItem.get());
  if (timer && timer->HasPVRTimerInfoTag())
  {
    if (timer->GetPVRTimerInfoTag()->IsRecording())
      buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059);  /* stop recording */
    else if (timer->GetPVRTimerInfoTag()->HasTimerType() &&
             !timer->GetPVRTimerInfoTag()->GetTimerType()->IsReadOnly())
      buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19060);  /* delete timer */
  }
  else if (pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
  {
    if (pItem->GetEPGInfoTag()->StartAsLocalTime() < CDateTime::GetCurrentDateTime())
      buttons.Add(CONTEXT_BUTTON_START_RECORD, 264);   /* record */

    buttons.Add(CONTEXT_BUTTON_START_RECORD, 19061);   /* add timer */
    buttons.Add(CONTEXT_BUTTON_ADVANCED_RECORD, 841);  /* add custom timer */
  }

  buttons.Add(CONTEXT_BUTTON_INFO, 19047);              /* epg info */
  buttons.Add(CONTEXT_BUTTON_FIND, 19003);              /* find similar program */

  if (m_viewControl.GetCurrentControl() == GUIDE_VIEW_TIMELINE)
  {
    buttons.Add(CONTEXT_BUTTON_BEGIN, 19063);           /* go to begin */
    buttons.Add(CONTEXT_BUTTON_NOW, 19070);             /* go to now */
    buttons.Add(CONTEXT_BUTTON_END, 19064);             /* go to end */
  }

  if (pItem->HasEPGInfoTag() &&
      pItem->GetEPGInfoTag()->HasPVRChannel() &&
      g_PVRClients->HasMenuHooks(pItem->GetEPGInfoTag()->ChannelTag()->ClientID(), PVR_MENUHOOK_EPG))
    buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195);      /* PVR client specific action */

  CGUIWindowPVRBase::GetContextButtons(itemNumber, buttons);
}
开发者ID:sandalsoft,项目名称:mrmc,代码行数:46,代码来源:GUIWindowPVRGuide.cpp

示例11: OnSettingAction

void CGUIDialogLockSettings::OnSettingAction(const CSetting *setting)
{
  if (setting == NULL)
    return;

  CGUIDialogSettingsManualBase::OnSettingAction(setting);

  const std::string &settingId = setting->GetId();
  if (settingId == SETTING_LOCKCODE)
  {
    CContextButtons choices;
    choices.Add(1, 1223);
    choices.Add(2, 12337);
    choices.Add(3, 12338);
    choices.Add(4, 12339);
    int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);

    std::string newPassword;
    LockType iLockMode = LOCK_MODE_UNKNOWN;
    bool bResult = false;
    switch(choice)
    {
      case 1:
        iLockMode = LOCK_MODE_EVERYONE; //Disabled! Need check routine!!!
        bResult = true;
        break;

      case 2:
        iLockMode = LOCK_MODE_NUMERIC;
        bResult = CGUIDialogNumeric::ShowAndVerifyNewPassword(newPassword);
        break;

      case 3:
        iLockMode = LOCK_MODE_GAMEPAD;
        bResult = CGUIDialogGamepad::ShowAndVerifyNewPassword(newPassword);
        break;

      case 4:
        iLockMode = LOCK_MODE_QWERTY;
        bResult = CGUIKeyboardFactory::ShowAndVerifyNewPassword(newPassword);
        break;

      default:
        break;
    }

    if (bResult)
    {
      if (iLockMode == LOCK_MODE_EVERYONE)
        newPassword = "-";
      m_locks.code = newPassword;
      if (m_locks.code == "-")
        iLockMode = LOCK_MODE_EVERYONE;
      m_locks.mode = iLockMode;

      setLockCodeLabel();
      setDetailSettingsEnabled(m_locks.mode != LOCK_MODE_EVERYONE);
      m_changed = true;
    }
  }
}
开发者ID:AndyPeterman,项目名称:mrmc,代码行数:61,代码来源:GUIDialogLockSettings.cpp

示例12: GetContextButtons

void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
  if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
    return;
  CFileItemPtr pItem = m_vecItems->Get(itemNumber);

  buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 19000);         /* Switch channel */
  buttons.Add(CONTEXT_BUTTON_INFO, 19047);              /* Programme information */
  buttons.Add(CONTEXT_BUTTON_FIND, 19003);              /* Find similar */

  CEpgInfoTagPtr epg(pItem->GetEPGInfoTag());
  if (epg)
  {
    CPVRTimerInfoTagPtr timer(epg->Timer());
    if (timer)
    {
      if (timer->GetTimerRuleId() != PVR_TIMER_NO_PARENT)
      {
        buttons.Add(CONTEXT_BUTTON_EDIT_TIMER_RULE, 19243); /* Edit timer rule */
        buttons.Add(CONTEXT_BUTTON_DELETE_TIMER_RULE, 19295); /* Delete timer rule */
      }

      const CPVRTimerTypePtr timerType(timer->GetTimerType());
      if (timerType && !timerType->IsReadOnly())
        buttons.Add(CONTEXT_BUTTON_EDIT_TIMER, 19242);    /* Edit timer */

      if (timer->IsRecording())
        buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059);   /* Stop recording */
      else
      {
        if (timerType && !timerType->IsReadOnly())
          buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060);  /* Delete timer */
      }
    }
    else if (g_PVRClients->SupportsTimers())
    {
      if (epg->EndAsLocalTime() > CDateTime::GetCurrentDateTime())
        buttons.Add(CONTEXT_BUTTON_START_RECORD, 264);      /* Record */
      buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061);       /* Add timer */
    }

    if (epg->HasRecording())
      buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 19687);      /* Play recording */
  }

  if (m_viewControl.GetCurrentControl() == GUIDE_VIEW_TIMELINE)
  {
    buttons.Add(CONTEXT_BUTTON_BEGIN, 19063);           /* Go to begin */
    buttons.Add(CONTEXT_BUTTON_NOW, 19070);             /* Go to now */
    buttons.Add(CONTEXT_BUTTON_END, 19064);             /* Go to end */
  }

  if (epg)
  {
    CPVRChannelPtr channel(epg->ChannelTag());
    if (channel && g_PVRClients->HasMenuHooks(channel->ClientID(), PVR_MENUHOOK_EPG))
      buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195);      /* PVR client specific action */
  }

  CGUIWindowPVRBase::GetContextButtons(itemNumber, buttons);
}
开发者ID:Habitual-Sinner,项目名称:xbmc,代码行数:61,代码来源:GUIWindowPVRGuide.cpp

示例13: OnSettingAction

void CMediaSettings::OnSettingAction(const CSetting *setting)
{
  if (setting == NULL)
    return;

  const std::string &settingId = setting->GetId();
  if (settingId == CSettings::SETTING_KARAOKE_EXPORT)
  {
    CContextButtons choices;
    choices.Add(1, g_localizeStrings.Get(22034));
    choices.Add(2, g_localizeStrings.Get(22035));

    int retVal = CGUIDialogContextMenu::ShowAndGetChoice(choices);
    if ( retVal > 0 )
    {
      std::string path(CProfilesManager::GetInstance().GetDatabaseFolder());
      VECSOURCES shares;
      g_mediaManager.GetLocalDrives(shares);
      if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(661), path, true))
      {
        CMusicDatabase musicdatabase;
        musicdatabase.Open();

        if ( retVal == 1 )
        {
          path = URIUtils::AddFileToFolder(path, "karaoke.html");
          musicdatabase.ExportKaraokeInfo( path, true );
        }
        else
        {
          path = URIUtils::AddFileToFolder(path, "karaoke.csv");
          musicdatabase.ExportKaraokeInfo( path, false );
        }
        musicdatabase.Close();
      }
    }
  }
  else if (settingId == CSettings::SETTING_KARAOKE_IMPORTCSV)
  {
    std::string path(CProfilesManager::GetInstance().GetDatabaseFolder());
    VECSOURCES shares;
    g_mediaManager.GetLocalDrives(shares);
    if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "karaoke.csv", g_localizeStrings.Get(651) , path))
    {
      CMusicDatabase musicdatabase;
      musicdatabase.Open();
      musicdatabase.ImportKaraokeInfo(path);
      musicdatabase.Close();
    }
  }
  else if (settingId == CSettings::SETTING_MUSICLIBRARY_CLEANUP)
  {
    if (CGUIDialogYesNo::ShowAndGetInput(CVariant{313}, CVariant{333}))
      g_application.StartMusicCleanup(true);
  }
  else if (settingId == CSettings::SETTING_MUSICLIBRARY_EXPORT)
    CBuiltins::Execute("exportlibrary(music)");
  else if (settingId == CSettings::SETTING_MUSICLIBRARY_IMPORT)
  {
    std::string path;
    VECSOURCES shares;
    g_mediaManager.GetLocalDrives(shares);
    g_mediaManager.GetNetworkLocations(shares);
    g_mediaManager.GetRemovableDrives(shares);

    if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "musicdb.xml", g_localizeStrings.Get(651) , path))
    {
      CMusicDatabase musicdatabase;
      musicdatabase.Open();
      musicdatabase.ImportFromXML(path);
      musicdatabase.Close();
    }
  }
  else if (settingId == CSettings::SETTING_VIDEOLIBRARY_CLEANUP)
  {
    if (CGUIDialogYesNo::ShowAndGetInput(CVariant{313}, CVariant{333}))
      g_application.StartVideoCleanup(true);
  }
  else if (settingId == CSettings::SETTING_VIDEOLIBRARY_EXPORT)
    CBuiltins::Execute("exportlibrary(video)");
  else if (settingId == CSettings::SETTING_VIDEOLIBRARY_IMPORT)
  {
    std::string path;
    VECSOURCES shares;
    g_mediaManager.GetLocalDrives(shares);
    g_mediaManager.GetNetworkLocations(shares);
    g_mediaManager.GetRemovableDrives(shares);

    if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(651) , path))
    {
      CVideoDatabase videodatabase;
      videodatabase.Open();
      videodatabase.ImportFromXML(path);
      videodatabase.Close();
    }
  }
}
开发者ID:evilhamster,项目名称:xbmc,代码行数:97,代码来源:MediaSettings.cpp

示例14: GetContextButtons

void CGUIWindowPrograms::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
  if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
    return;
  CFileItemPtr item = m_vecItems->Get(itemNumber);
  if (item && !item->GetPropertyBOOL("pluginreplacecontextitems"))
  {
    if ( m_vecItems->IsVirtualDirectoryRoot() )
    {
      CGUIDialogContextMenu::GetContextButtons("programs", item, buttons);
    }
    else
    {
      if (item->IsXBE() || item->IsShortCut())
      {
        if (CFile::Exists("special://xbmc/system/scripts/XBMC4Gamers Extras/Synopsis/default.py") || CFile::Exists("special://xbmc/system/scripts/Synopsis/default.py"))
		{
          buttons.Add(CONTEXT_BUTTON_SYNOPSIS, "Synopsis");         // Synopsis
		}
		  
        CStdString strLaunch = g_localizeStrings.Get(518); // Launch
        if (g_guiSettings.GetBool("myprograms.gameautoregion"))
        {
          int iRegion = GetRegion(itemNumber);
          if (iRegion == VIDEO_NTSCM)
            strLaunch += " (NTSC-M)";
          if (iRegion == VIDEO_NTSCJ)
            strLaunch += " (NTSC-J)";
          if (iRegion == VIDEO_PAL50)
            strLaunch += " (PAL)";
          if (iRegion == VIDEO_PAL60)
            strLaunch += " (PAL-60)";
        }
        buttons.Add(CONTEXT_BUTTON_LAUNCH, strLaunch);
  
        DWORD dwTitleId = CUtil::GetXbeID(item->GetPath());
        CStdString strTitleID;
        CStdString strGameSavepath;
        strTitleID.Format("%08X",dwTitleId);
        URIUtils::AddFileToFolder("E:\\udata\\",strTitleID,strGameSavepath);
        
		if (CDirectory::Exists(strGameSavepath))
          buttons.Add(CONTEXT_BUTTON_GAMESAVES, 20322);         // Goto GameSaves
  
        if (g_guiSettings.GetBool("myprograms.gameautoregion"))
          buttons.Add(CONTEXT_BUTTON_LAUNCH_IN, 519); // launch in video mode
  
        if (g_passwordManager.IsMasterLockUnlocked(false) || g_settings.GetCurrentProfile().canWriteDatabases())
        {
          if (item->IsShortCut())
            buttons.Add(CONTEXT_BUTTON_RENAME, 16105); // rename
          else
            buttons.Add(CONTEXT_BUTTON_RENAME, 520); // edit xbe title
        }
  
        if (m_database.ItemHasTrainer(dwTitleId))
          buttons.Add(CONTEXT_BUTTON_TRAINER_OPTIONS, 12015); // trainer options
      }
      buttons.Add(CONTEXT_BUTTON_SCAN_TRAINERS, 12012); // scan trainers
  
      buttons.Add(CONTEXT_BUTTON_GOTO_ROOT, 20128); // Go to Root
    }  
  }
  CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
  if (item && !item->GetPropertyBOOL("pluginreplacecontextitems")) 
    buttons.Add(CONTEXT_BUTTON_SETTINGS, 5);      // Settings 
}
开发者ID:Rocky5,项目名称:XBMC4Kids,代码行数:67,代码来源:GUIWindowPrograms.cpp

示例15: GetContextButtons

void CGUIWindowScripts::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
  CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
  buttons.Add(CONTEXT_BUTTON_INFO, 654);
}
开发者ID:Castlecard,项目名称:plex,代码行数:5,代码来源:GUIWindowScripts.cpp


注:本文中的CContextButtons::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。