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


C++ CGUIDialogSelect::IsConfirmed方法代码示例

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


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

示例1: OnSettingAction

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

  const std::string &settingId = setting->GetId();
  if (settingId == CSettings::SETTING_INPUT_PERIPHERALS)
  {

    CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);

    CFileItemList items;
    GetDirectory("peripherals://all/", items);

    int iPos = -1;
    do
    {
      pDialog->Reset();
      pDialog->SetHeading(CVariant{35000});
      pDialog->SetUseDetails(true);
      pDialog->SetItems(items);
      pDialog->SetSelected(iPos);
      pDialog->Open();

      iPos = pDialog->IsConfirmed() ? pDialog->GetSelectedLabel() : -1;

      if (iPos >= 0)
      {
        CFileItemPtr pItem = items.Get(iPos);
        CGUIDialogPeripheralSettings *pSettingsDialog = (CGUIDialogPeripheralSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_SETTINGS);
        if (pItem && pSettingsDialog)
        {
          // pass peripheral item properties to settings dialog so skin authors
          // can use it to show more detailed information about the device
          pSettingsDialog->SetProperty("vendor", pItem->GetProperty("vendor"));
          pSettingsDialog->SetProperty("product", pItem->GetProperty("product"));
          pSettingsDialog->SetProperty("bus", pItem->GetProperty("bus"));
          pSettingsDialog->SetProperty("location", pItem->GetProperty("location"));
          pSettingsDialog->SetProperty("class", pItem->GetProperty("class"));
          pSettingsDialog->SetProperty("version", pItem->GetProperty("version"));

          // open settings dialog
          pSettingsDialog->SetFileItem(pItem.get());
          pSettingsDialog->Open();
        }
      }
    } while (pDialog->IsConfirmed());
  }
}
开发者ID:hdszju,项目名称:xbmc,代码行数:49,代码来源:Peripherals.cpp

示例2: dcguard

    std::vector<int>* Dialog::multiselect(const String& heading,
        const std::vector<String>& options, int autoclose)
    {
      DelayedCallGuard dcguard(languageHook);
      CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
      if (pDialog == nullptr)
        throw WindowException("Error: Window is NULL");

      pDialog->Reset();
      pDialog->SetMultiSelection(true);
      pDialog->SetHeading(CVariant{heading});

      for (const auto& option : options)
        pDialog->Add(option);

      if (autoclose > 0)
        pDialog->SetAutoClose(autoclose);

      pDialog->Open();

      if (pDialog->IsConfirmed())
        return new std::vector<int>(pDialog->GetSelectedItems());
      else
        return nullptr;
    }
开发者ID:KeTao,项目名称:kodi-cmake,代码行数:25,代码来源:Dialog.cpp

示例3: OnField

void CGUIDialogSmartPlaylistRule::OnField()
{
  const auto fields = CSmartPlaylistRule::GetFields(m_type);
  CGUIDialogSelect* dialog = g_windowManager.GetWindow<CGUIDialogSelect>();
  dialog->Reset();
  dialog->SetHeading(CVariant{20427});
  int selected = -1;
  for (auto field = fields.begin(); field != fields.end(); field++)
  {
    dialog->Add(CSmartPlaylistRule::GetLocalizedField(*field));
    if (*field == m_rule.m_field)
      selected = std::distance(fields.begin(), field);
  }
  if (selected > -1)
    dialog->SetSelected(selected);
  dialog->Open();
  int newSelected = dialog->GetSelectedItem();
  // check if selection has changed
  if (!dialog->IsConfirmed() || newSelected < 0 || newSelected == selected)
    return;

  m_rule.m_field = fields[newSelected];
  // check if operator is still valid. if not, reset to first valid one
  std::vector< std::pair<std::string, int> > validOperators = GetValidOperators(m_rule);
  bool isValid = false;
  for (auto op : validOperators)
    if (std::get<0>(op) == std::get<0>(OperatorLabel(m_rule.m_operator)))
      isValid = true;
  if (!isValid)
    m_rule.m_operator = (CDatabaseQueryRule::SEARCH_OPERATOR)std::get<1>(validOperators[0]);

  m_rule.SetParameter("");
  UpdateButtons();
}
开发者ID:LS80,项目名称:xbmc,代码行数:34,代码来源:GUIDialogSmartPlaylistRule.cpp

示例4: OpenGroupSelectionDialog

