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


C++ CGUIDialogMediaSource::DoModal方法代码示例

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


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

示例1: ShowAndAddMediaSource

// \brief Show CGUIDialogMediaSource dialog and prompt for a new media source.
// \return True if the media source is added, false otherwise.
bool CGUIDialogMediaSource::ShowAndAddMediaSource(const CStdString &type)
{
    CGUIDialogMediaSource *dialog = (CGUIDialogMediaSource *)g_windowManager.GetWindow(WINDOW_DIALOG_MEDIA_SOURCE);
    if (!dialog) return false;
    dialog->Initialize();
    dialog->SetShare(CMediaSource());
    dialog->SetTypeOfMedia(type);
    dialog->DoModal();
    bool confirmed(dialog->IsConfirmed());
    if (confirmed)
    {   // yay, add this share
        CMediaSource share;
        unsigned int i,j=2;
        bool bConfirmed=false;
        VECSOURCES* pShares = g_settings.GetSourcesFromType(type);
        CStdString strName = dialog->m_name;
        while (!bConfirmed)
        {
            for (i=0; i<pShares->size(); ++i)
            {
                if ((*pShares)[i].strName.Equals(strName))
                    break;
            }
            if (i < pShares->size()) // found a match -  try next
                strName.Format("%s (%i)",dialog->m_name,j++);
            else
                bConfirmed = true;
        }
        share.FromNameAndPaths(type, strName, dialog->GetPaths());
        if (dialog->m_paths->Size() > 0) {
            share.m_strThumbnailImage = dialog->m_paths->Get(0)->GetThumbnailImage();
        }
        g_settings.AddShare(type, share);

        if (type == "video")
        {
            if (dialog->m_bRunScan)
            {
                CGUIDialogVideoScan* scanner = (CGUIDialogVideoScan*)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
                if (scanner)
                    scanner->StartScanning(share.strPath, true);
            }
        }
    }
    dialog->m_paths->Clear();
    return confirmed;
}
开发者ID:0wing,项目名称:xbmc,代码行数:49,代码来源:GUIDialogMediaSource.cpp

示例2: ShowAndAddMediaSource

// \brief Show CGUIDialogMediaSource dialog and prompt for a new media source.
// \return True if the media source is added, false otherwise.
bool CGUIDialogMediaSource::ShowAndAddMediaSource(const CStdString &type)
{
  CGUIDialogMediaSource *dialog = (CGUIDialogMediaSource *)g_windowManager.GetWindow(WINDOW_DIALOG_MEDIA_SOURCE);
  if (!dialog) return false;
  dialog->Initialize();
  dialog->SetShare(CMediaSource());
  dialog->SetTypeOfMedia(type);
  dialog->DoModal();
  bool confirmed(dialog->IsConfirmed());
  if (confirmed)
  { // yay, add this share
    CMediaSource share;
    unsigned int i,j=2;
    bool bConfirmed=false;
    VECSOURCES* pShares = CMediaSourceSettings::Get().GetSources(type);
    CStdString strName = dialog->m_name;
    while (!bConfirmed)
    {
      for (i=0;i<pShares->size();++i)
      {
        if ((*pShares)[i].strName.Equals(strName))
          break;
      }
      if (i < pShares->size()) // found a match -  try next
        strName = StringUtils::Format("%s (%i)", dialog->m_name.c_str(), j++);
      else
        bConfirmed = true;
    }
    share.FromNameAndPaths(type, strName, dialog->GetPaths());
    if (dialog->m_paths->Size() > 0) {
      share.m_strThumbnailImage = dialog->m_paths->Get(0)->GetArt("thumb");
    }
    CMediaSourceSettings::Get().AddShare(type, share);
  }
  dialog->m_paths->Clear();
  return confirmed;
}
开发者ID:DasMarx,项目名称:xbmc,代码行数:39,代码来源:GUIDialogMediaSource.cpp

示例3: ShowAndEditMediaSource

bool CGUIDialogMediaSource::ShowAndEditMediaSource(const CStdString &type, const CMediaSource &share)
{
    CStdString strOldName = share.strName;
    CGUIDialogMediaSource *dialog = (CGUIDialogMediaSource *)g_windowManager.GetWindow(WINDOW_DIALOG_MEDIA_SOURCE);
    if (!dialog) return false;
    dialog->Initialize();
    dialog->SetShare(share);
    dialog->SetTypeOfMedia(type, true);
    dialog->DoModal();
    bool confirmed(dialog->IsConfirmed());
    if (confirmed)
    {   // yay, add this share
        unsigned int i,j=2;
        bool bConfirmed=false;
        VECSOURCES* pShares = g_settings.GetSourcesFromType(type);
        CStdString strName = dialog->m_name;
        while (!bConfirmed)
        {
            for (i=0; i<pShares->size(); ++i)
            {
                if ((*pShares)[i].strName.Equals(strName))
                    break;
            }
            if (i < pShares->size() && (*pShares)[i].strName != strOldName) // found a match -  try next
                strName.Format("%s (%i)",dialog->m_name,j++);
            else
                bConfirmed = true;
        }

        CMediaSource newShare;
        newShare.FromNameAndPaths(type, strName, dialog->GetPaths());
        g_settings.UpdateShare(type, strOldName, newShare);
    }
    dialog->m_paths->Clear();
    return confirmed;
}
开发者ID:0wing,项目名称:xbmc,代码行数:36,代码来源:GUIDialogMediaSource.cpp


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