[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / filesystem / MusicDatabaseDirectory / DirectoryNodeTop100.cpp
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://www.xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include "DirectoryNodeTop100.h"
22 #include "FileItem.h"
23 #include "guilib/LocalizeStrings.h"
24
25 using namespace std;
26 using namespace XFILE::MUSICDATABASEDIRECTORY;
27
28 Node Top100Children[] = {
29                           { NODE_TYPE_SONG_TOP100,  1, 10504 },
30                           { NODE_TYPE_ALBUM_TOP100, 2, 10505 },
31                         };
32
33 CDirectoryNodeTop100::CDirectoryNodeTop100(const CStdString& strName, CDirectoryNode* pParent)
34   : CDirectoryNode(NODE_TYPE_TOP100, strName, pParent)
35 {
36
37 }
38
39 NODE_TYPE CDirectoryNodeTop100::GetChildType() const
40 {
41   for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i)
42     if (GetID() == Top100Children[i].id)
43       return Top100Children[i].node;
44
45   return NODE_TYPE_NONE;
46 }
47
48 CStdString CDirectoryNodeTop100::GetLocalizedName() const
49 {
50   for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i)
51     if (GetID() == Top100Children[i].id)
52       return g_localizeStrings.Get(Top100Children[i].label);
53   return "";
54 }
55
56 bool CDirectoryNodeTop100::GetContent(CFileItemList& items) const
57 {
58   for (unsigned int i = 0; i < sizeof(Top100Children) / sizeof(Node); ++i)
59   {
60     CFileItemPtr pItem(new CFileItem(g_localizeStrings.Get(Top100Children[i].label)));
61     CStdString strDir;
62     strDir.Format("%ld/", Top100Children[i].id);
63     pItem->SetPath(BuildPath() + strDir);
64     pItem->m_bIsFolder = true;
65     items.Add(pItem);
66   }
67
68   return true;
69 }