bool CGUIWindowPVRBase::OpenGroupSelectionDialog(void)
{
  CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
  if (!dialog)
    return false;

  CFileItemList options;
  g_PVRChannelGroups->Get(m_bRadio)->GetGroupList(&options, true);

  dialog->Reset();
  dialog->SetHeading(CVariant{g_localizeStrings.Get(19146)});
  dialog->SetItems(options);
  dialog->SetMultiSelection(false);
  dialog->SetSelected(m_group->GroupName());
  dialog->Open();

  if (!dialog->IsConfirmed())
    return false;

  const CFileItemPtr item = dialog->GetSelectedItem();
  if (!item)
    return false;

  SetGroup(g_PVRChannelGroups->Get(m_bRadio)->GetByName(item->m_strTitle));

  return true;
}
开发者ID:MrMC,项目名称:mrmc,代码行数:27,代码来源:GUIWindowPVRBase.cpp

示例5: OpenChannelGroupSelectionDialog

bool CGUIWindowPVRBase::OpenChannelGroupSelectionDialog(void)
{
  CGUIDialogSelect *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
  if (!dialog)
    return false;

  CFileItemList options;
  CServiceBroker::GetPVRManager().ChannelGroups()->Get(m_bRadio)->GetGroupList(&options, true);

  dialog->Reset();
  dialog->SetHeading(CVariant{g_localizeStrings.Get(19146)});
  dialog->SetItems(options);
  dialog->SetMultiSelection(false);
  dialog->SetSelected(m_channelGroup->GroupName());
  dialog->Open();

  if (!dialog->IsConfirmed())
    return false;

  const CFileItemPtr item = dialog->GetSelectedFileItem();
  if (!item)
    return false;

  SetChannelGroup(CServiceBroker::GetPVRManager().ChannelGroups()->Get(m_bRadio)->GetByName(item->m_strTitle));

  return true;
}
开发者ID:soerendd,项目名称:xbmc,代码行数:27,代码来源:GUIWindowPVRBase.cpp

示例6: OnClick

bool CGUIControlListSetting::OnClick()
{
    if (m_pButton == NULL)
        return false;

    CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
    if (dialog == NULL)
        return false;

    CFileItemList options;
    if (!GetItems(m_pSetting, options) || options.Size() <= 1)
        return false;

    const CSettingControlList *control = static_cast<const CSettingControlList*>(m_pSetting->GetControl());

    dialog->Reset();
    dialog->SetHeading(g_localizeStrings.Get(m_pSetting->GetLabel()));
    dialog->SetItems(&options);
    dialog->SetMultiSelection(control->CanMultiSelect());
    dialog->DoModal();

    if (!dialog->IsConfirmed())
        return false;

    const CFileItemList &items = dialog->GetSelectedItems();
    std::vector<CVariant> values;
    for (int index = 0; index < items.Size(); index++)
    {
        const CFileItemPtr item = items[index];
        if (item == NULL || !item->HasProperty("value"))
            return false;

        values.push_back(item->GetProperty("value"));
    }

    bool ret = false;
    switch (m_pSetting->GetType())
    {
    case SettingTypeInteger:
        if (values.size() > 1)
            return false;
        ret = ((CSettingInt *)m_pSetting)->SetValue((int)values.at(0).asInteger());

    case SettingTypeString:
        if (values.size() > 1)
            return false;
        ret = ((CSettingString *)m_pSetting)->SetValue(values.at(0).asString());

    case SettingTypeList:
        ret = CSettings::Get().SetList(m_pSetting->GetId(), values);

    default:
        break;
    }

    if (ret)
        Update();

    return ret;
}
开发者ID:nuka1195,项目名称:xbmc,代码行数:60,代码来源:GUIControlSettings.cpp

示例7: open_multi_select

