本文整理汇总了C++中CFileItemList::GetList方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::GetList方法的具体用法?C++ CFileItemList::GetList怎么用?C++ CFileItemList::GetList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::GetList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPrepareFileItems
void CGUIWindowPVRRecordings::OnPrepareFileItems(CFileItemList& items)
{
if (items.IsEmpty())
return;
CFileItemList files;
VECFILEITEMS vecItems = items.GetList();
for (VECFILEITEMS::const_iterator it = vecItems.begin(); it != vecItems.end(); ++it)
{
if (!(*it)->m_bIsFolder)
files.Add((*it));
}
if (!files.IsEmpty())
{
if (m_database.Open())
{
CGUIWindowVideoNav::LoadVideoInfo(files, m_database, false);
m_database.Close();
}
m_thumbLoader.Load(files);
}
CGUIWindowPVRBase::OnPrepareFileItems(items);
}
示例2: DeleteDirectory
bool CPVRRecordings::DeleteDirectory(const CFileItem& directory)
{
CFileItemList items;
XFILE::CDirectory::GetDirectory(directory.GetPath(), items);
bool allDeleted = true;
VECFILEITEMS itemList = items.GetList();
CFileItem item;
for (VECFILEITEMS::const_iterator it = itemList.begin(); it != itemList.end(); ++it)
allDeleted &= Delete(*(it->get()));
return allDeleted;
}
示例3: DeleteDirectory
bool CPVRRecordings::DeleteDirectory(const CFileItem& directory)
{
CFileItemList items;
XFILE::CDirectory::GetDirectory(directory.GetPath(), items);
bool allDeleted = true;
VECFILEITEMS itemList = items.GetList();
CFileItem item;
for (const auto item : itemList)
allDeleted &= Delete(*(item.get()));
return allDeleted;
}
示例4: SearchAndSetChannelIcons
void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
std::string iconPath = CServiceBroker::GetSettings().GetString(CSettings::SETTING_PVRMENU_ICONPATH);
if (iconPath.empty())
return;
/* fetch files in icon path for fast lookup */
CFileItemList fileItemList;
XFILE::CDirectory::GetDirectory(iconPath, fileItemList, ".jpg|.png|.tbn");
if (fileItemList.IsEmpty())
return;
CGUIDialogProgressBarHandle* dlgProgressHandle = g_PVRManager.ShowProgressDialog(g_localizeStrings.Get(19286)); // Searching for channel icons
CSingleLock lock(m_critSection);
/* create a map for fast lookup of normalized file base name */
std::map<std::string, std::string> fileItemMap;
const VECFILEITEMS &items = fileItemList.GetList();
for(VECFILEITEMS::const_iterator it = items.begin(); it != items.end(); ++it)
{
std::string baseName = URIUtils::GetFileName((*it)->GetPath());
URIUtils::RemoveExtension(baseName);
StringUtils::ToLower(baseName);
fileItemMap.insert(std::make_pair(baseName, (*it)->GetPath()));
}
int channelIndex = 0;
CPVRChannelPtr channel;
for(PVR_CHANNEL_GROUP_MEMBERS::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
{
channel = it->second.channel;
/* update progress dialog */
if (dlgProgressHandle)
{
dlgProgressHandle->SetProgress(channelIndex++, m_members.size());
dlgProgressHandle->SetText(channel->ChannelName());
}
/* skip if an icon is already set and exists */
if (channel->IsIconExists())
continue;
/* reset icon before searching for a new one */
channel->SetIconPath("");
std::string strChannelUid = StringUtils::Format("%08d", channel->UniqueID());
std::string strLegalClientChannelName = CUtil::MakeLegalFileName(channel->ClientChannelName());
StringUtils::ToLower(strLegalClientChannelName);
std::string strLegalChannelName = CUtil::MakeLegalFileName(channel->ChannelName());
StringUtils::ToLower(strLegalChannelName);
std::map<std::string, std::string>::iterator itItem;
if ((itItem = fileItemMap.find(strLegalClientChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strLegalChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strChannelUid)) != fileItemMap.end())
{
channel->SetIconPath(itItem->second, g_advancedSettings.m_bPVRAutoScanIconsUserSet);
}
if (bUpdateDb)
channel->Persist();
//! @todo start channel icon scraper here if nothing was found
}
if (dlgProgressHandle)
dlgProgressHandle->MarkFinished();
}
示例5: SearchAndSetChannelIcons
void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
std::string iconPath = CSettings::Get().GetString("pvrmenu.iconpath");
if (iconPath.empty())
return;
CPVRDatabase *database = GetPVRDatabase();
if (!database)
return;
/* fetch files in icon path for fast lookup */
CFileItemList fileItemList;
XFILE::CDirectory::GetDirectory(iconPath, fileItemList, ".jpg|.png|.tbn");
if (fileItemList.IsEmpty())
return;
CGUIDialogExtendedProgressBar* dlgProgress = (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
CGUIDialogProgressBarHandle* dlgProgressHandle = dlgProgress ? dlgProgress->GetHandle(g_localizeStrings.Get(19287)) : NULL;
CSingleLock lock(m_critSection);
/* create a map for fast lookup of normalized file base name */
std::map<std::string, std::string> fileItemMap;
const VECFILEITEMS &items = fileItemList.GetList();
for(VECFILEITEMS::const_iterator it = items.begin(); it != items.end(); ++it)
{
std::string baseName = URIUtils::GetFileName((*it)->GetPath());
URIUtils::RemoveExtension(baseName);
StringUtils::ToLower(baseName);
fileItemMap.insert(std::make_pair(baseName, (*it)->GetPath()));
}
int channelIndex = 0;
for(std::vector<PVRChannelGroupMember>::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
{
CPVRChannelPtr channel = (*it).channel;
/* update progress dialog */
if (dlgProgressHandle)
{
dlgProgressHandle->SetProgress(channelIndex++, m_members.size());
dlgProgressHandle->SetText(channel->ChannelName());
}
/* skip if an icon is already set and exists */
if (channel->IsIconExists())
continue;
/* reset icon before searching for a new one */
channel->SetIconPath("");
std::string strChannelUid = StringUtils::Format("%08d", channel->UniqueID());
std::string strLegalClientChannelName = CUtil::MakeLegalFileName(channel->ClientChannelName());
StringUtils::ToLower(strLegalClientChannelName);
std::string strLegalChannelName = CUtil::MakeLegalFileName(channel->ChannelName());
StringUtils::ToLower(strLegalChannelName);
std::map<std::string, std::string>::iterator itItem;
if ((itItem = fileItemMap.find(strLegalClientChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strLegalChannelName)) != fileItemMap.end() ||
(itItem = fileItemMap.find(strChannelUid)) != fileItemMap.end())
{
channel->SetIconPath(itItem->second, g_advancedSettings.m_bPVRAutoScanIconsUserSet);
}
if (bUpdateDb)
channel->Persist();
/* TODO: start channel icon scraper here if nothing was found */
}
if (dlgProgressHandle)
dlgProgressHandle->MarkFinished();
}
示例6: baseUrl
// this functions can check for:
// * presence of directory on remove share (smb://server/share/dir)
// * presence of remote share on server (smb://server/share)
// * presence of smb server in network (smb://server)
bool CWin32SMBDirectory::RealExists(const CURL& url, bool tryToConnect)
{
assert(url.GetProtocol() == "smb");
if (url.GetHostName().empty())
return true; // 'root' of network is always exist
// TODO: use real caseless string comparison everywhere in this function
if (url.GetShareName().empty() || url.GetShareName() == url.GetFileName())
{
if (!url.GetShareName().empty())
{
std::wstring serverNameW;
std::wstring shareNameW;
SHARE_INFO_1* info = NULL;
// try fast way
if (g_charsetConverter.utf8ToW("\\\\" + url.GetHostName(), serverNameW, false, false, true) &&
g_charsetConverter.utf8ToW(url.GetShareName(), shareNameW, false, false, true) &&
NetShareGetInfo((LPWSTR)serverNameW.c_str(), (LPWSTR)shareNameW.c_str(), 1, (LPBYTE*)&info) == NERR_Success)
{
const bool ret = ((info->shi1_type & STYPE_MASK) == STYPE_DISKTREE);
NetApiBufferFree(info);
return ret;
}
// fallback to slow check
}
CFileItemList entries;
CURL baseUrl(url);
if (url.GetShareName().empty())
baseUrl.SetHostName(""); // scan network for servers
else
{
baseUrl.Reset(); // hack to reset ShareName
baseUrl.SetProtocol("smb");
baseUrl.SetHostName(url.GetHostName()); // scan server for shares
}
if (!GetNetworkResources(baseUrl, entries))
{
if (tryToConnect && !url.GetShareName().empty())
{
CURL authUrl(url);
if (ConnectAndAuthenticate(authUrl))
return RealExists(authUrl, false);
}
return false;
}
const std::string& searchStr = (url.GetShareName().empty()) ? url.GetHostName() : url.GetShareName();
const VECFILEITEMS entrVec = entries.GetList();
for (VECFILEITEMS::const_iterator it = entrVec.begin(); it != entrVec.end(); ++it)
{
if ((*it)->GetLabel() == searchStr)
return true;
}
return false;
}
// use standard win32 file API
std::wstring nameW(prepareWin32SMBDirectoryName(url));
if (nameW.empty())
return false;
DWORD fileAttrs = GetFileAttributesW(nameW.c_str());
if (fileAttrs != INVALID_FILE_ATTRIBUTES)
return (fileAttrs & FILE_ATTRIBUTE_DIRECTORY) != 0; // is file or directory?
if (tryToConnect)
{
CURL authUrl(url);
if (ConnectAndAuthenticate(authUrl))
return RealExists(authUrl, false);
}
return false;
}