Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

musicdatabasedirectory: replace all the CDirectoryNode implementation…

…s that provide a list of grouped items with CDirectoryNodeGrouped
  • Loading branch information...
commit ce71024b9d7f67b18ec200cd88b9cca0bf090d71 1 parent aed5e69
@Montellese Montellese authored
View
12 project/VS2010Express/XBMC.vcxproj
@@ -493,6 +493,7 @@
<ClCompile Include="..\..\xbmc\filesystem\MultiPathDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\MultiPathFile.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseDirectory.cpp" />
+ <ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseDirectory\DirectoryNodeGrouped.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseFile.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\MusicFileDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\MusicSearchDirectory.cpp" />
@@ -1042,6 +1043,7 @@
<ClInclude Include="..\..\xbmc\filesystem\DAVCommon.h" />
<ClInclude Include="..\..\xbmc\filesystem\DAVFile.h" />
<ClInclude Include="..\..\xbmc\filesystem\ImageFile.h" />
+ <ClInclude Include="..\..\xbmc\filesystem\MusicDatabaseDirectory\DirectoryNodeGrouped.h" />
<ClInclude Include="..\..\xbmc\filesystem\VideoDatabaseDirectory\DirectoryNodeGrouped.h" />
<ClInclude Include="..\..\xbmc\filesystem\windows\WINFileSMB.h" />
<ClInclude Include="..\..\xbmc\filesystem\windows\WINSMBDirectory.h" />
@@ -1874,20 +1876,12 @@
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbumTop100.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbumTop100Song.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeArtist.cpp" />
- <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeGenre.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeOverview.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeRoot.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeSingles.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeSong.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeSongTop100.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeTop100.cpp" />
- <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYear.cpp">
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug Testsuite|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
- </ClCompile>
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYearAlbum.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYearSong.cpp" />
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\QueryParams.cpp" />
@@ -2710,14 +2704,12 @@
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbumTop100.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeAlbumTop100Song.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeArtist.h" />
- <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeGenre.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeOverview.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeRoot.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeSingles.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeSong.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeSongTop100.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeTop100.h" />
- <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYear.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYearAlbum.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYearSong.h" />
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\QueryParams.h" />
View
18 project/VS2010Express/XBMC.vcxproj.filters
@@ -702,9 +702,6 @@
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeArtist.cpp">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClCompile>
- <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeGenre.cpp">
- <Filter>filesystem\MusicDatabaseDirectory</Filter>
- </ClCompile>
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeOverview.cpp">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClCompile>
@@ -723,9 +720,6 @@
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeTop100.cpp">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClCompile>
- <ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYear.cpp">
- <Filter>filesystem\MusicDatabaseDirectory</Filter>
- </ClCompile>
<ClCompile Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYearAlbum.cpp">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClCompile>
@@ -2994,6 +2988,9 @@
<ClCompile Include="..\..\xbmc\filesystem\VideoDatabaseDirectory\DirectoryNodeGrouped.cpp">
<Filter>filesystem\VideoDatabaseDirectory</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\filesystem\MusicDatabaseDirectory\DirectoryNodeGrouped.cpp">
+ <Filter>filesystem\MusicDatabaseDirectory</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
@@ -3521,9 +3518,6 @@
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeArtist.h">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClInclude>
- <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeGenre.h">
- <Filter>filesystem\MusicDatabaseDirectory</Filter>
- </ClInclude>
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeOverview.h">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClInclude>
@@ -3542,9 +3536,6 @@
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeTop100.h">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClInclude>
- <ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYear.h">
- <Filter>filesystem\MusicDatabaseDirectory</Filter>
- </ClInclude>
<ClInclude Include="..\..\xbmc\FileSystem\MusicDatabaseDirectory\DirectoryNodeYearAlbum.h">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClInclude>
@@ -5852,6 +5843,9 @@
<ClInclude Include="..\..\xbmc\filesystem\VideoDatabaseDirectory\DirectoryNodeGrouped.h">
<Filter>filesystem\VideoDatabaseDirectory</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\filesystem\MusicDatabaseDirectory\DirectoryNodeGrouped.h">
+ <Filter>filesystem\MusicDatabaseDirectory</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
View
8 xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp
@@ -23,7 +23,7 @@
#include "QueryParams.h"
#include "DirectoryNodeRoot.h"
#include "DirectoryNodeOverview.h"
-#include "DirectoryNodeGenre.h"
+#include "DirectoryNodeGrouped.h"
#include "DirectoryNodeArtist.h"
#include "DirectoryNodeAlbum.h"
#include "DirectoryNodeSong.h"
@@ -37,7 +37,6 @@
#include "DirectoryNodeAlbumTop100Song.h"
#include "DirectoryNodeAlbumCompilations.h"
#include "DirectoryNodeAlbumCompilationsSongs.h"
-#include "DirectoryNodeYear.h"
#include "DirectoryNodeYearAlbum.h"
#include "DirectoryNodeYearSong.h"
#include "DirectoryNodeSingles.h"
@@ -116,7 +115,8 @@ CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& str
case NODE_TYPE_OVERVIEW:
return new CDirectoryNodeOverview(strName, pParent);
case NODE_TYPE_GENRE:
- return new CDirectoryNodeGenre(strName, pParent);
+ case NODE_TYPE_YEAR:
+ return new CDirectoryNodeGrouped(Type, strName, pParent);
case NODE_TYPE_ARTIST:
return new CDirectoryNodeArtist(strName, pParent);
case NODE_TYPE_ALBUM:
@@ -145,8 +145,6 @@ CDirectoryNode* CDirectoryNode::CreateNode(NODE_TYPE Type, const CStdString& str
return new CDirectoryNodeAlbumCompilations(strName, pParent);
case NODE_TYPE_ALBUM_COMPILATIONS_SONGS:
return new CDirectoryNodeAlbumCompilationsSongs(strName, pParent);
- case NODE_TYPE_YEAR:
- return new CDirectoryNodeYear(strName, pParent);
case NODE_TYPE_YEAR_ALBUM:
return new CDirectoryNodeYearAlbum(strName, pParent);
case NODE_TYPE_YEAR_SONG:
View
41 ...tem/MusicDatabaseDirectory/DirectoryNodeGenre.cpp → ...m/MusicDatabaseDirectory/DirectoryNodeGrouped.cpp
@@ -18,43 +18,52 @@
*
*/
-#include "DirectoryNodeGenre.h"
+#include "DirectoryNodeGrouped.h"
#include "QueryParams.h"
#include "music/MusicDatabase.h"
using namespace XFILE::MUSICDATABASEDIRECTORY;
-CDirectoryNodeGenre::CDirectoryNodeGenre(const CStdString& strName, CDirectoryNode* pParent)
- : CDirectoryNode(NODE_TYPE_GENRE, strName, pParent)
-{
-
-}
+CDirectoryNodeGrouped::CDirectoryNodeGrouped(NODE_TYPE type, const CStdString& strName, CDirectoryNode* pParent)
+ : CDirectoryNode(type, strName, pParent)
+{ }
-NODE_TYPE CDirectoryNodeGenre::GetChildType() const
+NODE_TYPE CDirectoryNodeGrouped::GetChildType() const
{
+ if (GetType() == NODE_TYPE_YEAR)
+ return NODE_TYPE_YEAR_ALBUM;
+
return NODE_TYPE_ARTIST;
}
-CStdString CDirectoryNodeGenre::GetLocalizedName() const
+CStdString CDirectoryNodeGrouped::GetLocalizedName() const
{
CMusicDatabase db;
if (db.Open())
- return db.GetGenreById(GetID());
+ return db.GetItemById(GetContentType(), GetID());
return "";
}
-bool CDirectoryNodeGenre::GetContent(CFileItemList& items) const
+bool CDirectoryNodeGrouped::GetContent(CFileItemList& items) const
{
CMusicDatabase musicdatabase;
if (!musicdatabase.Open())
return false;
- CQueryParams params;
- CollectQueryParams(params);
-
- bool bSuccess=musicdatabase.GetGenresNav(BuildPath(), items);
+ return musicdatabase.GetItems(BuildPath(), GetContentType(), items);
+}
- musicdatabase.Close();
+std::string CDirectoryNodeGrouped::GetContentType() const
+{
+ switch (GetType())
+ {
+ case NODE_TYPE_GENRE:
+ return "genres";
+ case NODE_TYPE_YEAR:
+ return "years";
+ default:
+ break;
+ }
- return bSuccess;
+ return "";
}
View
7 ...ystem/MusicDatabaseDirectory/DirectoryNodeGenre.h → ...tem/MusicDatabaseDirectory/DirectoryNodeGrouped.h
@@ -25,14 +25,17 @@ namespace XFILE
{
namespace MUSICDATABASEDIRECTORY
{
- class CDirectoryNodeGenre : public CDirectoryNode
+ class CDirectoryNodeGrouped : public CDirectoryNode
{
public:
- CDirectoryNodeGenre(const CStdString& strName, CDirectoryNode* pParent);
+ CDirectoryNodeGrouped(NODE_TYPE type, const CStdString& strName, CDirectoryNode* pParent);
protected:
virtual NODE_TYPE GetChildType() const;
virtual bool GetContent(CFileItemList& items) const;
virtual CStdString GetLocalizedName() const;
+
+ private:
+ std::string GetContentType() const;
};
}
}
View
57 xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYear.cpp
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2005-2013 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, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "DirectoryNodeYear.h"
-#include "QueryParams.h"
-#include "music/MusicDatabase.h"
-
-using namespace XFILE::MUSICDATABASEDIRECTORY;
-
-CDirectoryNodeYear::CDirectoryNodeYear(const CStdString& strName, CDirectoryNode* pParent)
- : CDirectoryNode(NODE_TYPE_YEAR, strName, pParent)
-{
-
-}
-
-NODE_TYPE CDirectoryNodeYear::GetChildType() const
-{
- return NODE_TYPE_YEAR_ALBUM;
-}
-
-CStdString CDirectoryNodeYear::GetLocalizedName() const
-{
- return GetName();
-}
-
-bool CDirectoryNodeYear::GetContent(CFileItemList& items) const
-{
- CMusicDatabase musicdatabase;
- if (!musicdatabase.Open())
- return false;
-
- CQueryParams params;
- CollectQueryParams(params);
-
- bool bSuccess=musicdatabase.GetYearsNav(BuildPath(), items);
-
- musicdatabase.Close();
-
- return bSuccess;
-}
View
40 xbmc/filesystem/MusicDatabaseDirectory/DirectoryNodeYear.h
@@ -1,40 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2005-2013 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, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "DirectoryNode.h"
-
-namespace XFILE
-{
- namespace MUSICDATABASEDIRECTORY
- {
- class CDirectoryNodeYear : public CDirectoryNode
- {
- public:
- CDirectoryNodeYear(const CStdString& strName, CDirectoryNode* pParent);
- protected:
- virtual NODE_TYPE GetChildType() const;
- virtual bool GetContent(CFileItemList& items) const;
- virtual CStdString GetLocalizedName() const;
- };
- }
-}
-
-
View
3  xbmc/filesystem/MusicDatabaseDirectory/Makefile
@@ -9,14 +9,13 @@ SRCS=DirectoryNode.cpp \
DirectoryNodeAlbumTop100.cpp \
DirectoryNodeAlbumTop100Song.cpp \
DirectoryNodeArtist.cpp \
- DirectoryNodeGenre.cpp \
+ DirectoryNodeGrouped.cpp \
DirectoryNodeOverview.cpp \
DirectoryNodeRoot.cpp \
DirectoryNodeSingles.cpp \
DirectoryNodeSong.cpp \
DirectoryNodeSongTop100.cpp \
DirectoryNodeTop100.cpp \
- DirectoryNodeYear.cpp \
DirectoryNodeYearAlbum.cpp \
DirectoryNodeYearSong.cpp \
QueryParams.cpp \
Please sign in to comment.
Something went wrong with that request. Please try again.