bool Interface_GUIDialogSelect::open_multi_select(void* kodiBase, const char *heading, const char *entryIDs[], const char *entryNames[],
                                                  bool entriesSelected[], unsigned int size, unsigned int autoclose)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogMultiSelect::%s - invalid data", __FUNCTION__);
    return false;
  }

  CGUIDialogSelect* dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
  if (!heading || !entryIDs || !entryNames || !entriesSelected || !dialog)
  {
    CLog::Log(LOGERROR,
              "Interface_GUIDialogMultiSelect::%s - invalid handler data (heading='%p', "
              "entryIDs='%p', entryNames='%p', entriesSelected='%p', dialog='%p') on addon '%s'",
              __FUNCTION__, heading, static_cast<const void*>(entryIDs),
              static_cast<const void*>(entryNames), static_cast<void*>(entriesSelected),
              static_cast<void*>(dialog), addon->ID().c_str());
    return false;
  }

  dialog->Reset();
  dialog->SetMultiSelection(true);
  dialog->SetHeading(CVariant{heading});

  std::vector<int> selectedIndexes;

  for (unsigned int i = 0; i < size; ++i)
  {
    dialog->Add(entryNames[i]);
    if (entriesSelected[i])
      selectedIndexes.push_back(i);
  }

  dialog->SetSelected(selectedIndexes);
  if (autoclose > 0)
    dialog->SetAutoClose(autoclose);

  dialog->Open();
  if (dialog->IsConfirmed())
  {
    for (unsigned int i = 0; i < size; ++i)
      entriesSelected[i] = false;

    selectedIndexes = dialog->GetSelectedItems();

    for (unsigned int i = 0; i < selectedIndexes.size(); ++i)
    {
      if (selectedIndexes[i])
        entriesSelected[selectedIndexes[i]] = true;
    }
  }

  return true;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:56,代码来源:Select.cpp

示例8: GetStereoModeByUserChoice

RENDER_STEREO_MODE CStereoscopicsManager::GetStereoModeByUserChoice(const std::string &heading)
{
  RENDER_STEREO_MODE mode = GetStereoMode();
  // if no stereo mode is set already, suggest mode of current video by preselecting it
  if (mode == RENDER_STEREO_MODE_OFF && g_infoManager.EvaluateBool("videoplayer.isstereoscopic"))
    mode = GetStereoModeOfPlayingVideo();

  CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
  pDlgSelect->Reset();
  if (heading.empty())
    pDlgSelect->SetHeading(CVariant{g_localizeStrings.Get(36528)});
  else
    pDlgSelect->SetHeading(CVariant{heading});

  // prepare selectable stereo modes
  std::vector<RENDER_STEREO_MODE> selectableModes;
  for (int i = RENDER_STEREO_MODE_OFF; i < RENDER_STEREO_MODE_COUNT; i++)
  {
    RENDER_STEREO_MODE selectableMode = (RENDER_STEREO_MODE) i;
    if (g_Windowing.SupportsStereo(selectableMode))
    {
      selectableModes.push_back(selectableMode);
      std::string label = GetLabelForStereoMode((RENDER_STEREO_MODE) i);
      pDlgSelect->Add( label );
      if (mode == selectableMode)
        pDlgSelect->SetSelected( label );
    }
    // inject AUTO pseudo mode after OFF
    if (i == RENDER_STEREO_MODE_OFF)
    {
      selectableModes.push_back(RENDER_STEREO_MODE_AUTO);
      pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_AUTO));
    }
  }

  pDlgSelect->Open();

  int iItem = pDlgSelect->GetSelectedLabel();
  if (iItem > -1 && pDlgSelect->IsConfirmed())
    mode = (RENDER_STEREO_MODE) selectableModes[iItem];
  else
    mode = GetStereoMode();

  return mode;
}
开发者ID:aqavi-paracha,项目名称:xbmc,代码行数:45,代码来源:StereoscopicsManager.cpp

示例9: OnOperator

void CGUIDialogSmartPlaylistRule::OnOperator()
{
  const auto labels = GetValidOperators(m_rule);
  CGUIDialogSelect* dialog = g_windowManager.GetWindow<CGUIDialogSelect>();
  dialog->Reset();
  dialog->SetHeading(CVariant{ 16023 });
  for (auto label : labels)
    dialog->Add(std::get<0>(label));
  dialog->SetSelected(CSmartPlaylistRule::GetLocalizedOperator(m_rule.m_operator));
  dialog->Open();
  int newSelected = dialog->GetSelectedItem();
  // check if selection has changed
  if (!dialog->IsConfirmed() || newSelected < 0)
    return;
 
  m_rule.m_operator = (CDatabaseQueryRule::SEARCH_OPERATOR)std::get<1>(labels[newSelected]);
  UpdateButtons();
}
开发者ID:LS80,项目名称:xbmc,代码行数:18,代码来源:GUIDialogSmartPlaylistRule.cpp

示例10: OnClick

