本文整理汇总了C++中CFileItemList::ClearItems方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::ClearItems方法的具体用法?C++ CFileItemList::ClearItems怎么用?C++ CFileItemList::ClearItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::ClearItems方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateListing
void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders)
{
items.ClearItems();
for (unsigned i=0; i < addons.size(); i++)
{
AddonPtr addon = addons[i];
CFileItemPtr pItem;
if (reposAsFolders && addon->Type() == ADDON_REPOSITORY)
pItem = FileItemFromAddon(addon, "addons://", true);
else
pItem = FileItemFromAddon(addon, path.Get(), false);
AddonPtr addon2;
if (CAddonMgr::Get().GetAddon(addon->ID(),addon2))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305));
else if (CAddonMgr::Get().IsAddonDisabled(addon->ID()))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023));
if (addon->Props().broken == "DEPSNOTMET")
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24049));
else if (!addon->Props().broken.empty())
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098));
if (addon2 && addon2->Version() < addon->Version())
{
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068));
pItem->SetProperty("Addon.UpdateAvail", true);
}
CAddonDatabase::SetPropertiesFromAddon(addon,pItem);
items.Add(pItem);
}
}
示例2: GenerateListing
void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders)
{
CStdString xbmcPath = CSpecialProtocol::TranslatePath("special://xbmc/addons");
items.ClearItems();
CAddonDatabase db;
db.Open();
for (unsigned i=0; i < addons.size(); i++)
{
AddonPtr addon = addons[i];
CFileItemPtr pItem;
if (reposAsFolders && addon->Type() == ADDON_REPOSITORY)
pItem = FileItemFromAddon(addon, "addons://", true);
else
pItem = FileItemFromAddon(addon, path.Get(), false);
AddonPtr addon2;
if (CAddonMgr::Get().GetAddon(addon->ID(),addon2))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305));
else if (db.IsOpen() && db.IsAddonDisabled(addon->ID()))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023));
if (!addon->Props().broken.IsEmpty())
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098));
if (addon2 && addon2->Version() < addon->Version())
{
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068));
pItem->SetProperty("Addon.UpdateAvail", true);
}
CAddonDatabase::SetPropertiesFromAddon(addon,pItem);
items.Add(pItem);
}
db.Close();
}
示例3: GenerateListing
void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders)
{
CStdString xbmcPath = _P("special://xbmc/addons");
items.ClearItems();
for (unsigned i=0; i < addons.size(); i++)
{
AddonPtr addon = addons[i];
CFileItemPtr pItem;
if (reposAsFolders && addon->Type() == ADDON_REPOSITORY)
pItem = FileItemFromAddon(addon, "addons://", true);
else
pItem = FileItemFromAddon(addon, path.Get(), false);
AddonPtr addon2;
if (CAddonMgr::Get().GetAddon(addon->ID(),addon2))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305));
else if ((addon->Type() == ADDON_PVRDLL) && (CStdString(pItem->GetProperty("Addon.Path").asString()).Left(xbmcPath.size()).Equals(xbmcPath)))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023));
if (!addon->Props().broken.IsEmpty())
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098));
if (addon2 && addon2->Version() < addon->Version())
{
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068));
pItem->SetProperty("Addon.UpdateAvail", true);
}
CAddonDatabase::SetPropertiesFromAddon(addon,pItem);
items.Add(pItem);
}
}
示例4: GetDirectory
bool CGUIWindowEventLog::GetDirectory(const std::string &strDirectory, CFileItemList &items)
{
bool result = CGUIMediaWindow::GetDirectory(strDirectory, items);
EventLevel currentLevel = CViewStateSettings::GetInstance().GetEventLevel();
bool showHigherLevels = CViewStateSettings::GetInstance().ShowHigherEventLevels();
CFileItemList filteredItems(items.GetPath());
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if (item->IsParentFolder())
{
filteredItems.Add(item);
continue;
}
if (!item->HasProperty(PROPERTY_EVENT_LEVEL))
continue;
EventLevel level = CEventLog::GetInstance().EventLevelFromString(item->GetProperty(PROPERTY_EVENT_LEVEL).asString());
if (level == currentLevel ||
(level > currentLevel && showHigherLevels))
filteredItems.Add(item);
}
items.ClearItems();
items.Append(filteredItems);
return result;
}
示例5: OnFinalizeFileItems
// \brief This function will be called by Update() after the
// labels of the fileitems are formatted. Override this function
// to modify the fileitems. Eg. to modify the item label
void CGUIMediaWindow::OnFinalizeFileItems(CFileItemList &items)
{
m_unfilteredItems->Append(items);
CStdString filter(GetProperty("filter").asString());
if (!filter.IsEmpty())
{
items.ClearItems();
GetFilteredItems(filter, items);
}
}
示例6: GetFilteredItems
bool CGUIMediaWindow::GetFilteredItems(const CStdString &filter, CFileItemList &items)
{
CStdString trimmedFilter(filter);
trimmedFilter.TrimLeft().ToLower();
if (trimmedFilter.IsEmpty())
return true;
CFileItemList filteredItems;
bool numericMatch = StringUtils::IsNaturalNumber(trimmedFilter);
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if (item->IsParentFolder())
{
filteredItems.Add(item);
continue;
}
// TODO: Need to update this to get all labels, ideally out of the displayed info (ie from m_layout and m_focusedLayout)
// though that isn't practical. Perhaps a better idea would be to just grab the info that we should filter on based on
// where we are in the library tree.
// Another idea is tying the filter string to the current level of the tree, so that going deeper disables the filter,
// but it's re-enabled on the way back out.
CStdString match;
/* if (item->GetFocusedLayout())
match = item->GetFocusedLayout()->GetAllText();
else if (item->GetLayout())
match = item->GetLayout()->GetAllText();
else*/
match = item->GetLabel(); // Filter label only for now
if (numericMatch)
StringUtils::WordToDigits(match);
size_t pos = StringUtils::FindWords(match.c_str(), trimmedFilter.c_str());
if (pos != CStdString::npos)
filteredItems.Add(item);
}
items.ClearItems();
items.Append(filteredItems);
return (items.GetObjectCount() > 0);
}
示例7: UpdateGroupsSpin
void CGUIDialogPVRGuideSearch::UpdateGroupsSpin(void)
{
CFileItemList groups;
CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS);
if (!pSpin)
return;
/* tv groups */
g_PVRChannelGroups->GetTV()->GetGroupList(&groups);
for (int iGroupPtr = 0; iGroupPtr < groups.Size(); iGroupPtr++)
pSpin->AddLabel(groups[iGroupPtr]->GetLabel(), atoi(groups[iGroupPtr]->GetPath()));
/* radio groups */
groups.ClearItems();
g_PVRChannelGroups->GetRadio()->GetGroupList(&groups);
for (int iGroupPtr = 0; iGroupPtr < groups.Size(); iGroupPtr++)
pSpin->AddLabel(groups[iGroupPtr]->GetLabel(), atoi(groups[iGroupPtr]->GetPath()));
pSpin->SetValue(m_searchFilter->m_iChannelGroup);
}
示例8: FilterItems
void CGUIWindowMusicNav::FilterItems(CFileItemList &items)
{
if (m_vecItems->IsVirtualDirectoryRoot())
return;
items.ClearItems();
CStdString filter(m_filter);
filter.TrimLeft().ToLower();
bool numericMatch = StringUtils::IsNaturalNumber(filter);
for (int i = 0; i < m_unfilteredItems->Size(); i++)
{
CFileItemPtr item = m_unfilteredItems->Get(i);
if (item->IsParentFolder() || filter.IsEmpty() ||
CMusicDatabaseDirectory::IsAllItem(item->m_strPath))
{
items.Add(item);
continue;
}
// TODO: Need to update this to get all labels, ideally out of the displayed info (ie from m_layout and m_focusedLayout)
// though that isn't practical. Perhaps a better idea would be to just grab the info that we should filter on based on
// where we are in the library tree.
// Another idea is tying the filter string to the current level of the tree, so that going deeper disables the filter,
// but it's re-enabled on the way back out.
CStdString match;
/* if (item->GetFocusedLayout())
match = item->GetFocusedLayout()->GetAllText();
else if (item->GetLayout())
match = item->GetLayout()->GetAllText();
else*/
match = item->GetLabel();
if (numericMatch)
StringUtils::WordToDigits(match);
size_t pos = StringUtils::FindWords(match.c_str(), filter.c_str());
if (pos != CStdString::npos)
items.Add(item);
}
}
示例9: OnFinalizeFileItems
// \brief This function will be called by Update() after the
// labels of the fileitems are formatted. Override this function
// to modify the fileitems. Eg. to modify the item label
void CGUIMediaWindow::OnFinalizeFileItems(CFileItemList &items)
{
m_unfilteredItems->Append(items);
CStdString filter(GetProperty("filter"));
if (!filter.IsEmpty())
{
items.ClearItems();
GetFilteredItems(filter, items);
}
// The idea here is to ensure we have something to focus if our file list
// is empty. As such, this check MUST be last and ignore the hide parent
// fileitems settings.
if (items.IsEmpty())
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->m_strPath=m_history.GetParentPath();
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
items.AddFront(pItem, 0);
}
}