本文整理汇总了C++中CFileItemList::SetContent方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::SetContent方法的具体用法?C++ CFileItemList::SetContent怎么用?C++ CFileItemList::SetContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::SetContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDirectory
bool CGUIWindowVideoFiles::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
if (!CGUIWindowVideoBase::GetDirectory(strDirectory, items))
return false;
SScraperInfo info2;
m_stackingAvailable = true;
m_cleaningAvailable = true;
if ((m_database.GetScraperForPath(strDirectory,info2) && info2.strContent.Equals("tvshows")) || items.IsTuxBox())
{ // dont stack or clean strings in tv dirs
m_stackingAvailable = false;
m_cleaningAvailable = false;
}
else if (!items.IsStack() && g_stSettings.m_iMyVideoStack != STACK_NONE)
items.Stack();
if ((!info2.strContent.IsEmpty() && !info2.strContent.Equals("None")) && items.GetContent().IsEmpty())
items.SetContent(info2.strContent.c_str());
else
items.SetContent("files");
items.SetThumbnailImage("");
items.SetVideoThumb();
return true;
}
示例2: LoadVideoInfo
void CGUIWindowVideoNav::LoadVideoInfo(CFileItemList &items)
{
// TODO: this could possibly be threaded as per the music info loading,
// we could also cache the info
if (!items.GetContent().IsEmpty())
return; // don't load for listings that have content set
CStdString content = m_database.GetContentForPath(items.m_strPath);
if (content.IsEmpty())
{
items.SetContent("files");
return;
}
items.SetContent(content);
bool clean = (g_guiSettings.GetBool("myvideos.cleanstrings") &&
!items.IsVirtualDirectoryRoot() &&
m_stackingAvailable);
if (!content.IsEmpty())
{
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr pItem = items[i];
CFileItem item;
if (m_database.GetItemForPath(content, pItem->m_strPath, item))
{ // copy info across
pItem->UpdateInfo(item);
// TODO: we may wish to use a playable_url parameter here rather than
// switching the path of the item (eg movie as a folder)
pItem->m_strPath = item.m_strPath;
pItem->m_bIsFolder = item.m_bIsFolder;
}
else
{
if (clean)
pItem->CleanString();
}
}
}
else
{
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr pItem = items[i];
int playCount = m_database.GetPlayCount(*pItem);
if (playCount >= 0)
pItem->SetOverlayImage(CGUIListItem::ICON_OVERLAY_UNWATCHED, playCount > 0);
if (clean)
pItem->CleanString();
}
}
}
示例3: GetDirectory
bool CGUIWindowMusicNav::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
if (m_bDisplayEmptyDatabaseMessage)
return true;
if (strDirectory.empty())
AddSearchFolder();
bool bResult = CGUIWindowMusicBase::GetDirectory(strDirectory, items);
if (bResult)
{
if (items.IsPlayList())
OnRetrieveMusicInfo(items);
}
// update our content in the info manager
if (StringUtils::StartsWithNoCase(strDirectory, "videodb://"))
{
CVideoDatabaseDirectory dir;
VIDEODATABASEDIRECTORY::NODE_TYPE node = dir.GetDirectoryChildType(strDirectory);
if (node == VIDEODATABASEDIRECTORY::NODE_TYPE_TITLE_MUSICVIDEOS)
items.SetContent("musicvideos");
}
else if (StringUtils::StartsWithNoCase(strDirectory, "musicdb://"))
{
CMusicDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(strDirectory);
if (node == NODE_TYPE_ALBUM ||
node == NODE_TYPE_ALBUM_RECENTLY_ADDED ||
node == NODE_TYPE_ALBUM_RECENTLY_PLAYED ||
node == NODE_TYPE_ALBUM_TOP100 ||
node == NODE_TYPE_ALBUM_COMPILATIONS ||
node == NODE_TYPE_YEAR_ALBUM)
items.SetContent("albums");
else if (node == NODE_TYPE_ARTIST)
items.SetContent("artists");
else if (node == NODE_TYPE_SONG ||
node == NODE_TYPE_SONG_TOP100 ||
node == NODE_TYPE_SINGLES)
items.SetContent("songs");
else if (node == NODE_TYPE_GENRE)
items.SetContent("genres");
else if (node == NODE_TYPE_YEAR)
items.SetContent("years");
}
else if (strDirectory.Equals("special://musicplaylists/"))
items.SetContent("playlists");
else if (strDirectory.Equals("plugin://music/"))
items.SetContent("plugins");
else if (items.IsPlayList())
items.SetContent("songs");
return bResult;
}
示例4: GetChannels
bool CHTSPDirectory::GetChannels( const CURL &base
, CFileItemList &items
, SChannels channels
, int tag)
{
CURL url(base);
SEvent event;
for(SChannels::iterator it = channels.begin(); it != channels.end(); it++)
{
if(!m_session->GetEvent(event, it->second.event))
event.Clear();
CFileItemPtr item(new CFileItem("", true));
url.SetFileName("");
item->SetPath(url.Get());
CHTSPSession::ParseItem(it->second, tag, event, *item);
item->m_bIsFolder = false;
item->SetLabel(item->m_strTitle);
item->m_strTitle = StringUtils::Format("%d", it->second.num);
items.Add(item);
}
items.AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("%K[ - %B]", "%Z", "%L", ""));
items.AddSortMethod(SortByAlbum, 558, LABEL_MASKS("%B", "%Z", "%L", ""), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
items.AddSortMethod(SortByLabel, 551, LABEL_MASKS("%Z", "%B", "%L", ""), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
items.SetContent("livetv");
return !channels.empty();
}
示例5: GetDirectory
bool CEventsDirectory::GetDirectory(const CURL& url, CFileItemList &items)
{
items.ClearProperties();
items.SetContent("events");
CEventLog& log = CEventLog::GetInstance();
Events events;
std::string hostname = url.GetHostName();
if (hostname.empty())
events = log.Get();
else
{
bool includeHigherLevels = false;
// check if we should only retrieve events from a specific level or
// also from all higher levels
if (StringUtils::EndsWith(hostname, "+"))
{
includeHigherLevels = true;
// remove the "+" from the end of the hostname
hostname = hostname.substr(0, hostname.size() - 1);
}
EventLevel level = EventLevelFromString(hostname);
// get the events of the specified level(s)
events = log.Get(level, includeHigherLevels);
}
for (auto eventItem : events)
items.Add(EventToFileItem(eventItem));
return true;
}
示例6: GetScriptsAndPlugins
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
items.Clear();
VECADDONS addons;
if (!GetScriptsAndPlugins(content, addons))
return false;
for (unsigned i=0; i<addons.size(); i++)
{
CFileItemPtr item(FileItemFromAddon(addons[i],
addons[i]->Type()==ADDON_PLUGIN?"plugin://":"script://",
addons[i]->Type() == ADDON_PLUGIN));
PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
if (plugin->ProvidesSeveral())
{
CURL url = item->GetAsUrl();
CStdString opt;
opt.Format("?content_type=%s",content.c_str());
url.SetOptions(opt);
item->SetPath(url.Get());
}
items.Add(item);
}
items.Add(GetMoreItem(content));
items.SetContent("addons");
items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons
return items.Size() > 0;
}
示例7: GetDirectory
bool CGUIWindowGames::GetDirectory(const std::string &strDirectory, CFileItemList& items)
{
if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
return false;
// Set label
std::string label;
if (items.GetLabel().empty())
{
std::string source;
if (m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::GetInstance().GetSources("games"), &source))
label = std::move(source);
}
if (!label.empty())
items.SetLabel(label);
// Set content
std::string content;
if (items.GetContent().empty())
{
if (!items.IsVirtualDirectoryRoot() && // Don't set content for root directory
!items.IsPlugin()) // Don't set content for plugins
{
content = "games";
}
}
if (!content.empty())
items.SetContent(content);
return true;
}
示例8: GetDirectory
bool CGUIWindowMusicNav::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
if (m_bDisplayEmptyDatabaseMessage)
return true;
if (m_thumbLoader.IsLoading())
m_thumbLoader.StopThread();
bool bResult = CGUIWindowMusicBase::GetDirectory(strDirectory, items);
if (bResult)
{
if (items.IsPlayList())
OnRetrieveMusicInfo(items);
if (!items.IsMusicDb())
{
items.SetCachedMusicThumbs();
m_thumbLoader.Load(*m_vecItems);
}
}
// update our content in the info manager
if (strDirectory.Left(10).Equals("videodb://"))
{
CVideoDatabaseDirectory dir;
VIDEODATABASEDIRECTORY::NODE_TYPE node = dir.GetDirectoryChildType(strDirectory);
if (node == VIDEODATABASEDIRECTORY::NODE_TYPE_TITLE_MUSICVIDEOS)
items.SetContent("musicvideos");
}
else if (items.GetContent().IsEmpty())
{
CMusicDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(strDirectory);
if (node == NODE_TYPE_ALBUM)
items.SetContent("albums");
else if (node == NODE_TYPE_ARTIST)
items.SetContent("artists");
else if (node == NODE_TYPE_SONG)
items.SetContent("songs");
}
// clear the filter
m_filter.Empty();
return bResult;
}
示例9: GetDirectory
bool CGUIWindowPictures::GetDirectory(const std::string &strDirectory, CFileItemList& items)
{
if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
return false;
std::string label;
if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::GetInstance().GetSources("pictures"), &label))
items.SetLabel(label);
if (items.GetContent().empty() && !items.IsVirtualDirectoryRoot() && !items.IsPlugin())
items.SetContent("images");
return true;
}
示例10: GetDirectory
bool CGUIWindowAddonBrowser::GetDirectory(const CStdString& strDirectory,
CFileItemList& items)
{
bool result;
if (strDirectory.Equals("addons://downloading/"))
{
VECADDONS addons;
CAddonInstaller::Get().GetInstallList(addons);
CURL url(strDirectory);
CAddonsDirectory::GenerateListing(url,addons,items);
result = true;
items.SetProperty("reponame",g_localizeStrings.Get(24067));
items.SetPath(strDirectory);
if (m_guiState.get() && !m_guiState->HideParentDirItems())
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->SetPath(m_history.GetParentPath());
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
items.AddFront(pItem, 0);
}
}
else
result = CGUIMediaWindow::GetDirectory(strDirectory,items);
if (strDirectory.IsEmpty() && CAddonInstaller::Get().IsDownloading())
{
CFileItemPtr item(new CFileItem("addons://downloading/",true));
item->SetLabel(g_localizeStrings.Get(24067));
item->SetLabelPreformated(true);
item->SetIconImage("DefaultNetwork.png");
items.Add(item);
}
items.SetContent("addons");
for (int i=0;i<items.Size();++i)
SetItemLabel2(items[i]);
return result;
}
示例11: GetChannels
bool CHTSPDirectory::GetChannels( const CURL &base
, CFileItemList &items
, SChannels channels
, int tag)
{
CURL url(base);
SEvent event;
for(SChannels::iterator it = channels.begin(); it != channels.end(); it++)
{
if(!m_session->GetEvent(event, it->second.event))
event.Clear();
CFileItemPtr item(new CFileItem("", true));
url.SetFileName("");
item->SetPath(url.Get());
CHTSPSession::ParseItem(it->second, tag, event, *item);
item->m_bIsFolder = false;
item->SetLabel(item->m_strTitle);
item->m_strTitle.Format("%d", it->second.num);
items.Add(item);
}
items.AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS("%K[ - %B]", "%Z", "%L", ""));
if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B", "%Z", "%L", ""));
else
items.AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B", "%Z", "%L", ""));
if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%Z", "%B", "%L", ""));
else
items.AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%Z", "%B", "%L", ""));
items.SetContent("livetv");
return !channels.empty();
}
示例12: GetScriptsAndPlugins
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
items.Clear();
CPluginSource::Content type = CPluginSource::Translate(content);
if (type == CPluginSource::UNKNOWN)
return false;
VECADDONS addons;
CAddonMgr::Get().GetAddons(ADDON_PLUGIN, addons);
for (unsigned i=0; i<addons.size(); i++)
{
PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
if (!plugin || !plugin->Provides(type))
continue;
items.Add(FileItemFromAddon(addons[i], "plugin://", true));
}
addons.clear();
CAddonMgr::Get().GetAddons(ADDON_SCRIPT, addons);
for (unsigned i=0; i<addons.size(); i++)
{
PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
if (!plugin || !plugin->Provides(type))
continue;
items.Add(FileItemFromAddon(addons[i], "script://", false));
}
CFileItemPtr item(new CFileItem("addons://more/"+content,false));
item->SetLabelPreformated(true);
item->SetLabel(g_localizeStrings.Get(21452));
item->SetIconImage("DefaultAddon.png");
item->SetSpecialSort(SORT_ON_BOTTOM);
items.Add(item);
items.SetContent("addons");
return items.Size() > 0;
}
示例13: GetScriptsAndPlugins
bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
items.Clear();
VECADDONS addons;
if (!GetScriptsAndPlugins(content, addons))
return false;
for (unsigned i=0; i<addons.size(); i++)
{
if (addons[i]->Type() == ADDON_PLUGIN)
items.Add(FileItemFromAddon(addons[i], "plugin://", true));
else
items.Add(FileItemFromAddon(addons[i], "script://", false));
}
items.Add(GetMoreItem(content));
items.SetContent("addons");
items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons
return items.Size() > 0;
}
示例14: GetDirectory
bool CSmartPlaylistDirectory::GetDirectory(const CStdString& strPath, CFileItemList& items)
{
// Load in the SmartPlaylist and get the WHERE query
CSmartPlaylist playlist;
if (!playlist.Load(strPath))
return false;
bool success = false, success2 = false;
if (playlist.GetType().Equals("tvshows"))
{
CVideoDatabase db;
db.Open();
CStdString whereOrder = playlist.GetWhereClause(db) + " " + playlist.GetOrderClause(db);
success = db.GetTvShowsByWhere("videodb://2/2/", whereOrder, items);
items.SetContent("tvshows");
db.Close();
}
else if (playlist.GetType().Equals("episodes"))
{
CVideoDatabase db;
db.Open();
CStdString whereOrder = playlist.GetWhereClause(db) + " " + playlist.GetOrderClause(db);
success = db.GetEpisodesByWhere("videodb://2/2/", whereOrder, items);
items.SetContent("episodes");
db.Close();
}
else if (playlist.GetType().Equals("movies"))
{
CVideoDatabase db;
db.Open();
success = db.GetMoviesByWhere("videodb://1/2/", playlist.GetWhereClause(db), playlist.GetOrderClause(db), items, true);
items.SetContent("movies");
db.Close();
}
else if (playlist.GetType().Equals("albums"))
{
CMusicDatabase db;
db.Open();
success = db.GetAlbumsByWhere("musicdb://3/", playlist.GetWhereClause(db), playlist.GetOrderClause(db), items);
items.SetContent("albums");
db.Close();
}
if (playlist.GetType().Equals("songs") || playlist.GetType().Equals("mixed") || playlist.GetType().IsEmpty())
{
CMusicDatabase db;
db.Open();
CStdString type=playlist.GetType();
if (type.IsEmpty())
type = "songs";
if (playlist.GetType().Equals("mixed"))
playlist.SetType("songs");
CStdString whereOrder = playlist.GetWhereClause(db) + " " + playlist.GetOrderClause(db);
success = db.GetSongsByWhere("", whereOrder, items);
items.SetContent("songs");
db.Close();
playlist.SetType(type);
}
if (playlist.GetType().Equals("musicvideos") || playlist.GetType().Equals("mixed"))
{
CVideoDatabase db;
db.Open();
CStdString type=playlist.GetType();
if (playlist.GetType().Equals("mixed"))
playlist.SetType("musicvideos");
CStdString whereOrder = playlist.GetWhereClause(db) + " " + playlist.GetOrderClause(db);
CFileItemList items2;
success2 = db.GetMusicVideosByWhere("videodb://3/2/", whereOrder, items2, false); // TODO: SMARTPLAYLISTS Don't check locks???
db.Close();
items.Append(items2);
if (items2.Size())
items.SetContent("musicvideos");
playlist.SetType(type);
}
// go through and set the playlist order
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
item->m_iprogramCount = i; // hack for playlist order
}
if (playlist.GetType().Equals("mixed"))
return success || success2;
else if (playlist.GetType().Equals("musicvideos"))
return success2;
else
return success;
}
示例15: GetDirectory
//.........这里部分代码省略.........
const char* fanart = root->Attribute("art");
string strFanart;
if (fanart && strlen(fanart) > 0)
strFanart = ProcessUrl(strPath, fanart, false);
// Walk the parsed tree.
string strFileLabel = "%N - %T";
string strDirLabel = "%B";
string strSecondDirLabel = "%Y";
Parse(m_url, root, items, strFileLabel, strDirLabel, strSecondDirLabel);
// Set the window titles
const char* title1 = root->Attribute("title1");
const char* title2 = root->Attribute("title2");
if (title1 && strlen(title1) > 0)
items.SetFirstTitle(title1);
if (title2 && strlen(title2) > 0)
items.SetSecondTitle(title2);
// Set fanart on items if they don't have their own.
for (int i=0; i<items.Size(); i++)
{
CFileItemPtr pItem = items[i];
if (strFanart.size() > 0 && pItem->GetQuickFanart().size() == 0)
pItem->SetQuickFanart(strFanart);
// Make sure sort label is lower case.
string sortLabel = pItem->GetLabel();
boost::to_lower(sortLabel);
pItem->SetSortLabel(sortLabel);
}
// Set fanart on directory.
if (strFanart.size() > 0)
items.SetQuickFanart(strFanart);
// Set the view mode.
const char* viewmode = root->Attribute("viewmode");
if (viewmode && strlen(viewmode) > 0)
{
CGUIViewState* viewState = CGUIViewState::GetViewState(0, items);
viewState->SaveViewAsControl(atoi(viewmode));
}
// Override labels.
const char* fileLabel = root->Attribute("filelabel");
if (fileLabel && strlen(fileLabel) > 0)
strFileLabel = fileLabel;
const char* dirLabel = root->Attribute("dirlabel");
if (dirLabel && strlen(dirLabel) > 0)
strDirLabel = dirLabel;
// Add the sort method.
items.AddSortMethod(SORT_METHOD_NONE, 552, LABEL_MASKS(strFileLabel, "%D", strDirLabel, strSecondDirLabel));
// Set the content label.
const char* content = root->Attribute("content");
if (content && strlen(content) > 0)
{
items.SetContent(content);
}
// Check for dialog message attributes
CStdString strMessage = "";
const char* header = root->Attribute("header");
if (header && strlen(header) > 0)
{
const char* message = root->Attribute("message");
if (message && strlen(message) > 0)
strMessage = message;
items.m_displayMessage = true;
items.m_displayMessageTitle = header;
items.m_displayMessageContents = root->Attribute("message");
// Don't cache these.
m_dirCacheType = DIR_CACHE_NEVER;
}
// See if this directory replaces the parent.
const char* replace = root->Attribute("replaceParent");
if (replace && strcmp(replace, "1") == 0)
items.SetReplaceListing(true);
// See if we're saving this into the history or not.
const char* noHistory = root->Attribute("noHistory");
if (noHistory && strcmp(noHistory, "1") == 0)
items.SetSaveInHistory(false);
// See if we're not supposed to cache this directory.
const char* noCache = root->Attribute("nocache");
if (noCache && strcmp(noCache, "1") == 0)
m_dirCacheType = DIR_CACHE_NEVER;
return true;
}