bool CGUIControlListSetting::OnClick()
{
  if (m_pButton == NULL)
    return false;

  CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
  if (dialog == NULL)
    return false;

  CFileItemList options;
  if (!GetItems(m_pSetting, options) || options.Size() <= 1)
    return false;
  
  dialog->Reset();
  dialog->SetHeading(g_localizeStrings.Get(m_pSetting->GetLabel()));
  dialog->SetItems(&options);
  dialog->SetMultiSelection(false);
  dialog->DoModal();

  if (!dialog->IsConfirmed())
    return false;

  const CFileItemPtr item = dialog->GetSelectedItem();
  if (item == NULL || !item->HasProperty("value"))
    return false;
  
  CVariant value = item->GetProperty("value");
  switch (m_pSetting->GetType())
  {
    case SettingTypeInteger:
      return ((CSettingInt *)m_pSetting)->SetValue((int)value.asInteger());
    
    case SettingTypeString:
      return ((CSettingString *)m_pSetting)->SetValue(value.asString());
    
    default:
      break;
  }

  return true;
}
开发者ID:Micromax-56,项目名称:xbmc,代码行数:41,代码来源:GUIControlSettings.cpp

示例11: ChooseSortMethod

bool CGUIViewState::ChooseSortMethod()
{
  
  CGUIDialogSelect *dialog = g_windowManager.GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
  if (!dialog)
    return false;
  dialog->Reset();
  dialog->SetHeading(CVariant{ 39010 }); // Label "Sort by"
  for (auto &sortMethod : m_sortMethods)
    dialog->Add(g_localizeStrings.Get(sortMethod.m_buttonLabel));
  dialog->SetSelected(m_currentSortMethod);
  dialog->Open();
  int newSelected = dialog->GetSelectedItem();
  // check if selection has changed
  if (!dialog->IsConfirmed() || newSelected < 0 || newSelected == m_currentSortMethod)
    return false;

  m_currentSortMethod = newSelected;
  SaveViewState();
  return true;
}
开发者ID:ssfdre38,项目名称:xbmc,代码行数:21,代码来源:GUIViewState.cpp

示例12: SelectBool

/*! \brief Select and set a skin bool setting.
 *  \param params The parameters.
 *  \details params[0] = Names of skin settings.
 */
static int SelectBool(const std::vector<std::string>& params)
{
  std::vector<std::pair<std::string, std::string>> settings;

  CGUIDialogSelect* pDlgSelect = g_windowManager.GetWindow<CGUIDialogSelect>();
  pDlgSelect->Reset();
  pDlgSelect->SetHeading(CVariant{g_localizeStrings.Get(atoi(params[0].c_str()))});

  for (unsigned int i = 1 ; i < params.size() ; i++)
  {
    if (params[i].find('|') != std::string::npos)
    {
      std::vector<std::string> values = StringUtils::Split(params[i], '|');
      std::string label = g_localizeStrings.Get(atoi(values[0].c_str()));
      settings.push_back(std::make_pair(label, values[1].c_str()));
      pDlgSelect->Add(label);
    }
  }

  pDlgSelect->Open();

  if(pDlgSelect->IsConfirmed())
  {
    unsigned int iItem = pDlgSelect->GetSelectedItem();

    for (unsigned int i = 0 ; i < settings.size() ; i++)
    {
      std::string item = settings[i].second;
      int setting = CSkinSettings::GetInstance().TranslateBool(item);
      if (i == iItem)
        CSkinSettings::GetInstance().SetBool(setting, true);
      else
        CSkinSettings::GetInstance().SetBool(setting, false);
    }
    CServiceBroker::GetSettings().Save();
  }

  return 0;
}
开发者ID:LS80,项目名称:xbmc,代码行数:43,代码来源:SkinBuiltins.cpp

示例13: OnPlaybackStarted

