2 * Copyright (C) 2005-2008 Team XBMC
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)
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.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "video/VideoDatabase.h"
23 #include "DirectoryNodeOverview.h"
24 #include "settings/AdvancedSettings.h"
25 #include "settings/Settings.h"
27 #include "guilib/LocalizeStrings.h"
29 using namespace XFILE::VIDEODATABASEDIRECTORY;
32 CDirectoryNodeOverview::CDirectoryNodeOverview(const CStdString& strName, CDirectoryNode* pParent)
33 : CDirectoryNode(NODE_TYPE_OVERVIEW, strName, pParent)
38 NODE_TYPE CDirectoryNodeOverview::GetChildType()
41 return NODE_TYPE_MOVIES_OVERVIEW;
42 else if (GetName()=="2")
43 return NODE_TYPE_TVSHOWS_OVERVIEW;
44 else if (GetName() == "3")
45 return NODE_TYPE_MUSICVIDEOS_OVERVIEW;
46 else if (GetName() == "4")
47 return NODE_TYPE_RECENTLY_ADDED_MOVIES;
48 else if (GetName() == "5")
49 return NODE_TYPE_RECENTLY_ADDED_EPISODES;
50 else if (GetName() == "6")
51 return NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS;
53 return NODE_TYPE_NONE;
56 bool CDirectoryNodeOverview::GetContent(CFileItemList& items)
58 CVideoDatabase database;
60 bool hasMovies = database.HasContent(VIDEODB_CONTENT_MOVIES);
61 bool hasTvShows = database.HasContent(VIDEODB_CONTENT_TVSHOWS);
62 bool hasMusicVideos = database.HasContent(VIDEODB_CONTENT_MUSICVIDEOS);
63 vector<pair<const char*, int> > vec;
66 if (g_settings.m_bMyVideoNavFlatten)
67 vec.push_back(make_pair("1/2", 342));
69 vec.push_back(make_pair("1", 342)); // Movies
73 if (g_settings.m_bMyVideoNavFlatten)
74 vec.push_back(make_pair("2/2", 20343));
76 vec.push_back(make_pair("2", 20343)); // TV Shows
80 if (g_settings.m_bMyVideoNavFlatten)
81 vec.push_back(make_pair("3/2", 20389));
83 vec.push_back(make_pair("3", 20389)); // Music Videos
85 if (!g_advancedSettings.m_bVideoLibraryHideRecentlyAddedItems)
88 vec.push_back(make_pair("4", 20386)); // Recently Added Movies
90 vec.push_back(make_pair("5", 20387)); // Recently Added Episodes
92 vec.push_back(make_pair("6", 20390)); // Recently Added Music Videos
94 CStdString path = BuildPath();
95 for (unsigned int i = 0; i < vec.size(); ++i)
97 CFileItemPtr pItem(new CFileItem(path + vec[i].first + "/", true));
98 pItem->SetLabel(g_localizeStrings.Get(vec[i].second));
99 pItem->SetLabelPreformated(true);
100 pItem->SetCanQueue(false);