本文整理汇总了C++中CGUIDialogMediaSource类的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogMediaSource类的具体用法?C++ CGUIDialogMediaSource怎么用?C++ CGUIDialogMediaSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGUIDialogMediaSource类的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;
}
示例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;
}
示例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;
}