diff --git a/xbmc/FileSystem/MusicDatabaseDirectory/DirectoryNode.cpp b/xbmc/FileSystem/MusicDatabaseDirectory/DirectoryNode.cpp index bea36e6525..013de33f48 100644 --- a/xbmc/FileSystem/MusicDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/FileSystem/MusicDatabaseDirectory/DirectoryNode.cpp @@ -269,7 +269,7 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) return; // no need for "all" item when only one item - if (items.Size() == 1 || items.Size() == 2 && items[0]->IsParentFolder()) + if (items.GetObjectCount() <= 1) return; switch (GetChildType()) diff --git a/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNode.cpp b/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNode.cpp index 6f7e6ce807..a304c7cace 100644 --- a/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNode.cpp @@ -1,24 +1,24 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + #include "stdafx.h" #include "DirectoryNode.h" #include "Util.h" @@ -143,8 +143,8 @@ CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& str return new CDirectoryNodeRecentlyAddedMusicVideos(strName,pParent); case NODE_TYPE_TITLE_MUSICVIDEOS: return new CDirectoryNodeTitleMusicVideos(strName,pParent); - default: - break; + default: + break; } return NULL; @@ -266,7 +266,7 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) return; // no need for "all" item when only one item - if (items.Size() == 0 || items.Size() == 1 || items.Size() == 2 && items[0]->IsParentFolder()) + if (items.GetObjectCount() <= 1) return; // hack - as the season node might return episodes @@ -278,8 +278,8 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) pItem.reset(new CFileItem(g_localizeStrings.Get(20366))); // "All Seasons" pItem->m_strPath = BuildPath() + "-1/"; break; - default: - break; + default: + break; } if (pItem) diff --git a/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp b/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp index dff3ce8434..62c1578ed2 100644 --- a/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp +++ b/xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNodeSeasons.cpp @@ -50,8 +50,8 @@ bool CDirectoryNodeSeasons::GetContent(CFileItemList& items) int iFlatten = g_guiSettings.GetInt("videolibrary.flattentvshows"); bool bSuccess=videodatabase.GetSeasonsNav(BuildPath(), items, params.GetActorId(), params.GetDirectorId(), params.GetGenreId(), params.GetYear(), params.GetTvShowId()); - if ((items.GetObjectCount() == 1 && iFlatten == 1) || iFlatten == 2) - { // flatten if one season or flatten always + if (items.GetObjectCount() == 1 && g_guiSettings.GetBool("videolibrary.singleseason")) + { items.Clear(); videodatabase.GetEpisodesNav(BuildPath()+"-1/",items,params.GetGenreId(),params.GetYear(),params.GetActorId(),params.GetDirectorId(),params.GetTvShowId()); items.m_strPath = BuildPath()+"-1/"; diff --git a/xbmc/GUIMediaWindow.cpp b/xbmc/GUIMediaWindow.cpp index 9d66a3c3e0..86ced867a1 100644 --- a/xbmc/GUIMediaWindow.cpp +++ b/xbmc/GUIMediaWindow.cpp @@ -412,14 +412,8 @@ void CGUIMediaWindow::UpdateButtons() SET_CONTROL_LABEL(CONTROL_BTNSORTBY, sortLabel); } - int iItems = m_vecItems->Size(); - if (iItems) - { - CFileItemPtr pItem = m_vecItems->Get(0); - if (pItem->IsParentFolder()) iItems--; - } CStdString items; - items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); + items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); } diff --git a/xbmc/GUIWindowMusicPlaylist.cpp b/xbmc/GUIWindowMusicPlaylist.cpp index 7ba4930661..d7ced6d06f 100644 --- a/xbmc/GUIWindowMusicPlaylist.cpp +++ b/xbmc/GUIWindowMusicPlaylist.cpp @@ -413,14 +413,8 @@ void CGUIWindowMusicPlayList::UpdateButtons() SET_CONTROL_LABEL(CONTROL_BTNREPEAT, g_localizeStrings.Get(iRepeat)); // Update object count label - int iItems = m_vecItems->Size(); - if (iItems) - { - CFileItemPtr pItem = m_vecItems->Get(0); - if (pItem->IsParentFolder()) iItems--; - } CStdString items; - items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); + items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); MarkPlaying(); diff --git a/xbmc/GUIWindowMusicPlaylistEditor.cpp b/xbmc/GUIWindowMusicPlaylistEditor.cpp index 3204de5ad8..daea4d373f 100644 --- a/xbmc/GUIWindowMusicPlaylistEditor.cpp +++ b/xbmc/GUIWindowMusicPlaylistEditor.cpp @@ -186,14 +186,8 @@ void CGUIWindowMusicPlaylistEditor::UpdateButtons() CGUIWindowMusicBase::UpdateButtons(); // Update object count label - int iItems = m_vecItems->Size(); - if (iItems) - { - CFileItemPtr pItem = m_vecItems->Get(0); - if (pItem->IsParentFolder()) iItems--; - } CStdString items; - items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); // " 14 Objects" + items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); // " 14 Objects" SET_CONTROL_LABEL(CONTROL_LABELFILES, items); } diff --git a/xbmc/GUIWindowMusicSongs.cpp b/xbmc/GUIWindowMusicSongs.cpp index 81339ab2b5..98728412a3 100644 --- a/xbmc/GUIWindowMusicSongs.cpp +++ b/xbmc/GUIWindowMusicSongs.cpp @@ -359,14 +359,8 @@ void CGUIWindowMusicSongs::UpdateButtons() } // Update object count label - int iItems = m_vecItems->Size(); - if (iItems) - { - CFileItemPtr pItem = m_vecItems->Get(0); - if (pItem->IsParentFolder()) iItems--; - } CStdString items; - items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); + items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); } diff --git a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindowXML.cpp b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindowXML.cpp index 2faa718e1c..70af75b1cb 100644 --- a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindowXML.cpp +++ b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindowXML.cpp @@ -454,14 +454,8 @@ void CGUIPythonWindowXML::UpdateButtons() SET_CONTROL_LABEL(CONTROL_BTNSORTBY, sortLabel); } - int iItems = m_vecItems->Size(); - if (iItems) - { - CFileItemPtr pItem = m_vecItems->Get(0); - if (pItem->IsParentFolder()) iItems--; - } CStdString items; - items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); + items.Format("%i %s", m_vecItems->GetObjectCount(), g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); }