[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / programs / GUIViewStatePrograms.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 "GUIViewStatePrograms.h"
22 #include "FileItem.h"
23 #include "view/ViewState.h"
24 #include "settings/GUISettings.h"
25 #include "settings/Settings.h"
26 #include "filesystem/Directory.h"
27 #include "guilib/LocalizeStrings.h"
28 #include "guilib/Key.h"
29
30 using namespace XFILE;
31 using namespace ADDON;
32
33 CGUIViewStateWindowPrograms::CGUIViewStateWindowPrograms(const CFileItemList& items) : CGUIViewState(items)
34 {
35   if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
36     AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%K", "%I", "%L", ""));  // Titel, Size | Foldername, empty
37   else
38     AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%K", "%I", "%L", ""));  // Titel, Size | Foldername, empty
39
40   SetSortMethod(g_settings.m_viewStatePrograms.m_sortMethod);
41   SetViewAsControl(g_settings.m_viewStatePrograms.m_viewMode);
42   SetSortOrder(g_settings.m_viewStatePrograms.m_sortOrder);
43
44   LoadViewState(items.GetPath(), WINDOW_PROGRAMS);
45 }
46
47 void CGUIViewStateWindowPrograms::SaveViewState()
48 {
49   SaveViewToDb(m_items.GetPath(), WINDOW_PROGRAMS, &g_settings.m_viewStatePrograms);
50 }
51
52 CStdString CGUIViewStateWindowPrograms::GetLockType()
53 {
54   return "programs";
55 }
56
57 CStdString CGUIViewStateWindowPrograms::GetExtensions()
58 {
59   return ".xbe|.cut";
60 }
61
62 VECSOURCES& CGUIViewStateWindowPrograms::GetSources()
63 {
64   AddAddonsSource("executable", g_localizeStrings.Get(1043), "DefaultAddonProgram.png");
65 #if defined(TARGET_ANDROID)
66   AddAndroidSource("apps", g_localizeStrings.Get(20244), "DefaultProgram.png");
67 #endif
68   AddOrReplace(g_settings.m_programSources,CGUIViewState::GetSources());
69   return g_settings.m_programSources;
70 }
71