[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / pictures / GUIViewStatePictures.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 "GUIViewStatePictures.h"
22 #include "FileItem.h"
23 #include "view/ViewState.h"
24 #include "settings/GUISettings.h"
25 #include "settings/AdvancedSettings.h"
26 #include "settings/Settings.h"
27 #include "filesystem/Directory.h"
28 #include "filesystem/PluginDirectory.h"
29 #include "guilib/LocalizeStrings.h"
30 #include "guilib/Key.h"
31
32 using namespace XFILE;
33 using namespace ADDON;
34
35 CGUIViewStateWindowPictures::CGUIViewStateWindowPictures(const CFileItemList& items) : CGUIViewState(items)
36 {
37   if (items.IsVirtualDirectoryRoot())
38   {
39     AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS());
40     AddSortMethod(SORT_METHOD_DRIVE_TYPE, 564, LABEL_MASKS());
41     SetSortMethod(SORT_METHOD_LABEL);
42
43     SetViewAsControl(DEFAULT_VIEW_LIST);
44
45     SetSortOrder(SortOrderAscending);
46   }
47   else
48   {
49     AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%L", "%I", "%L", ""));  // Filename, Size | Foldername, empty
50     AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%L", "%I", "%L", "%I"));  // Filename, Size | Foldername, Size
51     AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J"));  // Filename, Date | Foldername, Date
52     AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%L", "%I", "%L", ""));  // Filename, Size | FolderName, empty
53
54     SetSortMethod(g_settings.m_viewStatePictures.m_sortMethod);
55     SetViewAsControl(g_settings.m_viewStatePictures.m_viewMode);
56     SetSortOrder(g_settings.m_viewStatePictures.m_sortOrder);
57   }
58   LoadViewState(items.GetPath(), WINDOW_PICTURES);
59 }
60
61 void CGUIViewStateWindowPictures::SaveViewState()
62 {
63   SaveViewToDb(m_items.GetPath(), WINDOW_PICTURES, &g_settings.m_viewStatePictures);
64 }
65
66 CStdString CGUIViewStateWindowPictures::GetLockType()
67 {
68   return "pictures";
69 }
70
71 CStdString CGUIViewStateWindowPictures::GetExtensions()
72 {
73   if (g_guiSettings.GetBool("pictures.showvideos"))
74     return g_settings.m_pictureExtensions+"|"+g_settings.m_videoExtensions;
75
76   return g_settings.m_pictureExtensions;
77 }
78
79 VECSOURCES& CGUIViewStateWindowPictures::GetSources()
80 {
81   AddAddonsSource("image", g_localizeStrings.Get(1039), "DefaultAddonPicture.png");
82   AddOrReplace(g_settings.m_pictureSources, CGUIViewState::GetSources());
83   return g_settings.m_pictureSources;
84 }
85