本文整理汇总了C++中CFileItemList::ClearSortState方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::ClearSortState方法的具体用法?C++ CFileItemList::ClearSortState怎么用?C++ CFileItemList::ClearSortState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::ClearSortState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormatItemLabels
// \brief Formats item labels based on the formatting provided by guiViewState
void CGUIMediaWindow::FormatItemLabels(CFileItemList &items, const LABEL_MASKS &labelMasks)
{
CLabelFormatter fileFormatter(labelMasks.m_strLabelFile, labelMasks.m_strLabel2File);
CLabelFormatter folderFormatter(labelMasks.m_strLabelFolder, labelMasks.m_strLabel2Folder);
for (int i=0; i<items.Size(); ++i)
{
CFileItemPtr pItem=items[i];
if (pItem->IsLabelPreformated())
continue;
if (pItem->m_bIsFolder)
folderFormatter.FormatLabels(pItem.get());
else
fileFormatter.FormatLabels(pItem.get());
}
if(items.GetSortMethod() == SORT_METHOD_LABEL_IGNORE_THE
|| items.GetSortMethod() == SORT_METHOD_LABEL)
items.ClearSortState();
}
示例2: ApplyWatchedFilter
bool CGUIWindowVideoNav::ApplyWatchedFilter(CFileItemList &items)
{
bool listchanged = false;
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(items.GetPath());
// now filter watched items as necessary
bool filterWatched=false;
if (node == NODE_TYPE_EPISODES
|| node == NODE_TYPE_SEASONS
|| node == NODE_TYPE_SETS
|| node == NODE_TYPE_TAGS
|| node == NODE_TYPE_TITLE_MOVIES
|| node == NODE_TYPE_TITLE_TVSHOWS
|| node == NODE_TYPE_TITLE_MUSICVIDEOS
|| node == NODE_TYPE_RECENTLY_ADDED_EPISODES
|| node == NODE_TYPE_RECENTLY_ADDED_MOVIES
|| node == NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS)
filterWatched = true;
if (!items.IsVideoDb())
filterWatched = true;
if (items.GetContent() == "tvshows" &&
(items.IsSmartPlayList() || items.IsLibraryFolder()))
node = NODE_TYPE_TITLE_TVSHOWS; // so that the check below works
int watchMode = CMediaSettings::GetInstance().GetWatchedMode(m_vecItems->GetContent());
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if(item->HasVideoInfoTag() && (node == NODE_TYPE_TITLE_TVSHOWS || node == NODE_TYPE_SEASONS))
{
if (watchMode == WatchedModeUnwatched)
item->GetVideoInfoTag()->m_iEpisode = (int)item->GetProperty("unwatchedepisodes").asInteger();
if (watchMode == WatchedModeWatched)
item->GetVideoInfoTag()->m_iEpisode = (int)item->GetProperty("watchedepisodes").asInteger();
if (watchMode == WatchedModeAll)
item->GetVideoInfoTag()->m_iEpisode = (int)item->GetProperty("totalepisodes").asInteger();
item->SetProperty("numepisodes", item->GetVideoInfoTag()->m_iEpisode);
listchanged = true;
}
if (filterWatched)
{
if(!item->IsParentFolder() && // Don't delete the go to parent folder
((watchMode == WatchedModeWatched && item->GetVideoInfoTag()->GetPlayCount() == 0) ||
(watchMode == WatchedModeUnwatched && item->GetVideoInfoTag()->GetPlayCount() > 0)))
{
items.Remove(i);
i--;
listchanged = true;
}
}
}
// Remove the parent folder icon, if it's the only thing in the folder. This is needed for hiding seasons.
if (items.GetObjectCount() == 0 && items.GetFileCount() > 0 && items.Get(0)->IsParentFolder())
items.Remove(0);
if(node == NODE_TYPE_TITLE_TVSHOWS || node == NODE_TYPE_SEASONS)
{
// the watched filter may change the "numepisodes" property which is reflected in the TV_SHOWS and SEASONS nodes
// therefore, the items labels have to be refreshed, and possibly the list needs resorting as well.
items.ClearSortState(); // this is needed to force resorting even if sort method did not change
FormatAndSort(items);
}
return listchanged;
}