本文整理汇总了C++中CFileItemPtr::IsFileFolder方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::IsFileFolder方法的具体用法?C++ CFileItemPtr::IsFileFolder怎么用?C++ CFileItemPtr::IsFileFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::IsFileFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetContextButtons
void CGUIMediaWindow::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : CFileItemPtr();
if (!item)
return;
// user added buttons
CStdString label;
CStdString action;
for (int i = CONTEXT_BUTTON_USER1; i <= CONTEXT_BUTTON_USER10; i++)
{
label.Format("contextmenulabel(%i)", i - CONTEXT_BUTTON_USER1);
if (item->GetProperty(label).IsEmpty())
break;
action.Format("contextmenuaction(%i)", i - CONTEXT_BUTTON_USER1);
if (item->GetProperty(action).IsEmpty())
break;
buttons.Add((CONTEXT_BUTTON)i, item->GetProperty(label));
}
if (item->IsPlugin() && item->IsFileFolder())
{
if (CPluginSettings::SettingsExist(item->m_strPath))
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
}
if (item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
// TODO: FAVOURITES Conditions on masterlock and localisation
if (!item->IsParentFolder() && !item->m_strPath.Equals("add") && !item->m_strPath.Equals("newplaylist://") && !item->m_strPath.Left(19).Equals("newsmartplaylist://"))
{
if (CFavourites::IsFavourite(item.get(), GetID()))
buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14077); // Remove Favourite
else
buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14076); // Add To Favourites;
}
}
示例2: OnClick
// \brief With this function you can react on a users click in the list/thumb panel.
// It returns true, if the click is handled.
// This function calls OnPlayMedia()
bool CGUIMediaWindow::OnClick(int iItem)
{
if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return true;
CFileItemPtr pItem = m_vecItems->Get(iItem);
if (pItem->IsParentFolder())
{
GoParentFolder();
return true;
}
if (pItem->GetPath() == "add" || pItem->GetPath() == "sources://add/") // 'add source button' in empty root
{
OnContextButton(iItem, CONTEXT_BUTTON_ADD_SOURCE);
return true;
}
if (!pItem->m_bIsFolder && pItem->IsFileFolder())
{
XFILE::IFileDirectory *pFileDirectory = NULL;
pFileDirectory = XFILE::CFactoryFileDirectory::Create(pItem->GetPath(), pItem.get(), "");
if(pFileDirectory)
pItem->m_bIsFolder = true;
else if(pItem->m_bIsFolder)
pItem->m_bIsFolder = false;
delete pFileDirectory;
}
if (pItem->IsScript())
{
// execute the script
CURL url(pItem->GetPath());
AddonPtr addon;
if (CAddonMgr::Get().GetAddon(url.GetHostName(), addon))
{
#ifdef HAS_PYTHON
if (!g_pythonParser.StopScript(addon->LibPath()))
g_pythonParser.evalFile(addon->LibPath(),addon);
#endif
return true;
}
}
if (pItem->m_bIsFolder)
{
if ( pItem->m_bIsShareOrDrive )
{
const CStdString& strLockType=m_guiState->GetLockType();
if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
if (!strLockType.IsEmpty() && !g_passwordManager.IsItemUnlocked(pItem.get(), strLockType))
return true;
if (!HaveDiscOrConnection(pItem->GetPath(), pItem->m_iDriveType))
return true;
}
// check for the partymode playlist items - they may not exist yet
if ((pItem->GetPath() == g_settings.GetUserDataItem("PartyMode.xsp")) ||
(pItem->GetPath() == g_settings.GetUserDataItem("PartyMode-Video.xsp")))
{
// party mode playlist item - if it doesn't exist, prompt for user to define it
if (!XFILE::CFile::Exists(pItem->GetPath()))
{
m_vecItems->RemoveDiscCache(GetID());
if (CGUIDialogSmartPlaylistEditor::EditPlaylist(pItem->GetPath()))
Update(m_vecItems->GetPath());
return true;
}
}
// remove the directory cache if the folder is not normally cached
CFileItemList items(pItem->GetPath());
if (!items.AlwaysCache())
items.RemoveDiscCache(GetID());
CFileItem directory(*pItem);
if (!Update(directory.GetPath()))
ShowShareErrorMessage(&directory);
return true;
}
else if (pItem->IsPlugin() && !pItem->GetProperty("isplayable").asBoolean())
{
return XFILE::CPluginDirectory::RunScriptWithParams(pItem->GetPath());
}
else
{
m_iSelectedItem = m_viewControl.GetSelectedItem();
if (pItem->GetPath() == "newplaylist://")
{
m_vecItems->RemoveDiscCache(GetID());
g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST_EDITOR,"newplaylist://");
return true;
}
else if (pItem->GetPath().Left(19).Equals("newsmartplaylist://"))
{
m_vecItems->RemoveDiscCache(GetID());
//.........这里部分代码省略.........
示例3: OnClick
void CGUIWindowFileManager::OnClick(int iList, int iItem)
{
if ( iList < 0 || iList >= 2) return ;
if ( iItem < 0 || iItem >= m_vecItems[iList]->Size() ) return ;
CFileItemPtr pItem = m_vecItems[iList]->Get(iItem);
if (pItem->GetPath() == "add" && pItem->GetLabel() == g_localizeStrings.Get(1026)) // 'add source button' in empty root
{
if (CGUIDialogMediaSource::ShowAndAddMediaSource("files"))
{
m_rootDir.SetSources(*CMediaSourceSettings::Get().GetSources("files"));
Update(0,m_Directory[0]->GetPath());
Update(1,m_Directory[1]->GetPath());
}
return;
}
if (!pItem->m_bIsFolder && pItem->IsFileFolder(EFILEFOLDER_MASK_ALL))
{
XFILE::IFileDirectory *pFileDirectory = NULL;
pFileDirectory = XFILE::CFileDirectoryFactory::Create(pItem->GetURL(), pItem.get(), "");
if(pFileDirectory)
pItem->m_bIsFolder = true;
else if(pItem->m_bIsFolder)
pItem->m_bIsFolder = false;
delete pFileDirectory;
}
if (pItem->m_bIsFolder)
{
// save path + drive type because of the possible refresh
CStdString strPath = pItem->GetPath();
int iDriveType = pItem->m_iDriveType;
if ( pItem->m_bIsShareOrDrive )
{
if ( !g_passwordManager.IsItemUnlocked( pItem.get(), "files" ) )
{
Refresh();
return ;
}
if ( !HaveDiscOrConnection( strPath, iDriveType ) )
return ;
}
if (!Update(iList, strPath))
ShowShareErrorMessage(pItem.get());
}
else if (pItem->IsZIP() || pItem->IsCBZ()) // mount zip archive
{
CURL pathToUrl = URIUtils::CreateArchivePath("zip", pItem->GetURL(), "");
Update(iList, pathToUrl.Get());
}
else if (pItem->IsRAR() || pItem->IsCBR())
{
CURL pathToUrl = URIUtils::CreateArchivePath("rar", pItem->GetURL(), "");
Update(iList, pathToUrl.Get());
}
else
{
OnStart(pItem.get());
return ;
}
// UpdateButtons();
}