本文整理汇总了C++中CFileItem::IsParentFolder方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::IsParentFolder方法的具体用法?C++ CFileItem::IsParentFolder怎么用?C++ CFileItem::IsParentFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::IsParentFolder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateButtons
// \brief Updates the states (enable, disable, visible...)
// of the controls defined by this window
// Override this function in a derived class to add new controls
void CGUIMediaWindow::UpdateButtons()
{
if (m_guiState.get())
{
// Update sorting controls
if (m_guiState->GetDisplaySortOrder()==SORT_ORDER_NONE)
{
CONTROL_DISABLE(CONTROL_BTNSORTASC);
}
else
{
CONTROL_ENABLE(CONTROL_BTNSORTASC);
if (m_guiState->GetDisplaySortOrder()==SORT_ORDER_ASC)
{
CGUIMessage msg(GUI_MSG_DESELECTED, GetID(), CONTROL_BTNSORTASC);
g_graphicsContext.SendMessage(msg);
}
else
{
CGUIMessage msg(GUI_MSG_SELECTED, GetID(), CONTROL_BTNSORTASC);
g_graphicsContext.SendMessage(msg);
}
}
// Update list/thumb control
m_viewControl.SetCurrentView(m_guiState->GetViewAsControl());
// Update sort by button
if (m_guiState->GetSortMethod()==SORT_METHOD_NONE)
{
CONTROL_DISABLE(CONTROL_BTNSORTBY);
}
else
{
CONTROL_ENABLE(CONTROL_BTNSORTBY);
}
CStdString sortLabel;
sortLabel.Format(g_localizeStrings.Get(550).c_str(), g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
SET_CONTROL_LABEL(CONTROL_BTNSORTBY, sortLabel);
}
int iItems = m_vecItems->Size();
if (iItems)
{
CFileItem* pItem = m_vecItems->Get(0);
if (pItem->IsParentFolder()) iItems--;
}
CStdString items;
items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
}
示例2: UpdateButtons
void CGUIWindowMusicNav::UpdateButtons()
{
CGUIWindowMusicBase::UpdateButtons();
// Update object count
int iItems = m_vecItems->Size();
if (iItems)
{
// check for parent dir and "all" items
// should always be the first two items
for (int i = 0; i <= (iItems>=2 ? 1 : 0); i++)
{
CFileItem* pItem = m_vecItems->Get(i);
if (pItem->IsParentFolder()) iItems--;
if (pItem->m_strPath.Left(4).Equals("/-1/")) iItems--;
}
// or the last item
if (m_vecItems->Size() > 2 &&
m_vecItems->Get(m_vecItems->Size()-1)->m_strPath.Left(4).Equals("/-1/"))
iItems--;
}
CStdString items;
items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str());
SET_CONTROL_LABEL(CONTROL_LABELFILES, items);
// set the filter label
CStdString strLabel;
// "Playlists"
if (m_vecItems->m_strPath.Equals("special://musicplaylists/"))
strLabel = g_localizeStrings.Get(136);
// "{Playlist Name}"
else if (m_vecItems->IsPlayList())
{
// get playlist name from path
CStdString strDummy;
CUtil::Split(m_vecItems->m_strPath, strDummy, strLabel);
}
// everything else is from a musicdb:// path
else
{
CMusicDatabaseDirectory dir;
dir.GetLabel(m_vecItems->m_strPath, strLabel);
}
SET_CONTROL_LABEL(CONTROL_FILTER, strLabel);
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled());
SET_CONTROL_SELECTED(GetID(),CONTROL_BTN_FILTER, !m_filter.IsEmpty());
}
示例3: GetContextButtons
void CGUIMediaWindow::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItem *item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : NULL;
if (item == NULL)
return;
if (item->IsPluginFolder())
{
if (CPluginSettings::SettingsExist(item->m_strPath))
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
}
// 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));
}
#ifdef PRE_SKIN_VERSION_2_1_COMPATIBILITY
// check if the skin even supports favourites
RESOLUTION res;
CStdString favourites(g_SkinInfo.GetSkinPath("DialogFavourites.xml", &res));
if (XFILE::CFile::Exists(favourites))
{
#endif
// 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, GetID()))
buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14077); // Remove Favourite
else
buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14076); // Add To Favourites;
}
#ifdef PRE_SKIN_VERSION_2_1_COMPATIBILITY
}
#endif
}
示例4: GetContextButtons
void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItem *item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : NULL;
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: DoScan
bool CMusicInfoScanner::DoScan(const CStdString& strDirectory)
{
if (m_pObserver)
m_pObserver->OnDirectoryChanged(strDirectory);
// load subfolder
CFileItemList items;
CDirectory::GetDirectory(strDirectory, items, g_stSettings.m_musicExtensions + "|.jpg|.tbn");
// sort and get the path hash. Note that we don't filter .cue sheet items here as we want
// to detect changes in the .cue sheet as well. The .cue sheet items only need filtering
// if we have a changed hash.
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
CStdString hash;
GetPathHash(items, hash);
// get the folder's thumb (this will cache the album thumb).
items.SetMusicThumb(true); // true forces it to get a remote thumb
// check whether we need to rescan or not
CStdString dbHash;
if (!m_musicDatabase.GetPathHash(strDirectory, dbHash) || dbHash != hash)
{ // path has changed - rescan
if (dbHash.IsEmpty())
CLog::Log(LOGDEBUG, "%s Scanning dir '%s' as not in the database", __FUNCTION__, strDirectory.c_str());
else
CLog::Log(LOGDEBUG, "%s Rescanning dir '%s' due to change", __FUNCTION__, strDirectory.c_str());
// filter items in the sub dir (for .cue sheet support)
items.FilterCueItems();
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
// and then scan in the new information
if (RetrieveMusicInfo(items, strDirectory) > 0)
{
if (m_pObserver)
m_pObserver->OnDirectoryScanned(strDirectory);
}
// save information about this folder
m_musicDatabase.SetPathHash(strDirectory, hash);
}
else
{ // path is the same - no need to rescan
CLog::Log(LOGDEBUG, "%s Skipping dir '%s' due to no change", __FUNCTION__, strDirectory.c_str());
m_currentItem += CountFiles(items, false); // false for non-recursive
// notify our observer of our progress
if (m_pObserver)
{
if (m_itemCount>0)
m_pObserver->OnSetProgress(m_currentItem, m_itemCount);
m_pObserver->OnDirectoryScanned(strDirectory);
}
}
// remove this path from the list we're processing
set<CStdString>::iterator it = m_pathsToScan.find(strDirectory);
if (it != m_pathsToScan.end())
m_pathsToScan.erase(it);
// now scan the subfolders
for (int i = 0; i < items.Size(); ++i)
{
CFileItem *pItem = items[i];
if (m_bStop)
break;
// if we have a directory item (non-playlist) we then recurse into that folder
if (pItem->m_bIsFolder && !pItem->IsParentFolder() && !pItem->IsPlayList())
{
CStdString strPath=pItem->m_strPath;
if (!DoScan(strPath))
{
m_bStop = true;
}
}
}
return !m_bStop;
}
示例6: 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;
CFileItem* pItem = m_vecItems->Get(iItem);
if (pItem->IsParentFolder())
{
GoParentFolder();
return true;
}
else if (pItem->m_bIsFolder)
{
if ( pItem->m_bIsShareOrDrive )
{
const CStdString& strLockType=m_guiState->GetLockType();
if (g_settings.m_vecProfiles[0].getLockMode() != LOCK_MODE_EVERYONE)
if (!strLockType.IsEmpty() && !g_passwordManager.IsItemUnlocked(pItem, strLockType))
return true;
if (!HaveDiscOrConnection(pItem->m_strPath, pItem->m_iDriveType))
return true;
}
// remove the directory cache if the folder is not normally cached
CFileItemList items(pItem->m_strPath);
if (!items.AlwaysCache())
items.RemoveDiscCache();
CFileItem directory(*pItem);
if (!Update(directory.m_strPath))
ShowShareErrorMessage(&directory);
return true;
}
else if (pItem->m_strPath.Left(9).Equals("plugin://"))
return DIRECTORY::CPluginDirectory::RunScriptWithParams(pItem->m_strPath);
else
{
m_iSelectedItem = m_viewControl.GetSelectedItem();
if (pItem->m_strPath == "newplaylist://")
{
m_gWindowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST_EDITOR);
return true;
}
else if (pItem->m_strPath.Left(19).Equals("newsmartplaylist://"))
{
if (CGUIDialogSmartPlaylistEditor::NewPlaylist(pItem->m_strPath.Mid(19)))
Update(m_vecItems->m_strPath);
return true;
}
if (m_guiState.get() && m_guiState->AutoPlayNextItem() && !g_partyModeManager.IsEnabled() && !pItem->IsPlayList())
{
// TODO: music videos!
if (pItem->m_strPath == "add" && pItem->GetLabel() == g_localizeStrings.Get(1026) && m_guiState->GetPlaylist() == PLAYLIST_MUSIC) // 'add source button' in empty root
{
if (CGUIDialogMediaSource::ShowAndAddMediaSource("music"))
{
Update("");
return true;
}
return false;
}
//play and add current directory to temporary playlist
int iPlaylist=m_guiState->GetPlaylist();
if (iPlaylist != PLAYLIST_NONE)
{
g_playlistPlayer.ClearPlaylist(iPlaylist);
g_playlistPlayer.Reset();
int songToPlay = 0;
CFileItemList queueItems;
for ( int i = 0; i < m_vecItems->Size(); i++ )
{
CFileItem* item = m_vecItems->Get(i);
if (item->m_bIsFolder)
continue;
if (!item->IsPlayList() && !item->IsZIP() && !item->IsRAR())
queueItems.Add(item);
if (item == pItem)
{ // item that was clicked
songToPlay = queueItems.Size() - 1;
}
}
g_playlistPlayer.Add(iPlaylist, queueItems);
queueItems.ClearKeepPointer();
// Save current window and directory to know where the selected item was
if (m_guiState.get())
m_guiState->SetPlaylistDirectory(m_vecItems->m_strPath);
// figure out where we start playback
if (g_playlistPlayer.IsShuffled(iPlaylist))
//.........这里部分代码省略.........
示例7: Update
// \brief Set window to a specific directory
// \param strDirectory The directory to be displayed in list/thumb control
// This function calls OnPrepareFileItems() and OnFinalizeFileItems()
bool CGUIMediaWindow::Update(const CStdString &strDirectory)
{
// get selected item
int iItem = m_viewControl.GetSelectedItem();
CStdString strSelectedItem = "";
if (iItem >= 0 && iItem < m_vecItems->Size())
{
CFileItem* pItem = m_vecItems->Get(iItem);
if (!pItem->IsParentFolder())
{
GetDirectoryHistoryString(pItem, strSelectedItem);
}
}
CStdString strOldDirectory = m_vecItems->m_strPath;
m_history.SetSelectedItem(strSelectedItem, strOldDirectory);
ClearFileItems();
m_vecItems->ClearProperties();
m_vecItems->SetThumbnailImage("");
if (!GetDirectory(strDirectory, *m_vecItems))
{
CLog::Log(LOGERROR,"CGUIMediaWindow::GetDirectory(%s) failed", strDirectory.c_str());
// if the directory is the same as the old directory, then we'll return
// false. Else, we assume we can get the previous directory
if (strDirectory.Equals(strOldDirectory))
return false;
// We assume, we can get the parent
// directory again, but we have to
// return false to be able to eg. show
// an error message.
CStdString strParentPath = m_history.GetParentPath();
m_history.RemoveParentPath();
Update(strParentPath);
return false;
}
// if we're getting the root source listing
// make sure the path history is clean
if (strDirectory.IsEmpty())
m_history.ClearPathHistory();
int iWindow = GetID();
bool bOkay = (iWindow == WINDOW_MUSIC_FILES || iWindow == WINDOW_VIDEO_FILES || iWindow == WINDOW_FILES || iWindow == WINDOW_PICTURES || iWindow == WINDOW_PROGRAMS);
if (strDirectory.IsEmpty() && bOkay && (m_vecItems->Size() == 0 || !m_guiState->DisableAddSourceButtons())) // add 'add source button'
{
CStdString strLabel = g_localizeStrings.Get(1026);
CFileItem *pItem = new CFileItem(strLabel);
pItem->m_strPath = "add";
pItem->SetThumbnailImage("DefaultAddSource.png");
pItem->SetLabel(strLabel);
pItem->SetLabelPreformated(true);
m_vecItems->Add(pItem);
}
m_iLastControl = GetFocusedControlID();
// Ask the derived class if it wants to load additional info
// for the fileitems like media info or additional
// filtering on the items, setting thumbs.
OnPrepareFileItems(*m_vecItems);
m_vecItems->FillInDefaultIcons();
m_guiState.reset(CGUIViewState::GetViewState(GetID(), *m_vecItems));
FormatAndSort(*m_vecItems);
// Ask the devived class if it wants to do custom list operations,
// eg. changing the label
OnFinalizeFileItems(*m_vecItems);
UpdateButtons();
m_viewControl.SetItems(*m_vecItems);
strSelectedItem = m_history.GetSelectedItem(m_vecItems->m_strPath);
bool bSelectedFound = false;
//int iSongInDirectory = -1;
for (int i = 0; i < m_vecItems->Size(); ++i)
{
CFileItem* pItem = m_vecItems->Get(i);
// Update selected item
if (!bSelectedFound)
{
CStdString strHistory;
GetDirectoryHistoryString(pItem, strHistory);
if (strHistory == strSelectedItem)
{
m_viewControl.SetSelectedItem(i);
bSelectedFound = true;
}
}
}
//.........这里部分代码省略.........
示例8: GetContextButtons
void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CGUIDialogMusicScan *musicScan = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
CFileItem *item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : NULL;
if (item && (item->GetExtraInfo().Find("lastfm") < 0))
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->m_strPath.Equals("special://musicplaylists/");
CMusicDatabaseDirectory dir;
SScraperInfo info;
m_musicdatabase.GetScraperForPath(item->m_strPath,info);
// enable music info button on an album or on a song.
if (item->IsAudio() && !item->IsPlayList() && !item->IsSmartPlayList() &&
!item->IsLastFM() && !item->IsShoutCast())
{
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658);
}
else if (item->IsVideoDb())
{
if (!item->m_bIsFolder) // music video
buttons.Add(CONTEXT_BUTTON_INFO, 20393);
if (item->m_strPath.Left(14).Equals("videodb://3/4/") &&
item->m_strPath.size() > 14 && item->m_bIsFolder)
{
long idArtist = m_musicdatabase.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel());
if (idArtist > - 1)
buttons.Add(CONTEXT_BUTTON_INFO,21891);
}
}
else if (!inPlaylists && (dir.HasAlbumInfo(item->m_strPath)||
dir.IsArtistDir(item->m_strPath) ) &&
!dir.IsAllItem(item->m_strPath) && !item->IsParentFolder() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(14).Equals("musicsearch://"))
{
if (dir.IsArtistDir(item->m_strPath))
buttons.Add(CONTEXT_BUTTON_INFO, 21891);
else
buttons.Add(CONTEXT_BUTTON_INFO, 13351);
}
// enable query all albums button only in album view
if (dir.HasAlbumInfo(item->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(14).Equals("musicsearch://"))
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
}
// enable query all artist button only in album view
if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
item->m_bIsFolder && !item->IsVideoDb() && !info.strContent.IsEmpty())
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
// turn off set artist image if not at artist listing.
if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) ||
(item->m_strPath.Left(14).Equals("videodb://3/4/") &&
item->m_strPath.size() > 14 && item->m_bIsFolder))
{
buttons.Add(CONTEXT_BUTTON_SET_ARTIST_THUMB, 13359);
}
if (m_vecItems->m_strPath.Equals("plugin://music/"))
buttons.Add(CONTEXT_BUTTON_SET_PLUGIN_THUMB, 1044);
//Set default or clear default
NODE_TYPE nodetype = dir.GetDirectoryType(item->m_strPath);
if (!item->IsParentFolder() && !inPlaylists &&
(nodetype == NODE_TYPE_ROOT ||
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
if (!item->m_strPath.Equals(g_settings.m_defaultMusicLibSource))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
if (strcmp(g_settings.m_defaultMusicLibSource, ""))
buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // clear default
}
NODE_TYPE childtype = dir.GetDirectoryChildType(item->m_strPath);
if (childtype == NODE_TYPE_ALBUM || childtype == NODE_TYPE_ARTIST ||
nodetype == NODE_TYPE_GENRE || nodetype == NODE_TYPE_ALBUM)
{
// we allow the user to set content for
// 1. general artist and album nodes
// 2. specific per genre
// 3. specific per artist
// 4. specific per album
buttons.Add(CONTEXT_BUTTON_SET_CONTENT,20195);
}
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetArtist().size() > 0)
{
CVideoDatabase database;
database.Open();
if (database.GetMusicVideoArtistByName(item->GetMusicInfoTag()->GetArtist()) > -1)
//.........这里部分代码省略.........