本文整理汇总了C++中CFileItemPtr::GetPropertyBOOL方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::GetPropertyBOOL方法的具体用法?C++ CFileItemPtr::GetPropertyBOOL怎么用?C++ CFileItemPtr::GetPropertyBOOL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::GetPropertyBOOL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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->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: GetContextButtons
void CGUIWindowPictures::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item && !item->GetPropertyBOOL("pluginreplacecontextitems"))
{
if ( m_vecItems->IsVirtualDirectoryRoot() && item)
{
CGUIDialogContextMenu::GetContextButtons("pictures", item, buttons);
}
else
{
if (item)
{
if (!(item->m_bIsFolder || item->IsZIP() || item->IsRAR() || item->IsCBZ() || item->IsCBR()))
buttons.Add(CONTEXT_BUTTON_INFO, 13406); // picture info
buttons.Add(CONTEXT_BUTTON_VIEW_SLIDESHOW, item->m_bIsFolder ? 13317 : 13422); // View Slideshow
if (item->m_bIsFolder)
buttons.Add(CONTEXT_BUTTON_RECURSIVE_SLIDESHOW, 13318); // Recursive Slideshow
if (!m_thumbLoader.IsLoading())
buttons.Add(CONTEXT_BUTTON_REFRESH_THUMBS, 13315); // Create Thumbnails
if (g_guiSettings.GetBool("filelists.allowfiledeletion") && !item->IsReadOnly())
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
if (item->IsPlugin() || item->m_strPath.Left(9).Equals("script://") || m_vecItems->IsPlugin())
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
buttons.Add(CONTEXT_BUTTON_GOTO_ROOT, 20128);
buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
}
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
if (item && !item->GetPropertyBOOL("pluginreplacecontextitems"))
buttons.Add(CONTEXT_BUTTON_SETTINGS, 5); // Settings
}
示例3: GetStatusFromServer
bool CBoxeeSocialUtilsManager::GetStatusFromServer()
{
int retCode;
Job_Result jobResult = BoxeeUtils::GetShareServicesJson(m_jsonServiceList, retCode);
CLog::Log(LOGDEBUG,"CBoxeeSocialUtilsManager::GetSocialServicesStatus - call to get SocialServices status from server returned [jobResult=%d] ",jobResult);
if (jobResult != JOB_SUCCEEDED)
{
CLog::Log(LOGERROR,"CBoxeeSocialUtilsManager::GetSocialServicesStatus - FAILED to get SocialServices status from server. [jobResult=%d]",jobResult);
return false;
}
m_servicesList.Clear();
m_serviceMap.clear();
BoxeeUtils::ParseJsonShareServicesToFileItems(m_jsonServiceList,m_servicesList);
CLog::Log(LOGDEBUG,"CBoxeeSocialUtilsManager::GetSocialServicesStatus - after parse SocialServices to FIleItemList. [NumOfSocialServices=%d]",m_servicesList.Size());
for (int i = 0; i < m_servicesList.Size(); i++)
{
CFileItemPtr item = m_servicesList.Get(i);
CStdString currentServiceId = item->GetProperty("serviceId");
if (currentServiceId == FACEBOOK_SERVICE_ID ||
currentServiceId == TWITTER_SERVICE_ID ||
currentServiceId == TUMBLR_SERVICE_ID)
{
m_serviceMap[currentServiceId].isConnected = item->GetPropertyBOOL("enable");
m_serviceMap[currentServiceId].requiresUpdate = item->GetPropertyBOOL("refresh");
m_serviceMap[currentServiceId].link = item->GetProperty("connect");
m_serviceMap[currentServiceId].disconnectLink = item->GetProperty("disconnect");
m_serviceMap[currentServiceId].externalLink = item->GetProperty("link");
}
}
return true;
}
示例4: GetContextButtons
void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item && !item->GetPropertyBOOL("pluginreplacecontextitems"))
{
if (item && !item->IsParentFolder())
{
if (item->GetExtraInfo().Equals("lastfmloved"))
{
buttons.Add(CONTEXT_BUTTON_LASTFM_UNLOVE_ITEM, 15295); //unlove
}
else if (item->GetExtraInfo().Equals("lastfmbanned"))
{
buttons.Add(CONTEXT_BUTTON_LASTFM_UNBAN_ITEM, 15296); //unban
}
else if (item->CanQueue())
{
buttons.Add(CONTEXT_BUTTON_QUEUE_ITEM, 13347); //queue
// allow a folder to be ad-hoc queued and played by the default player
if (item->m_bIsFolder || (item->IsPlayList() &&
!g_advancedSettings.m_playlistAsFolders))
{
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 208); // Play
}
else
{ // check what players we have, if we have multiple display play with option
VECPLAYERCORES vecCores;
CPlayerCoreFactory::GetPlayers(*item, vecCores);
if (vecCores.size() >= 1)
buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...
}
if (item->IsSmartPlayList())
{
buttons.Add(CONTEXT_BUTTON_PLAY_PARTYMODE, 15216); // Play in Partymode
}
if (item->IsSmartPlayList() || m_vecItems->IsSmartPlayList())
buttons.Add(CONTEXT_BUTTON_EDIT_SMART_PLAYLIST, 586);
else if (item->IsPlayList() || m_vecItems->IsPlayList())
buttons.Add(CONTEXT_BUTTON_EDIT, 586);
}
}
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
示例5: SetUnPlayable
void CPlayList::SetUnPlayable(int iItem)
{
if (iItem < 0 || iItem >= size())
{
CLog::Log(LOGWARNING, "Attempt to set unplayable index %d", iItem);
return;
}
CFileItemPtr item = m_vecItems[iItem];
if (!item->GetPropertyBOOL("unplayable"))
{
item->SetProperty("unplayable", true);
m_iPlayableItems--;
}
}
示例6: OnDeinitWindow
void CGUIDialogBoxeeShare::OnDeinitWindow(int nextWindowID)
{
CGUIWindowStateDatabase statedb;
for (int i = 0 ; i < m_servicesList.Size() ; i++)
{
CFileItemPtr fileItemPtr = m_servicesList.Get(i);
if (fileItemPtr.get())
{
statedb.SetUserServiceState(fileItemPtr->GetProperty("id"),fileItemPtr->GetPropertyBOOL("isSelected"));
}
fileItemPtr.reset();
}
CGUIDialog::OnDeinitWindow(nextWindowID);
}
示例7: GetContextButtons
void CGUIWindowPrograms::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
return;
CFileItemPtr item = m_vecItems->Get(itemNumber);
if (item && !item->GetPropertyBOOL("pluginreplacecontextitems"))
{
if ( m_vecItems->IsVirtualDirectoryRoot() )
{
CGUIDialogContextMenu::GetContextButtons("programs", item, buttons);
}
else
{
if (item->IsXBE() || item->IsShortCut())
{
if (CFile::Exists("special://xbmc/system/scripts/XBMC4Gamers Extras/Synopsis/default.py") || CFile::Exists("special://xbmc/system/scripts/Synopsis/default.py"))
{
buttons.Add(CONTEXT_BUTTON_SYNOPSIS, "Synopsis"); // Synopsis
}
CStdString strLaunch = g_localizeStrings.Get(518); // Launch
if (g_guiSettings.GetBool("myprograms.gameautoregion"))
{
int iRegion = GetRegion(itemNumber);
if (iRegion == VIDEO_NTSCM)
strLaunch += " (NTSC-M)";
if (iRegion == VIDEO_NTSCJ)
strLaunch += " (NTSC-J)";
if (iRegion == VIDEO_PAL50)
strLaunch += " (PAL)";
if (iRegion == VIDEO_PAL60)
strLaunch += " (PAL-60)";
}
buttons.Add(CONTEXT_BUTTON_LAUNCH, strLaunch);
DWORD dwTitleId = CUtil::GetXbeID(item->GetPath());
CStdString strTitleID;
CStdString strGameSavepath;
strTitleID.Format("%08X",dwTitleId);
URIUtils::AddFileToFolder("E:\\udata\\",strTitleID,strGameSavepath);
if (CDirectory::Exists(strGameSavepath))
buttons.Add(CONTEXT_BUTTON_GAMESAVES, 20322); // Goto GameSaves
if (g_guiSettings.GetBool("myprograms.gameautoregion"))
buttons.Add(CONTEXT_BUTTON_LAUNCH_IN, 519); // launch in video mode
if (g_passwordManager.IsMasterLockUnlocked(false) || g_settings.GetCurrentProfile().canWriteDatabases())
{
if (item->IsShortCut())
buttons.Add(CONTEXT_BUTTON_RENAME, 16105); // rename
else
buttons.Add(CONTEXT_BUTTON_RENAME, 520); // edit xbe title
}
if (m_database.ItemHasTrainer(dwTitleId))
buttons.Add(CONTEXT_BUTTON_TRAINER_OPTIONS, 12015); // trainer options
}
buttons.Add(CONTEXT_BUTTON_SCAN_TRAINERS, 12012); // scan trainers
buttons.Add(CONTEXT_BUTTON_GOTO_ROOT, 20128); // Go to Root
}
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
if (item && !item->GetPropertyBOOL("pluginreplacecontextitems"))
buttons.Add(CONTEXT_BUTTON_SETTINGS, 5); // Settings
}
示例8: HandleQualityList
bool CGUIDialogBoxeeCtx::HandleQualityList()
{
const CFileItemList* linksFileItemList = m_item.GetLinksList();
if (!linksFileItemList)
{
return true;
}
if (linksFileItemList->Size() == 1)
{
return true;
}
int FocusedItem = 0;
m_pDlgVideoQuality = (CGUIDialogBoxeeVideoQuality*)g_windowManager.GetWindow(WINDOW_DIALOG_BOXEE_VIDEO_QUALITY);
m_pDlgVideoQuality->Reset();
for (int i=0; i<linksFileItemList->Size(); i++)
{
CFileItemPtr linkFileItemToAdd = linksFileItemList->Get(i);
m_pDlgVideoQuality->Add((*linkFileItemToAdd));
// if the user ask for a different quality - switch to a different link
if (m_item.GetPropertyInt("quality") ==linkFileItemToAdd->GetPropertyInt("quality"))
{
FocusedItem = i;
}
}
m_pDlgVideoQuality->ChangeDialogType(LIST_CVQ_DIALOG);
m_pDlgVideoQuality->SetFocusedItem(FocusedItem);
m_pDlgVideoQuality->DoModal();
if (m_pDlgVideoQuality->IsCanceled())
{
return false;
}
int chosenItemPos = m_pDlgVideoQuality->GetSelectedItemPos();
CFileItemPtr chosenItem = linksFileItemList->Get(chosenItemPos);
if(m_pDlgVideoQuality->GetSavePerference())
{
BOXEE::Boxee::GetInstance().GetMetadataEngine().UpdateProviderPerf(chosenItem->GetProperty("link-provider"),chosenItem->GetPropertyInt("quality"));
}
// if the user ask for a different quality - switch to a different link
if (m_item.GetPropertyInt("quality") !=chosenItem->GetPropertyInt("quality"))
{
CLog::Log(LOGDEBUG,"CGUIDialogBoxeeCtx::HandleQualityList change quality to %d", chosenItem->GetPropertyInt("quality"));
if (chosenItem.get() == NULL)
{
CLog::Log(LOGERROR,"CGUIDialogBoxeeMediaAction::OnPlayMedia choose NULL item");
return false;
}
// copy the relevant properties from the chosen item
m_item.m_strPath = chosenItem->m_strPath;
m_item.SetProperty("link-boxeetype", chosenItem->GetProperty("link-boxeetype"));
m_item.SetProperty("link-provider", chosenItem->GetProperty("link-provider"));
m_item.SetProperty("link-providername", chosenItem->GetProperty("link-providername"));
m_item.SetProperty("link-providerthumb", chosenItem->GetProperty("link-providerthumb"));
m_item.SetProperty("link-countrycodes", chosenItem->GetProperty("link-countrycodes"));
m_item.SetProperty("link-countryrel", chosenItem->GetPropertyBOOL("link-countryrel"));
m_item.SetProperty("quality-lbl", chosenItem->GetProperty("quality-lbl"));
m_item.SetProperty("quality", chosenItem->GetPropertyInt("quality"));
OnPlay();
}
return true;
}
示例9: GetDirectory
bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, CStdString strMask /*=""*/, bool bUseFileDirectories /* = true */, bool allowPrompting /* = false */, DIR_CACHE_TYPE cacheDirectory /* = DIR_CACHE_NEVER */, bool extFileInfo /* = true */)
{
try
{
auto_ptr<IDirectory> pDirectory(CFactoryDirectory::Create(strPath));
if (!pDirectory.get())
return false;
// check our cache for this path
if (g_directoryCache.GetDirectory(strPath, items, cacheDirectory == DIR_CACHE_ALWAYS))
items.m_strPath = strPath;
else
{
// need to clear the cache (in case the directory fetch fails)
// and (re)fetch the folder
if (cacheDirectory != DIR_CACHE_NEVER)
g_directoryCache.ClearDirectory(strPath);
pDirectory->SetAllowPrompting(allowPrompting);
pDirectory->SetCacheDirectory(cacheDirectory);
pDirectory->SetUseFileDirectories(bUseFileDirectories);
pDirectory->SetExtFileInfo(extFileInfo);
items.m_strPath = strPath;
if (!pDirectory->GetDirectory(strPath, items))
{
CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, strPath.c_str());
return false;
}
// cache the directory, if necessary
if (cacheDirectory != DIR_CACHE_NEVER)
g_directoryCache.SetDirectory(strPath, items, pDirectory->GetCacheType(strPath));
}
// now filter for allowed files
pDirectory->SetMask(strMask);
for (int i = 0; i < items.Size(); ++i)
{
CFileItemPtr item = items[i];
if ((!item->m_bIsFolder && !pDirectory->IsAllowed(item->m_strPath)) ||
(item->GetPropertyBOOL("file:hidden") && !g_guiSettings.GetBool("filelists.showhidden")))
{
items.Remove(i);
i--; // don't confuse loop
}
}
// Should any of the files we read be treated as a directory?
// Disable for database folders, as they already contain the extracted items
if (bUseFileDirectories && !items.IsMusicDb() && !items.IsVideoDb() && !items.IsSmartPlayList())
{
for (int i=0; i< items.Size(); ++i)
{
CFileItemPtr pItem=items[i];
if ((!pItem->m_bIsFolder) && (!pItem->IsInternetStream()))
{
auto_ptr<IFileDirectory> pDirectory(CFactoryFileDirectory::Create(pItem->m_strPath,pItem.get(),strMask));
if (pDirectory.get())
pItem->m_bIsFolder = true;
else
if (pItem->m_bIsFolder)
{
items.Remove(i);
i--; // don't confuse loop
}
}
}
}
return true;
}
#ifndef _LINUX
catch (const win32_exception &e)
{
e.writelog(__FUNCTION__);
}
#endif
catch (...)
{
CLog::Log(LOGERROR, "%s - Unhandled exception", __FUNCTION__);
}
CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, strPath.c_str());
return false;
}
示例10: OnMessage
bool CGUIDialogBoxeeShare::OnMessage(CGUIMessage &message)
{
if (message.GetMessage() == GUI_MSG_WINDOW_INIT)
{
//if (!LoadSocialServices(true))
int retCode;
if (BoxeeUtils::GetShareServicesJson(m_jsonServiceList,retCode,true) != JOB_SUCCEEDED)
{
Close();
return true;
}
}
else if (message.GetMessage() == GUI_MSG_WINDOW_DEINIT)
{
m_item.Reset();
}
else if (message.GetMessage() == GUI_MSG_CLICKED)
{
switch(message.GetSenderId())
{
case EDIT_CONTROL:
{
CGUIEditControl* editControl = (CGUIEditControl*)GetControl(EDIT_CONTROL);
CGUIWindow* activeWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
if (editControl && activeWindow)
{
CStdString leftToInput = BOXEE::BXUtils::IntToString(editControl->GetMaxInputSize() - (int)editControl->GetLabel2().size());
activeWindow->SetProperty(LEFT_TO_INPUT_SIZE,leftToInput);
}
}
break;
case SHARE_BTN:
{
CGUIEditControl* editControl = (CGUIEditControl*)GetControl(EDIT_CONTROL);
if (!editControl)
{
CGUIDialogOK2::ShowAndGetInput(257, 55195);
return true;
}
m_strText = editControl->GetLabel2();
if (m_strText.IsEmpty())
{
CGUIDialogOK2::ShowAndGetInput(54000, 54001);
return true;
}
std::vector<BOXEE::BXFriend> recommendTo; // always empty at the moment - which means - "to all the world".
BoxeeUtils::Share(&m_item, recommendTo, m_servicesList, false, m_strText);
Close();
g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::ICON_HEART, "", g_localizeStrings.Get(51033), 3000, KAI_RED_COLOR, KAI_GREY_COLOR);
}
break;
case SERVICE_LIST:
{
CGUIBaseContainer* serviceList = (CGUIBaseContainer*) GetControl(SERVICE_LIST);
CGUIListItemPtr itemUI = serviceList->GetSelectedItemPtr();
int iItem = serviceList->GetSelectedItem();
if (iItem < m_servicesList.Size() && iItem >= 0 )
{
CFileItemPtr fileItem = m_servicesList.Get(iItem);
CFileItem* fItem = fileItem.get();
//fItem->Dump();
if (!fileItem->GetPropertyBOOL("enable"))
{
//open up the browser dialog with the link we got from the server
#ifdef CANMORE
if (!g_application.IsPlaying() || g_application.GetCurrentPlayer() != PCID_FLASHLAYER)
{
//browser reported success
int retCode;
if (CGUIWebDialog::ShowAndGetInput(fileItem->GetProperty("connect")) && BoxeeUtils::GetShareServicesJson(m_jsonServiceList,retCode,true) == JOB_SUCCEEDED)
{
UpdateShareDialog();
}
}
else
#endif
{
CStdString text = g_localizeStrings.Get(80001);
text += " " + fileItem->GetProperty("link");
CGUIDialogOK2::ShowAndGetInput(g_localizeStrings.Get(10014),text);
}
return true;
}
bool bSelection = itemUI->GetPropertyBOOL("isSelected");
fItem->SetProperty("isSelected", !bSelection);
itemUI->SetProperty("isSelected", !bSelection);
}
}
break;
}
}
//.........这里部分代码省略.........
示例11: GetContextButtons
void CGUIWindowVideoFiles::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (item)
{
// are we in the playlists location?
if (m_vecItems->IsVirtualDirectoryRoot())
{
// get the usual shares, and anything for all media windows
CGUIDialogContextMenu::GetContextButtons("video", item, buttons);
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
// add scan button somewhere here
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
if (g_guiSettings.GetBool("videolibrary.enabled") && !item->IsDVD() && item->m_strPath != "add" &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
CVideoDatabase database;
database.Open();
SScraperInfo info;
if (item && database.GetScraperForPath(item->m_strPath,info))
{
if (!info.strPath.IsEmpty() && !info.strContent.IsEmpty())
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
}
}
else
{
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
if (!item->GetPropertyBOOL("pluginreplacecontextitems"))
{
// Movie Info button
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
if (g_guiSettings.GetBool("videolibrary.enabled") &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
SScraperInfo info;
VIDEO::SScanSettings settings;
int iFound = GetScraperForItem(item.get(), info, settings);
int infoString = 13346;
if (info.strContent.Equals("tvshows"))
infoString = item->m_bIsFolder ? 20351 : 20352;
if (info.strContent.Equals("musicvideos"))
infoString = 20393;
if (item->m_bIsFolder)
{
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
if (!item->IsPlayList())
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
if (iFound==0)
{ // scraper not set - allow movie information or set content
CStdString strPath(item->m_strPath);
CUtil::AddSlashAtEnd(strPath);
if ((info.strContent.Equals("movies") && m_database.HasMovieInfo(strPath)) ||
(info.strContent.Equals("tvshows") && m_database.HasTvShowInfo(strPath)))
buttons.Add(CONTEXT_BUTTON_INFO, infoString);
}
else
{ // scraper found - allow movie information, scan for new content, or set different type of content
if (!info.strContent.Equals("musicvideos"))
buttons.Add(CONTEXT_BUTTON_INFO, infoString);
if (!info.strPath.IsEmpty() && !info.strContent.IsEmpty())
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
}
else
{
// single file
if ((info.strContent.Equals("movies") && (iFound > 0 ||
m_database.HasMovieInfo(item->m_strPath))) ||
m_database.HasEpisodeInfo(item->m_strPath) ||
info.strContent.Equals("musicvideos"))
{
buttons.Add(CONTEXT_BUTTON_INFO, infoString);
}
m_database.Open();
if (!item->IsParentFolder())
{
if (!m_database.HasMovieInfo(item->m_strPath) && !m_database.HasEpisodeInfo(item->m_strPath))
buttons.Add(CONTEXT_BUTTON_ADD_TO_LIBRARY, 527); // Add to Database
}
m_database.Close();
}
}
}
if (!item->IsParentFolder())
//.........这里部分代码省略.........
示例12: GetContextButtons
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
if (item && item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->m_strPath);
if (!item)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
else
buttons.Add(CONTEXT_BUTTON_UPDATE_LIBRARY, 653);
}
else
{
ADDON::ScraperPtr info;
VIDEO::SScanSettings settings;
GetScraperForItem(item.get(), info, settings);
if (info && info->Content() == CONTENT_TVSHOWS)
buttons.Add(CONTEXT_BUTTON_INFO, item->m_bIsFolder ? 20351 : 20352);
else if (info && info->Content() == CONTENT_MUSICVIDEOS)
buttons.Add(CONTEXT_BUTTON_INFO,20393);
else if (!item->m_bIsFolder && !item->m_strPath.Left(19).Equals("newsmartplaylist://"))
buttons.Add(CONTEXT_BUTTON_INFO, 13346);
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strArtist.IsEmpty())
{
CMusicDatabase database;
database.Open();
if (database.GetArtistByName(item->GetVideoInfoTag()->m_strArtist) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0 &&
item->GetVideoInfoTag()->m_strArtist.size() > 0 &&
item->GetVideoInfoTag()->m_strTitle.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetSongByArtistAndAlbumAndTitle(item->GetVideoInfoTag()->m_strArtist,
item->GetVideoInfoTag()->m_strAlbum,
item->GetVideoInfoTag()->m_strTitle) > -1)
{
buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20398);
}
}
if (!item->IsParentFolder())
{
// can we update the database?
if (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
if (node == NODE_TYPE_TITLE_TVSHOWS)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
else
buttons.Add(CONTEXT_BUTTON_UPDATE_TVSHOW, 13349);
}
if ((info && info->Content() == CONTENT_TVSHOWS && item->m_bIsFolder) ||
(item->IsVideoDb() && item->HasVideoInfoTag() && !item->m_bIsFolder))
{
if (item->m_bIsFolder || item->GetVideoInfoTag()->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); //Mark as UnWatched
if (item->m_bIsFolder || item->GetVideoInfoTag()->m_playCount == 0)
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); //Mark as Watched
if (node != NODE_TYPE_SEASONS)
buttons.Add(CONTEXT_BUTTON_EDIT, 16105); //Edit Title
}
if (m_database.HasContent(VIDEODB_CONTENT_TVSHOWS) && item->HasVideoInfoTag() &&
!item->m_bIsFolder && item->GetVideoInfoTag()->m_iEpisode == -1 &&
item->GetVideoInfoTag()->m_strArtist.IsEmpty()) // movie entry
{
if (m_database.IsLinkedToTvshow(item->GetVideoInfoTag()->m_iDbId))
buttons.Add(CONTEXT_BUTTON_UNLINK_MOVIE,20385);
buttons.Add(CONTEXT_BUTTON_LINK_MOVIE,20384);
}
if (node == NODE_TYPE_SEASONS && item->m_bIsFolder)
buttons.Add(CONTEXT_BUTTON_SET_SEASON_THUMB, 20371);
if (item->m_strPath.Left(14).Equals("videodb://1/7/") && item->m_strPath.size() > 14 && item->m_bIsFolder) // sets
{
buttons.Add(CONTEXT_BUTTON_EDIT, 16105);
//.........这里部分代码省略.........
示例13: GetContextButtons
void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item)
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->m_strPath.Equals("special://musicplaylists/");
if (m_vecItems->IsVirtualDirectoryRoot())
{
// get the usual music shares, and anything for all media windows
CGUIDialogContextMenu::GetContextButtons("music", item, buttons);
// enable Rip CD an audio disc
if (CDetectDVDMedia::IsDiscInDrive() && item->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
if (item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
if (!item->IsPlayList())
{
if (item->IsAudio() && !item->IsLastFM() && !item->IsShoutCast())
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
else if (!item->IsParentFolder() && !item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(3).Equals("new") && item->m_bIsFolder)
{
#if 0
if (m_musicdatabase.GetAlbumIdByPath(item->m_strPath) > -1)
#endif
buttons.Add(CONTEXT_BUTTON_INFO, 13351); // Album Info
}
}
// enable Rip CD Audio or Track button if we have an audio disc
if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_TRACK, 610);
}
// enable CDDB lookup if the current dir is CDDA
if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA() &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_CDDB, 16002);
}
if (!item->IsParentFolder() && !item->IsReadOnly())
{
// either we're at the playlist location or its been explicitly allowed
if (inPlaylists || g_guiSettings.GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
// Add the scan button(s)
CGUIDialogMusicScan *pScanDlg = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (g_guiSettings.GetBool("musiclibrary.enabled") && pScanDlg)
{
if (pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
else if (!inPlaylists && !m_vecItems->IsInternetStream() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Equals("add") && !item->IsParentFolder() &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
}
}
if (!m_vecItems->IsVirtualDirectoryRoot())
buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
CGUIWindowMusicBase::GetNonContextButtons(buttons);
}
示例14: GetContextButtons
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
if (item && item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->m_strPath);
if (!item)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
else
buttons.Add(CONTEXT_BUTTON_UPDATE_LIBRARY, 653);
}
else if (m_vecItems->m_strPath.Equals("sources://video/"))
{
// get the usual shares
CGUIDialogContextMenu::GetContextButtons("video", item, buttons);
// add scan button somewhere here
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
if (!item->IsDVD() && item->m_strPath != "add" &&
(g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
CVideoDatabase database;
database.Open();
ADDON::ScraperPtr info = database.GetScraperForPath(item->m_strPath);
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
{
if (!item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath())
{
if (info && info->Content() != CONTENT_NONE)
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
else
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
}
}
if (info && (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning())))
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
}
else
{
ADDON::ScraperPtr info;
VIDEO::SScanSettings settings;
GetScraperForItem(item.get(), info, settings);
if (info && info->Content() == CONTENT_TVSHOWS)
buttons.Add(CONTEXT_BUTTON_INFO, item->m_bIsFolder ? 20351 : 20352);
else if (info && info->Content() == CONTENT_MUSICVIDEOS)
buttons.Add(CONTEXT_BUTTON_INFO,20393);
else if (!item->m_bIsFolder && !item->m_strPath.Left(19).Equals("newsmartplaylist://"))
buttons.Add(CONTEXT_BUTTON_INFO, 13346);
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strArtist.IsEmpty())
{
CMusicDatabase database;
database.Open();
if (database.GetArtistByName(item->GetVideoInfoTag()->m_strArtist) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0 &&
item->GetVideoInfoTag()->m_strArtist.size() > 0 &&
item->GetVideoInfoTag()->m_strTitle.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetSongByArtistAndAlbumAndTitle(item->GetVideoInfoTag()->m_strArtist,
item->GetVideoInfoTag()->m_strAlbum,
item->GetVideoInfoTag()->m_strTitle) > -1)
{
buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20398);
}
}
if (!item->IsParentFolder())
{
// can we update the database?
if (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
if (node == NODE_TYPE_TITLE_TVSHOWS)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
//.........这里部分代码省略.........
示例15: GetDirectory
bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, CStdString strMask /*=""*/, bool bUseFileDirectories /* = true */, bool allowPrompting /* = false */, DIR_CACHE_TYPE cacheDirectory /* = DIR_CACHE_ONCE */, bool extFileInfo /* = true */, bool allowThreads /* = false */, bool getHidden /* = false */)
{
try
{
CStdString realPath = URIUtils::SubstitutePath(strPath);
boost::shared_ptr<IDirectory> pDirectory(CFactoryDirectory::Create(realPath));
if (!pDirectory.get())
return false;
// check our cache for this path
if (g_directoryCache.GetDirectory(strPath, items, cacheDirectory == DIR_CACHE_ALWAYS))
items.SetPath(strPath);
else
{
// need to clear the cache (in case the directory fetch fails)
// and (re)fetch the folder
if (cacheDirectory != DIR_CACHE_NEVER)
g_directoryCache.ClearDirectory(strPath);
pDirectory->SetAllowPrompting(allowPrompting);
pDirectory->SetCacheDirectory(cacheDirectory);
pDirectory->SetUseFileDirectories(bUseFileDirectories);
pDirectory->SetExtFileInfo(extFileInfo);
bool result = false, cancel = false;
while (!result && !cancel)
{
if (g_application.IsCurrentThread() && allowThreads && !URIUtils::IsSpecial(strPath))
{
CSingleExit ex(g_graphicsContext);
CGetDirectory get(pDirectory, realPath);
if(!get.Wait(TIME_TO_BUSY_DIALOG))
{
CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
dialog->Show();
while(!get.Wait(10))
{
CSingleLock lock(g_graphicsContext);
if(dialog->IsCanceled())
{
cancel = true;
break;
}
g_windowManager.ProcessRenderLoop(false);
}
if(dialog)
dialog->Close();
}
result = get.GetDirectory(items);
}
else
{
items.SetPath(strPath);
result = pDirectory->GetDirectory(realPath, items);
}
if (!result)
{
if (!cancel && g_application.IsCurrentThread() && pDirectory->ProcessRequirements())
continue;
CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, strPath.c_str());
return false;
}
}
// cache the directory, if necessary
if (cacheDirectory != DIR_CACHE_NEVER)
g_directoryCache.SetDirectory(strPath, items, pDirectory->GetCacheType(strPath));
}
// now filter for allowed files
pDirectory->SetMask(strMask);
for (int i = 0; i < items.Size(); ++i)
{
CFileItemPtr item = items[i];
// TODO: we shouldn't be checking the gui setting here;
// callers should use getHidden instead
if ((!item->m_bIsFolder && !pDirectory->IsAllowed(item->GetPath())) ||
(item->GetPropertyBOOL("file:hidden") && !getHidden && !g_guiSettings.GetBool("filelists.showhidden")))
{
items.Remove(i);
i--; // don't confuse loop
}
}
// Should any of the files we read be treated as a directory?
// Disable for database folders, as they already contain the extracted items
if (bUseFileDirectories && !items.IsMusicDb() && !items.IsVideoDb() && !items.IsSmartPlayList())
FilterFileDirectories(items, strMask);
return true;
}
#ifndef _LINUX
catch (const win32_exception &e)
{
e.writelog(__FUNCTION__);
}
//.........这里部分代码省略.........