void CStereoscopicsManager::OnPlaybackStarted(void)
{
  STEREOSCOPIC_PLAYBACK_MODE playbackMode = (STEREOSCOPIC_PLAYBACK_MODE) CSettings::Get().GetInt("videoplayer.stereoscopicplaybackmode");
  RENDER_STEREO_MODE mode = GetStereoMode();

  // early return if playback mode should be ignored and we're in no stereoscopic mode right now
  if (playbackMode == STEREOSCOPIC_PLAYBACK_MODE_IGNORE && mode == RENDER_STEREO_MODE_OFF)
    return;

  if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic"))
  {
    // exit stereo mode if started item is not stereoscopic
    // and if user prefers to stop 3D playback when movie is finished
    if (mode != RENDER_STEREO_MODE_OFF && CSettings::Get().GetBool("videoplayer.quitstereomodeonstop"))
      SetStereoMode(RENDER_STEREO_MODE_OFF);
    return;
  }

  // if we're not in stereomode yet, restore previously selected stereo mode in case it was user selected
  if (m_stereoModeSetByUser != RENDER_STEREO_MODE_UNDEFINED)
  {
    SetStereoMode(m_stereoModeSetByUser);
    return;
  }

  RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode();
  RENDER_STEREO_MODE playing = GetStereoModeOfPlayingVideo();

  if (mode != RENDER_STEREO_MODE_OFF)
  {
    // don't change mode if user selected to not exit stereomode on playback stop
    // users selecting this option usually have to manually switch their TV into 3D mode
    // and would be annoyed by having to switch TV modes when next movies comes up
    // @todo probably add a new setting for just this behavior
    if (CSettings::Get().GetBool("videoplayer.quitstereomodeonstop") == false)
      return;

    // only change to new stereo mode if not yet in preferred stereo mode
    if (mode == preferred || (preferred == RENDER_STEREO_MODE_AUTO && mode == playing))
      return;
  }

  switch (playbackMode)
  {
  case STEREOSCOPIC_PLAYBACK_MODE_ASK: // Ask
    {
      CApplicationMessenger::Get().MediaPause();

      CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
      pDlgSelect->Reset();
      pDlgSelect->SetHeading(CVariant{g_localizeStrings.Get(36527)});

      int idx_playing   = -1;

      // add choices
      int idx_preferred = pDlgSelect->Add(g_localizeStrings.Get(36524) // preferred
                                     + " ("
                                     + GetLabelForStereoMode(preferred)
                                     + ")");

      int idx_mono = pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_MONO)); // mono / 2d

      if (playing != RENDER_STEREO_MODE_OFF && playing != preferred && preferred != RENDER_STEREO_MODE_AUTO && g_Windowing.SupportsStereo(playing)) // same as movie
        idx_playing = pDlgSelect->Add(g_localizeStrings.Get(36532)
                                    + " ("
                                    + GetLabelForStereoMode(playing)
                                    + ")");

      int idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select

      pDlgSelect->Open();

      if(pDlgSelect->IsConfirmed())
      {
        int iItem = pDlgSelect->GetSelectedLabel();
        if      (iItem == idx_preferred) mode = preferred;
        else if (iItem == idx_mono)      mode = RENDER_STEREO_MODE_MONO;
        else if (iItem == idx_playing)   mode = RENDER_STEREO_MODE_AUTO;
        else if (iItem == idx_select)    mode = GetStereoModeByUserChoice();

        SetStereoModeByUser( mode );
      }

      CApplicationMessenger::Get().MediaUnPause();
    }
    break;
  case STEREOSCOPIC_PLAYBACK_MODE_PREFERRED: // Stereoscopic
    SetStereoMode( preferred );
    break;
  case 2: // Mono
    SetStereoMode( RENDER_STEREO_MODE_MONO );
    break;
  default:
    break;
  }
}
开发者ID:aqavi-paracha,项目名称:xbmc,代码行数:96,代码来源:StereoscopicsManager.cpp

示例14: OnPlaybackStarted

void CStereoscopicsManager::OnPlaybackStarted(void)
{
  if (!g_infoManager.EvaluateBool("videoplayer.isstereoscopic"))
    return;

  // only change stereo mode if not yet in stereo mode
  RENDER_STEREO_MODE mode = GetStereoMode();
  if (mode != RENDER_STEREO_MODE_OFF)
    return;

  int playbackMode = CSettings::Get().GetInt("videoplayer.stereoscopicplaybackmode");
  switch (playbackMode)
  {
  case 0: // Ask
    {
      CApplicationMessenger::Get().MediaPause();

      CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
      pDlgSelect->Reset();
      pDlgSelect->SetHeading(g_localizeStrings.Get(36527).c_str());

      RENDER_STEREO_MODE preferred = GetPreferredPlaybackMode();
      RENDER_STEREO_MODE playing   = GetStereoModeOfPlayingVideo();

      int idx_preferred = -1
        , idx_playing   = -1
        , idx_mono      = -1
        , idx_select    = -1;

      // add choices
      idx_preferred = pDlgSelect->Add( g_localizeStrings.Get(36530)
                                     + " ("
                                     + GetLabelForStereoMode(preferred)
                                     + ")");

      if(preferred != RENDER_STEREO_MODE_MONO)
        idx_mono = pDlgSelect->Add( g_localizeStrings.Get(36529) ); // mono / 2d


      if(playing != RENDER_STEREO_MODE_OFF && g_Windowing.SupportsStereo(playing))
        idx_playing = pDlgSelect->Add( g_localizeStrings.Get(36532)
                                    + " ("
                                    + GetLabelForStereoMode(playing)
                                    + ")");

      idx_select = pDlgSelect->Add( g_localizeStrings.Get(36531) ); // other / select

      pDlgSelect->DoModal();

      if(pDlgSelect->IsConfirmed())
      {
        int iItem = pDlgSelect->GetSelectedLabel();
        if      (iItem == idx_preferred) mode = preferred;
        else if (iItem == idx_mono)      mode = RENDER_STEREO_MODE_MONO;
        else if (iItem == idx_playing)   mode = playing;
        else if (iItem == idx_select)    mode = GetStereoModeByUserChoice();

        SetStereoMode(mode);
      }

      CApplicationMessenger::Get().MediaUnPause();
    }
    break;
  case 1: // Stereoscopic
    SetStereoMode( GetPreferredPlaybackMode() );
    break;
  default:
    break;
  }
}
开发者ID:MrBishop,项目名称:xbmc,代码行数:70,代码来源:StereoscopicsManager.cpp

