本文整理汇总了C++中VECSOURCES类的典型用法代码示例。如果您正苦于以下问题:C++ VECSOURCES类的具体用法?C++ VECSOURCES怎么用?C++ VECSOURCES使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VECSOURCES类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetNetworkLocations
void CMediaManager::GetNetworkLocations(VECSOURCES &locations, bool autolocations)
{
// Load our xml file
LoadSources();
for (unsigned int i = 0; i < m_locations.size(); i++)
{
CMediaSource share;
share.strPath = m_locations[i].path;
CURL url(share.strPath);
share.strName = url.GetWithoutUserDetails();
locations.push_back(share);
}
if (autolocations)
{
CMediaSource share;
share.m_ignore = true;
#ifdef HAS_FILESYSTEM_SMB
share.strPath = "smb://";
share.strName = g_localizeStrings.Get(20171);
locations.push_back(share);
#endif
#ifdef HAS_FILESYSTEM_NFS
share.strPath = "nfs://";
share.strName = g_localizeStrings.Get(20259);
locations.push_back(share);
#endif// HAS_FILESYSTEM_NFS
#ifdef HAS_UPNP
if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_SERVICES_UPNP))
{
std::string strDevices = g_localizeStrings.Get(33040); //"% Devices"
share.strPath = "upnp://";
share.strName = StringUtils::Format(strDevices.c_str(), "UPnP"); //"UPnP Devices"
locations.push_back(share);
}
#endif
#ifdef HAS_ZEROCONF
share.strPath = "zeroconf://";
share.strName = g_localizeStrings.Get(20262);
locations.push_back(share);
#endif
if (CServiceBroker::IsBinaryAddonCacheUp())
{
for (const auto& addon : CServiceBroker::GetVFSAddonCache().GetAddonInstances())
{
const auto& info = addon->GetProtocolInfo();
if (!info.type.empty() && info.supportBrowsing)
{
share.strPath = info.type + "://";
share.strName = g_localizeStrings.Get(info.label);
locations.push_back(share);
}
}
}
}
}
开发者ID:Arcko,项目名称:xbmc,代码行数:59,代码来源:MediaManager.cpp
示例2: OnServerBrowse
void CGUIDialogNetworkSetup::OnServerBrowse()
{
// open a filebrowser dialog with the current address
VECSOURCES shares;
std::string path = ConstructPath();
// get the share as the base path
CMediaSource share;
std::string basePath = path;
std::string tempPath;
while (URIUtils::GetParentPath(basePath, tempPath))
basePath = tempPath;
share.strPath = basePath;
// don't include the user details in the share name
CURL url(share.strPath);
share.strName = url.GetWithoutUserDetails();
shares.push_back(share);
if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(1015), path))
{
SetPath(path);
UpdateButtons();
}
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:22,代码来源:GUIDialogNetworkSetup.cpp
示例3: SetupShares
CStdString CGUIWindowMusicSongs::GetStartFolder(const CStdString &dir)
{
SetupShares();
VECSOURCES shares;
m_rootDir.GetSources(shares);
bool bIsSourceName = false;
int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName);
if (iIndex > -1)
{
if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2)
{
CFileItem item(shares[iIndex]);
if (!g_passwordManager.IsItemUnlocked(&item,"music"))
return "";
}
// set current directory to matching share
if (bIsSourceName)
return shares[iIndex].strPath;
return dir;
}
return CGUIWindowMusicBase::GetStartFolder(dir);
}
开发者ID:Foozle303,项目名称:xbmc,代码行数:22,代码来源:GUIWindowMusicSongs.cpp
示例4: GetDirectory
bool CSourcesDirectory::GetDirectory(const VECSOURCES &sources, CFileItemList &items)
{
for (unsigned int i = 0; i < sources.size(); ++i)
{
const CMediaSource& share = sources[i];
CFileItemPtr pItem(new CFileItem(share));
if (StringUtils::StartsWithNoCase(pItem->GetPath(), "musicsearch://"))
pItem->SetCanQueue(false);
CStdString strIcon;
// We have the real DVD-ROM, set icon on disktype
if (share.m_iDriveType == CMediaSource::SOURCE_TYPE_DVD && share.m_strThumbnailImage.empty())
{
CUtil::GetDVDDriveIcon( pItem->GetPath(), strIcon );
// CDetectDVDMedia::SetNewDVDShareUrl() caches disc thumb as special://temp/dvdicon.tbn
CStdString strThumb = "special://temp/dvdicon.tbn";
if (XFILE::CFile::Exists(strThumb))
pItem->SetArt("thumb", strThumb);
}
else if (StringUtils::StartsWith(pItem->GetPath(), "addons://"))
strIcon = "DefaultHardDisk.png";
else if ( pItem->IsVideoDb()
|| pItem->IsMusicDb()
|| pItem->IsPlugin()
|| pItem->GetPath() == "special://musicplaylists/"
|| pItem->GetPath() == "special://videoplaylists/"
|| pItem->GetPath() == "musicsearch://")
strIcon = "DefaultFolder.png";
else if (pItem->IsRemote())
strIcon = "DefaultNetwork.png";
else if (pItem->IsISO9660())
strIcon = "DefaultDVDRom.png";
else if (pItem->IsDVD())
strIcon = "DefaultDVDRom.png";
else if (pItem->IsCDDA())
strIcon = "DefaultCDDA.png";
else if (pItem->IsRemovable() && g_TextureManager.HasTexture("DefaultRemovableDisk.png"))
strIcon = "DefaultRemovableDisk.png";
else
strIcon = "DefaultHardDisk.png";
pItem->SetIconImage(strIcon);
if (share.m_iHasLock == 2 && CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_LOCKED);
else
pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_NONE);
items.Add(pItem);
}
return true;
}
开发者ID:DasMarx,项目名称:xbmc,代码行数:51,代码来源:SourcesDirectory.cpp
示例5: GetSources
void CVirtualDirectory::GetSources(VECSOURCES &shares) const
{
shares = m_vecSources;
// add our plug n play shares
if (m_allowNonLocalSources)
g_mediaManager.GetRemovableDrives(shares);
#ifdef HAS_DVD_DRIVE
// and update our dvd share
for (unsigned int i = 0; i < shares.size(); ++i)
{
CMediaSource& share = shares[i];
if (share.m_iDriveType == CMediaSource::SOURCE_TYPE_DVD)
{
if(g_mediaManager.IsAudio(share.strPath))
{
share.strStatus = "Audio-CD";
share.strPath = "cdda://local/";
share.strDiskUniqueId = "";
}
else
{
share.strStatus = g_mediaManager.GetDiskLabel(share.strPath);
share.strDiskUniqueId = g_mediaManager.GetDiskUniqueId(share.strPath);
if (!share.strPath.length()) // unmounted CD
{
if (g_mediaManager.GetDiscPath() == "iso9660://")
share.strPath = "iso9660://";
else
// share is unmounted and not iso9660, discard it
shares.erase(shares.begin() + i--);
}
}
}
}
#endif
}
开发者ID:RalfK,项目名称:spotyxbmc2-pvr,代码行数:38,代码来源:VirtualDirectory.cpp
示例6: GetMatchingSource
bool CVirtualPathDirectory::GetMatchingSource(const CStdString &strPath, CMediaSource& share)
{
CStdString strType, strSource;
if (!GetTypeAndSource(strPath, strType, strSource))
return false;
// no support for "files" operation
if (strType == "files")
return false;
VECSOURCES *VECSOURCES = g_settings.GetSourcesFromType(strType);
if (!VECSOURCES)
return false;
bool bIsSourceName = false;
int iIndex = CUtil::GetMatchingSource(strSource, *VECSOURCES, bIsSourceName);
if (!bIsSourceName)
return false;
if (iIndex < 0 || iIndex >= (int)VECSOURCES->size())
return false;
share = (*VECSOURCES)[iIndex];
return true;
}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:23,代码来源:VirtualPathDirectory.cpp
示例7: GetRemovableDrives
void CHALProvider::GetRemovableDrives(VECSOURCES &removableDrives)
{
std::vector<CStorageDevice> devices = g_HalManager.GetVolumeDevices();
for (size_t i = 0; i < devices.size(); i++)
{
if (devices[i].Mounted && devices[i].Approved && devices[i].HotPlugged)
{
CMediaSource share;
devices[i].toMediaSource(&share);
removableDrives.push_back(share);
}
}
}
开发者ID:AWilco,项目名称:xbmc,代码行数:14,代码来源:HALProvider.cpp
示例8: sectionElement
bool CMediaSourceSettings::SetSources(TiXmlNode *root, const char *section, const VECSOURCES &shares, const std::string &defaultPath) const
{
TiXmlElement sectionElement(section);
TiXmlNode *sectionNode = root->InsertEndChild(sectionElement);
if (sectionNode == NULL)
return false;
XMLUtils::SetPath(sectionNode, "default", defaultPath);
for (CIVECSOURCES it = shares.begin(); it != shares.end(); it++)
{
const CMediaSource &share = *it;
if (share.m_ignore)
continue;
TiXmlElement source(XML_SOURCE);
XMLUtils::SetString(&source, "name", share.strName);
for (unsigned int i = 0; i < share.vecPaths.size(); i++)
XMLUtils::SetPath(&source, "path", share.vecPaths[i]);
if (share.m_iHasLock)
{
XMLUtils::SetInt(&source, "lockmode", share.m_iLockMode);
XMLUtils::SetString(&source, "lockcode", share.m_strLockCode);
XMLUtils::SetInt(&source, "badpwdcount", share.m_iBadPwdCount);
}
if (!share.m_strThumbnailImage.empty())
XMLUtils::SetPath(&source, "thumbnail", share.m_strThumbnailImage);
XMLUtils::SetBoolean(&source, "allowsharing", share.m_allowSharing);
sectionNode->InsertEndChild(source);
}
return true;
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:37,代码来源:MediaSourceSettings.cpp
示例9: confirmed
// \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
示例10: GetNetworkLocations
void CMediaManager::GetNetworkLocations(VECSOURCES &locations, bool autolocations)
{
// Load our xml file
LoadSources();
for (unsigned int i = 0; i < m_locations.size(); i++)
{
CMediaSource share;
share.strPath = m_locations[i].path;
CURL url(share.strPath);
share.strName = url.GetWithoutUserDetails();
locations.push_back(share);
}
if (autolocations)
{
CMediaSource share;
share.m_ignore = true;
#ifdef HAS_FILESYSTEM_SMB
share.strPath = "smb://";
share.strName = g_localizeStrings.Get(20171);
locations.push_back(share);
#endif
#ifdef HAS_FILESYSTEM_NFS
share.strPath = "nfs://";
share.strName = g_localizeStrings.Get(20259);
locations.push_back(share);
#endif// HAS_FILESYSTEM_NFS
share.strPath = "upnp://";
share.strName = "UPnP Devices";
locations.push_back(share);
share.strPath = "zeroconf://";
share.strName = "Zeroconf Browser";
locations.push_back(share);
}
}
开发者ID:OV3RDOSE,项目名称:xbmc,代码行数:37,代码来源:MediaManager.cpp
示例11: GetRemovableDrives
void CAndroidStorageProvider::GetRemovableDrives(VECSOURCES &removableDrives)
{
for (const auto& mountStr : GetRemovableDrives())
{
// Reject unreadable
if (XFILE::CDirectory::Exists(mountStr))
{
CMediaSource share;
share.strPath = unescape(mountStr);
share.strName = URIUtils::GetFileName(mountStr);
share.m_ignore = true;
removableDrives.push_back(share);
}
}
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:15,代码来源:AndroidStorageProvider.cpp
示例12: IsDatabasePathUnlocked
bool CGUIPassword::IsDatabasePathUnlocked(const std::string& strPath, VECSOURCES& vecSources)
{
if (g_passwordManager.bMasterUser || CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE)
return true;
// try to find the best matching source
bool bName = false;
int iIndex = CUtil::GetMatchingSource(strPath, vecSources, bName);
if (iIndex > -1 && iIndex < (int)vecSources.size())
if (vecSources[iIndex].m_iHasLock < 2)
return true;
return false;
}
开发者ID:topfs2,项目名称:xbmc-cmake,代码行数:15,代码来源:GUIPassword.cpp
示例13: SetImage
/*! \brief Set a skin image setting.
* \param params The parameters.
* \details params[0] = Name of skin setting.
* params[1] = Extra URL to allow selection from (optional).
*/
static int SetImage(const std::vector<std::string>& params)
{
int string = CSkinSettings::Get().TranslateString(params[0]);
std::string value = CSkinSettings::Get().GetString(string);
VECSOURCES localShares;
g_mediaManager.GetLocalDrives(localShares);
if (params.size() > 1)
{
value = params[1];
URIUtils::AddSlashAtEnd(value);
bool bIsSource;
if (CUtil::GetMatchingSource(value,localShares,bIsSource) < 0) // path is outside shares - add it as a separate one
{
CMediaSource share;
share.strName = g_localizeStrings.Get(13278);
share.strPath = value;
localShares.push_back(share);
}
}
if (CGUIDialogFileBrowser::ShowAndGetImage(localShares, g_localizeStrings.Get(1030), value))
CSkinSettings::Get().SetString(string, value);
return 0;
}
开发者ID:Nomoreillusion,项目名称:kodi-cmake,代码行数:29,代码来源:SkinBuiltins.cpp
示例14: SetupShares
CStdString CGUIWindowPictures::GetStartFolder(const CStdString &dir)
{
if (dir.Equals("Plugins") || dir.Equals("Addons"))
return "addons://sources/image/";
SetupShares();
VECSOURCES shares;
m_rootDir.GetSources(shares);
bool bIsSourceName = false;
int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName);
if (iIndex > -1)
{
if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2)
{
CFileItem item(shares[iIndex]);
if (!g_passwordManager.IsItemUnlocked(&item,"pictures"))
return "";
}
if (bIsSourceName)
return shares[iIndex].strPath;
return dir;
}
return CGUIMediaWindow::GetStartFolder(dir);
}
开发者ID:CybeSystems,项目名称:XBMCPortable,代码行数:24,代码来源:GUIWindowPictures.cpp
示例15: confirmed
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
示例16: GetRootDirectory
JSONRPC_STATUS CFileOperations::GetRootDirectory(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CStdString media = parameterObject["media"].asString();
media = media.ToLower();
VECSOURCES *sources = g_settings.GetSourcesFromType(media);
if (sources)
{
CFileItemList items;
for (unsigned int i = 0; i < (unsigned int)sources->size(); i++)
{
// Do not show sources which are locked
if (sources->at(i).m_iHasLock == 2)
continue;
items.Add(CFileItemPtr(new CFileItem(sources->at(i))));
}
for (unsigned int i = 0; i < (unsigned int)items.Size(); i++)
{
if (items[i]->IsSmb())
{
CURL url(items[i]->GetPath());
items[i]->SetPath(url.GetWithoutUserDetails());
}
}
CVariant param = parameterObject;
param["properties"] = CVariant(CVariant::VariantTypeArray);
param["properties"].append("file");
HandleFileItemList(NULL, true, "sources", items, param, result);
}
return OK;
}
开发者ID:madhatterpa,项目名称:xbmc,代码行数:36,代码来源:FileOperations.cpp
示例17: GetSources
bool CMediaSourceSettings::DeleteSource(const std::string &strType, const std::string &strName, const std::string &strPath, bool virtualSource /* = false */)
{
VECSOURCES *pShares = GetSources(strType);
if (pShares == NULL)
return false;
bool found = false;
for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++)
{
if (it->strName == strName && it->strPath == strPath)
{
CLog::Log(LOGDEBUG, "CMediaSourceSettings: found share, removing!");
pShares->erase(it);
found = true;
break;
}
}
if (virtualSource)
return found;
return Save();
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:24,代码来源:MediaSourceSettings.cpp
示例18: GetMemoryUnitSources
void CMemoryUnitManager::GetMemoryUnitSources(VECSOURCES &shares)
{
for (unsigned int i = 0; i < m_memUnits.size(); i++)
{
CMediaSource share;
CStdString volumeName = m_memUnits[i]->GetVolumeName();
volumeName.TrimRight(' ');
// Memory Unit # (volumeName) (fs)
if (volumeName.IsEmpty())
share.strName.Format("%s %i (%s)", g_localizeStrings.Get(20136).c_str(), i + 1, m_memUnits[i]->GetFileSystem());
else
share.strName.Format("%s %i (%s) (%s)", g_localizeStrings.Get(20136).c_str(), i + 1, volumeName.c_str(), m_memUnits[i]->GetFileSystem());
share.strPath.Format("mem%i://", i);
shares.push_back(share);
}
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:16,代码来源:MemoryUnitManager.cpp
示例19: GetEnvironmentVariable
void CWin32StorageProvider::GetLocalDrives(VECSOURCES &localDrives)
{
CMediaSource share;
wchar_t profilePath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_PROFILE, nullptr, 0, profilePath)) ||
GetEnvironmentVariable(L"USERPROFILE", profilePath, MAX_PATH) > 0)
share.strPath = KODI::PLATFORM::WINDOWS::FromW(profilePath);
else
share.strPath = CSpecialProtocol::TranslatePath("special://home");
share.strName = g_localizeStrings.Get(21440);
share.m_ignore = true;
share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL;
localDrives.push_back(share);
GetDrivesByType(localDrives, LOCAL_DRIVES);
}
开发者ID:Arcko,项目名称:xbmc,代码行数:16,代码来源:Win32StorageProvider.cpp
示例20: AddItemPathToFileBrowserSources
void CGUIDialogMusicInfo::AddItemPathToFileBrowserSources(VECSOURCES &sources, const CFileItem &item)
{
std::string itemDir;
if (item.HasMusicInfoTag() && item.GetMusicInfoTag()->GetType() == MediaTypeSong)
itemDir = URIUtils::GetParentPath(item.GetMusicInfoTag()->GetURL());
else
itemDir = item.GetPath();
if (!itemDir.empty() && CDirectory::Exists(itemDir))
{
CMediaSource itemSource;
itemSource.strName = g_localizeStrings.Get(36041);
itemSource.strPath = itemDir;
sources.push_back(itemSource);
}
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:17,代码来源:GUIDialogMusicInfo.cpp
注:本文中的VECSOURCES类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论