Skip to content

Commit

Permalink
fixed: "Flatten single season tv shows" didn't work if parent folders…
Browse files Browse the repository at this point in the history
… was on.

git-svn-id: http://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC@13762 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
jmarshallnz authored and elan committed Oct 26, 2008
1 parent 2877c1f commit 633804e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 64 deletions.
2 changes: 1 addition & 1 deletion xbmc/FileSystem/MusicDatabaseDirectory/DirectoryNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
52 changes: 26 additions & 26 deletions xbmc/FileSystem/VideoDatabaseDirectory/DirectoryNode.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down
8 changes: 1 addition & 7 deletions xbmc/GUIMediaWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 1 addition & 7 deletions xbmc/GUIWindowMusicPlaylist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 1 addition & 7 deletions xbmc/GUIWindowMusicPlaylistEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 1 addition & 7 deletions xbmc/GUIWindowMusicSongs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 1 addition & 7 deletions xbmc/lib/libPython/xbmcmodule/GUIPythonWindowXML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 633804e

Please sign in to comment.