示例15: OnSettingAction

void CGUIDialogContentSettings::OnSettingAction(std::shared_ptr<const CSetting> setting)
{
  if (setting == NULL)
    return;

  CGUIDialogSettingsManualBase::OnSettingAction(setting);

  const std::string &settingId = setting->GetId();

  if (settingId == SETTING_CONTENT_TYPE)
  {
    std::vector<std::pair<std::string, int>> labels;
    if (m_content == CONTENT_ALBUMS || m_content == CONTENT_ARTISTS)
    {
      labels.push_back(std::make_pair(ADDON::TranslateContent(m_content, true), m_content));
    }
    else
    {
      labels.push_back(std::make_pair(ADDON::TranslateContent(CONTENT_NONE, true), CONTENT_NONE));
      labels.push_back(std::make_pair(ADDON::TranslateContent(CONTENT_MOVIES, true), CONTENT_MOVIES));
      labels.push_back(std::make_pair(ADDON::TranslateContent(CONTENT_TVSHOWS, true), CONTENT_TVSHOWS));
      labels.push_back(std::make_pair(ADDON::TranslateContent(CONTENT_MUSICVIDEOS, true), CONTENT_MUSICVIDEOS));
    }
    std::sort(labels.begin(), labels.end());

    CGUIDialogSelect *dialog = g_windowManager.GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
    if (dialog)
    {
      dialog->SetHeading(CVariant{ 20344 }); //Label "This directory contains"

      int iIndex = 0;
      int iSelected = 0;
      for (const auto &label : labels)
      {
        dialog->Add(label.first);

        if (m_content == label.second)
          iSelected = iIndex;
        iIndex++;
      }

      dialog->SetSelected(iSelected);

      dialog->Open();
      // Selected item has not changes - in case of cancel or the user selecting the same item
      int newSelected = dialog->GetSelectedItem();
      if (!dialog->IsConfirmed() || newSelected < 0 || newSelected == iSelected)
        return;

      auto selected = labels.at(newSelected);
      m_content = static_cast<CONTENT_TYPE>(selected.second);

      AddonPtr scraperAddon;
      if (!CAddonSystemSettings::GetInstance().GetActive(ADDON::ScraperTypeFromContent(m_content), scraperAddon) && m_content != CONTENT_NONE)
        return;

      m_scraper = std::dynamic_pointer_cast<CScraper>(scraperAddon);

      SetupView();
      SetFocus(SETTING_CONTENT_TYPE);
    }
  }
  else if (settingId == SETTING_SCRAPER_LIST)
  {
    ADDON::TYPE type = ADDON::ScraperTypeFromContent(m_content);
    std::string currentScraperId;
    if (m_scraper != nullptr)
      currentScraperId = m_scraper->ID();
    std::string selectedAddonId = currentScraperId;

    if (CGUIWindowAddonBrowser::SelectAddonID(type, selectedAddonId, false) == 1
        && selectedAddonId != currentScraperId)
    {
      AddonPtr scraperAddon;
      CServiceBroker::GetAddonMgr().GetAddon(selectedAddonId, scraperAddon);
      m_scraper = std::dynamic_pointer_cast<CScraper>(scraperAddon);

      SetupView();
      SetFocus(SETTING_SCRAPER_LIST);
    }
  }
  else if (settingId == SETTING_SCRAPER_SETTINGS)
    CGUIDialogAddonSettings::ShowForAddon(m_scraper, false);
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:84,代码来源:GUIDialogContentSettings.cpp


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