本文整理汇总了C++中CFileItemPtr::GetCachedProgramThumb方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::GetCachedProgramThumb方法的具体用法?C++ CFileItemPtr::GetCachedProgramThumb怎么用?C++ CFileItemPtr::GetCachedProgramThumb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::GetCachedProgramThumb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPluginsDirectory
bool CPluginDirectory::GetPluginsDirectory(const CStdString &type, CFileItemList &items)
{
// retrieve our folder
CStdString pluginsFolder = _P("U:\\plugins");
CUtil::AddFileToFolder(pluginsFolder, type, pluginsFolder);
CUtil::AddSlashAtEnd(pluginsFolder);
if (!CDirectory::GetDirectory(pluginsFolder, items, "*.py", false))
return false;
items.m_strPath.Replace(_P("U:\\plugins\\"), "plugin://");
items.m_strPath.Replace("\\", "/");
// flatten any folders - TODO: Assigning of thumbs
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items[i];
item->SetThumbnailImage("");
item->SetCachedProgramThumb();
if (!item->HasThumbnail())
item->SetUserProgramThumb();
if (!item->HasThumbnail())
{
CFileItem item2(item->m_strPath);
CUtil::AddFileToFolder(item->m_strPath,"default.py",item2.m_strPath);
item2.m_bIsFolder = false;
item2.SetCachedProgramThumb();
if (!item2.HasThumbnail())
item2.SetUserProgramThumb();
if (item2.HasThumbnail())
{
XFILE::CFile::Cache(item2.GetThumbnailImage(),item->GetCachedProgramThumb());
item->SetThumbnailImage(item->GetCachedProgramThumb());
}
}
item->m_strPath.Replace(_P("U:\\plugins\\"), "plugin://");
item->m_strPath.Replace("\\", "/");
}
return true;
}
示例2: OnContextButton
//.........这里部分代码省略.........
// remove share default
ClearDefault(type);
return true;
case CONTEXT_BUTTON_SET_THUMB:
{
if (g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteSources() && !g_passwordManager.IsProfileLockUnlocked())
return false;
else if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
// setup our thumb list
CFileItemList items;
// add the current thumb, if available
if (!share->m_strThumbnailImage.IsEmpty())
{
CFileItemPtr current(new CFileItem("thumb://Current", false));
current->SetThumbnailImage(share->m_strThumbnailImage);
current->SetLabel(g_localizeStrings.Get(20016));
items.Add(current);
}
else if (item->HasThumbnail())
{ // already have a thumb that the share doesn't know about - must be a local one, so we mayaswell reuse it.
CFileItemPtr current(new CFileItem("thumb://Current", false));
current->SetThumbnailImage(item->GetThumbnailImage());
current->SetLabel(g_localizeStrings.Get(20016));
items.Add(current);
}
// see if there's a local thumb for this item
CStdString folderThumb = item->GetFolderThumb();
if (XFILE::CFile::Exists(folderThumb))
{ // cache it
if (CPicture::CreateThumbnail(folderThumb, item->GetCachedProgramThumb()))
{
CFileItemPtr local(new CFileItem("thumb://Local", false));
local->SetThumbnailImage(item->GetCachedProgramThumb());
local->SetLabel(g_localizeStrings.Get(20017));
items.Add(local);
}
}
// and add a "no thumb" entry as well
CFileItemPtr nothumb(new CFileItem("thumb://None", false));
nothumb->SetIconImage(item->GetIconImage());
nothumb->SetLabel(g_localizeStrings.Get(20018));
items.Add(nothumb);
CStdString strThumb;
VECSOURCES shares;
g_mediaManager.GetLocalDrives(shares);
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb))
return false;
if (strThumb == "thumb://Current")
return true;
if (strThumb == "thumb://None")
strThumb = "";
if (!share->m_ignore)
{
g_settings.UpdateSource(type,share->strName,"thumbnail",strThumb);
g_settings.SaveSources();
}
else if (!strThumb.IsEmpty())
{ // this is icky as we have to cache using a bunch of different criteria