LinuxRendererGLES.h: correct path to `DVDVideoCodec.h`
[vuplus_xbmc] / xbmc / filesystem / VideoDatabaseDirectory / DirectoryNodeOverview.cpp
1 /*
2  *      Copyright (C) 2005-2008 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, write to
17  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18  *  http://www.gnu.org/copyleft/gpl.html
19  *
20  */
21
22 #include "video/VideoDatabase.h"
23 #include "DirectoryNodeOverview.h"
24 #include "settings/AdvancedSettings.h"
25 #include "settings/Settings.h"
26 #include "FileItem.h"
27 #include "guilib/LocalizeStrings.h"
28
29 using namespace XFILE::VIDEODATABASEDIRECTORY;
30 using namespace std;
31
32 CDirectoryNodeOverview::CDirectoryNodeOverview(const CStdString& strName, CDirectoryNode* pParent)
33   : CDirectoryNode(NODE_TYPE_OVERVIEW, strName, pParent)
34 {
35
36 }
37
38 NODE_TYPE CDirectoryNodeOverview::GetChildType()
39 {
40   if (GetName()=="1")
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;
52
53   return NODE_TYPE_NONE;
54 }
55
56 bool CDirectoryNodeOverview::GetContent(CFileItemList& items)
57 {
58   CVideoDatabase database;
59   database.Open();
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;
64   if (hasMovies)
65   {
66     if (g_settings.m_bMyVideoNavFlatten)
67       vec.push_back(make_pair("1/2", 342));
68     else
69       vec.push_back(make_pair("1", 342));   // Movies
70   }
71   if (hasTvShows)
72   {
73     if (g_settings.m_bMyVideoNavFlatten)
74       vec.push_back(make_pair("2/2", 20343));
75     else
76       vec.push_back(make_pair("2", 20343)); // TV Shows
77   }
78   if (hasMusicVideos)
79   {
80     if (g_settings.m_bMyVideoNavFlatten)
81       vec.push_back(make_pair("3/2", 20389));
82     else
83       vec.push_back(make_pair("3", 20389)); // Music Videos
84   }
85   if (!g_advancedSettings.m_bVideoLibraryHideRecentlyAddedItems)
86   {
87     if (hasMovies)
88       vec.push_back(make_pair("4", 20386));  // Recently Added Movies
89     if (hasTvShows)
90       vec.push_back(make_pair("5", 20387)); // Recently Added Episodes
91     if (hasMusicVideos)
92       vec.push_back(make_pair("6", 20390)); // Recently Added Music Videos
93   }
94   CStdString path = BuildPath();
95   for (unsigned int i = 0; i < vec.size(); ++i)
96   {
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);
101     items.Add(pItem);
102   }
103
104   return true;
105 }